python - Retrieve all molecules from smiles file -
python - Retrieve all molecules from smiles file -
i working on .smiles files. file construction of .smiles file : http://en.wikipedia.org/wiki/chemical_file_format#smiles
i want atoms smiles file. means if there single 'c' atom means there 4 'h' atoms connected them.
i found while searching there modules in python can parse smiles format not give supported hydrogen atoms. (for illustration : give 'c' , not other 4 'h' atoms connected 'c' atom)
how can find atoms including connected 'h' atoms using python. illustration of smiles file needs converted in atoms including connected 'h' atoms:
[h]oc([h])([h])[c@@]1([h])c([h])=c([h])[c@@]([h])(n2c([h])nc3c(nc(nc23)n([h])[h])n([h])c2([h])c([h])([h])c2([h])[h])c1([h])[h]
thank in advance.
see open babel.
useful links on open babel site
"guides" capabilities using python open babel other tools, includes tool (obprop)see also, this blog (by casper steinmann) on chemical science python (using open babel, not though)
update see code(untested):
mymol = pybel.readstring("smi", "[h]oc([h])([h])[c@@]1([h])c([h])=c([h])[c@@]([h])(n2c([h])nc3c(nc(nc23)" + \ "n([h])[h])n([h])c2([h])c([h])([h])c2([h])[h])c1([h])[h") print mymol.addh()
python bioinformatics biopython cheminformatics
Comments
Post a Comment