Closed Sarif-HK closed 3 years ago
this CGR = m.compose(m)
creates cgr graph, but without any dynamic atom/bond. if you want cgr try to compose different molecules with correct atom-to-atom mapping (e.g. tautomers)
SDF file is valid, but contains invalid atom valence
try to rename mol to sdf. sdf contains mol with $$$$ line in the end.
Hello, thanks for your comment! Well, first of all what is the function CreateMoleculeFromString(message.content)
or at least which output does it give? If you already have molecule, you can directly pass it to SDFWrite
method.
For example, imagine we have SMILES string C1=CC=CC=C1CCCC
:
from CGRtools.files import SMILESRead, SDFWrite
smiles = 'C1=CC=CC=C1CCCC'
smiles_to_mol = SMILESRead.create_parser(remap=False, ignore=True)
mol = smiles_to_mol(smiles)
with SDFWrite('output_mol.sdf') as output:
output.write(mol)
this
CGR = m.compose(m)
creates cgr graph, but without any dynamic atom/bond. if you want cgr try to compose different molecules with correct atom-to-atom mapping (e.g. tautomers)SDF file is valid, but contains invalid atom valence
try to rename mol to sdf. sdf contains mol with $$$$ line in the end.
this fixed it, apparently my function wrote weird valences for phenyl groups, thank you.
The issue:
When I write a molecule container to an mol sdf file with SDFWrite then try opening this file in any molecular editor whatsoever(Accelrys draw, rdkit lib, etc) the editor will either error or return a blank canvas.
The code and output:
which creates a file
which im unable to open.
Conclusion
Am I using SDFWrite wrong? Am I using .compose wrong? Any help would be very useful. Thanks for your time and sorry if this doesnt fit the issue guidelines for this project. I would like to add that the molecule container seems valid because I can run operations on it, such as printing it to an svg image.