Hi,

Imagine I have two rdkit mol objects, one from SD and one from SMILES:

import os
import StringIO
from rdkit.Chem import SDMolSupplier
from rdkit.Chem import SmilesMolSupplier
from rdkit.Chem import SmilesWriter

mol = '''
  MJ150413

  6  6  0  0  0  0  0  0  0  0999 V2000
    0.7144    1.2375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.4289    0.8250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.4289   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.7144   -0.4125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.8250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0  0  0  0
  2  3  1  0  0  0  0
  3  4  2  0  0  0  0
  4  5  1  0  0  0  0
  5  6  2  0  0  0  0
  1  6  1  0  0  0  0
M  END
 '''

suppl = SDMolSupplier()
suppl.SetData(mol)
fromSD = suppl.next()

suppl = SmilesMolSupplier()
suppl.SetData('C', titleLine=False)
fromSMILES = suppl.next()


Now I want to convert them to SMILES. For the mol from SD, the
identifier is missing:

sio = StringIO.StringIO()
w = SmilesWriter(sio, delimiter=' ', nameHeader='Name',
includeHeader=True, isomericSmiles=False, kekuleSmiles=False)
w.write(fromSD)
w.flush()
print sio.getvalue()

>>> SMILES Name
>>> c1ccccc1

but for mol from SMILES it's fine:

w.write(fromSMILES)
w.flush()
print sio.getvalue()

>>> SMILES Name
>>> c1ccccc1
>>> C 1


Is that a bug or an expected behavior? Is it possible to get
identifiers for both mols?


Kind regards,

Michał Nowotka

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to