Hi,

 

I have some JoeLib code I am trying to convert to JoeLib2.

 

When I run the JoeLib2 code, I get this error for some smiles string inputs (example below). But it runs just fine in the JoeLib code. Did I miss something in the conversion?

 

Exception in thread "main" java.lang.RuntimeException: : Molecule modification counter must be zero.

       at joelib2.molecule.types.AtomPropertyHelper.accessAtomProperty(Unknown Source)

       at joelib2.molecule.types.AtomPropertyHelper.getLabelCache(Unknown Source)

       at joelib2.molecule.types.AtomPropertyHelper.getBooleanAtomProperty(Unknown Source)

       at joelib2.molecule.types.AtomPropertyHelper.getBooleanAtomProperty(Unknown Source)

       at joelib2.feature.types.atomlabel.AtomIsAlphaBetaUnsaturated.isValue(Unknown Source)

       at joelib2.molecule.AtomHelper.getNBV3Dvalence1(Unknown Source)

       at joelib2.molecule.AtomHelper.getNewBondVector3D(Unknown Source)

       at joelib2.molecule.ProtonationHelper.addHydrogens(Unknown Source)

       at joelib2.molecule.BasicConformerMolecule.addHydrogens(Unknown Source)

       at edu.scripps.fl.match.test.CleanMoleculeJoeLib2Test.main(CleanMoleculeJoeLib2Test.java:20)

 

 

What I really don’t understand is that just before I run the function mol.addHydrogens() the modificationCounter is 0.

 

JoeLib:

 

JOESmilesParser parser = new JOESmilesParser();

              JOEAromaticTyper typer = JOEAromaticTyper.instance();

              JOEMol mol = new JOEMol();

              parser.smiToMol(mol, "c1(N2CCC(O)CC2)c3c(nc(cc(c4cccc(OC)c4)n5)n15)CCCC3");

              typer.assignAromaticFlags(mol);

              mol.addHydrogens();

              for(AtomIterator ait = mol.atomIterator(); ait.hasNext(); ) {

                     JOEAtom atom = ait.nextAtom();

                     if (atom.isCarbon() && atom.getFormalCharge() > 0)

                           atom.setFormalCharge(0);

              }

 

 

JoeLib2:

 

SMILESParser parser = new SMILESParser();

              AromaticityTyper typer = BasicAromaticityTyper.instance();

              Molecule mol = new BasicConformerMolecule();

              parser.smiles2molecule(mol, "c1(N2CCC(O)CC2)c3c(nc(cc(c4cccc(OC)c4)n5)n15)CCCC3");

              typer.assignAromaticFlags(mol, null, null);

              mol.addHydrogens();

              for(AtomIterator ait = mol.atomIterator(); ait.hasNext(); ) {

                     Atom atom = ait.nextAtom();

                     if (atom.getAtomicNumber() == 6 && atom.getFormalCharge() > 0)

                           atom.setFormalCharge(0);

              }

 

 

Thank you for your help,

 

Stephanie