Parser

From NMReDATA
Revision as of 07:31, 29 January 2019 by Admin (talk | contribs)
Jump to: navigation, search

Possible structure of the object including NMReDATA reflecting the format of NMReDATA tags of SDF files.

Note: This is not designed to include ambiguities in the assignment. This is therefore only for use with Level=0.

Reading the SDF file

Libraries for divers languages exist to read SDF files. This paragraph is only relevant if you write your own reader/writer

We recommend having in mind, when reading, that an SDF file will have to be written at some point later. We recommend to write them in the same oder, but I don't think that this suggerstion is followed by all writer, so be ready for the TAGS to appear in any order.

If not too large, the content of the input should be kept in memory so that it can be written later. Since SDF files may contain divers TAGS (not only the NMREDATA tags) they should all be written in the output SDF file.

We recommend to

  • Open the SDF file
  • Read/store the molblock as chain of characters
  • Read/store the TAGS as chain of characters
  • Close the file
  • Analyses/check the molblock (see possible object structure of NMReDATA). Be

Determine how to read the NMREDATA tags

Scan the tags and list the index of the ones including NMREDATA_ in their name

Read the NMReDATA tag. Keep in mind the end of line problem .

First read and analyse the NMREDATA_VERSION to 
  • determine what character should be ignored (ASCII 10, except for version 1)
  • determine the line separator ("\", except for version 1, in which cas the ASCII 10 is the line separator)

read the NMREDATA tags

Tags have two parts:

  • in the first all line start with a variable name followed by the "=" sign followed by the content
  • in the first all line start with a variable name followed by the "=" sign followed by the content