Returning the title and connection table of a molecule.

User 779e37e0e6

22-11-2016 19:49:57

Hi all,


I am using MolImporter to parse a SDF file.


molimport = MolImporter.new(sdf_file)


 while !molimport.isEndReached


  mol = molimport.read


  props = (0..(mol.getPropertyCount - 1)).to_a.map{|i| mol.getPropertyKey(i)}


end


I have a few questions:


Given the molecule mol (as declared earlier)


- How can I print the connection table and atom listing (as displayed in the original SDF format).


- How can I find the title of the molecule? Meaning the name that appears at the very begining of the structure representation in the SDF file.


I would like to get these information even when the molecule is not valid.


PS: attached is an SDF file. (The 5th molecule is invalid).


Thank you very much.


Regards,


Yann

ChemAxon 044c6721bc

23-11-2016 13:29:18

Hi,


- You can get the connection table (mol.getCtab()), but this is not the same as in the SDF file.


- mol.getName();


If the molecule is not valid, we cannot import it, so you cannot get any information about the it.


Best,


János