From: Andreas M. <an...@ma...> - 2004-12-03 13:34:46
|
If I use ------------------CODE BEGIN--------------------- // create mol object out of this smiles string JOESmilesParser.smiToMol(mol, smiles, smiles); =09 // clone the molecule // and recalculate // numbers JOEMol tMol =3D (JOEMol) mol.clone(false); morgan.calculate(tMol); JOEMol rMol =3D morgan.renumber(tMol); // (*) JOEMol rMol =3D tMol; // create mol to smiles converter=20 m2s.init(); // do some correction m2s.correctAromaticAmineCharge(rMol); // String buffer to hold the canonified string m2s.createSmiString(rMol, smilesb); return smilesb.toString(); ------------------CODE BEGIN--------------------- I get a NULL pointer exception at (*) with the following: Exception in thread "main" java.lang.NullPointerException at joelib.algo.morgan.Morgan.getBFS(Morgan.java:329) at joelib.algo.morgan.Morgan.renumber(Morgan.java:261) at SmilesCanonifier.canonify(SmilesCanonifier.java:35) at SmilesCanonifier.main(SmilesCanonifier.java:52) =09 Without (*), however, it works quite well, too. Only in some molecules it switches from (for example) 'C12CC3CC(CC(C3)C2)C1' to 'C12CC3CC(CC(C3)C1)C2', but that's not so problematic. Also, the missing salt support is no acute problem. What does (*) do, exactly? Greetings, Andreas =09 On Tue, Nov 30, 2004 at 08:17:37AM +0100, Joerg K. Wegner wrote: > Hi Andreas, >=20 > here is the code fragment used by joelib.io.types.Smiles. Please note=20 > that the actual morgan algorithm can not deal with salts. A solution=20 > would be to get all contiguous fragments in decreasing order (method=20 > mol.contiguousFragments(List)) and apply the morgan algorithm to each=20 > fragment. Then you must simply connect those fragments in the SMILES=20 > String with frag1smiles.frag2smiles.frag3smiles >=20 > Mmhh, its not a big deal but i'm at the moment heavily busy with the=20 > JOELib2 refactoring. Anyway, here is the code: >=20 > if (doCanonical) > { > JOEMol tMol =3D (JOEMol) mol.clone(false); > morgan.calculate(tMol); > JOEMol rMol =3D morgan.renumber(tMol); > m2s.correctAromaticAmineCharge(rMol); > m2s.createSmiString(rMol, smilesb); > } > else > { > m2s.correctAromaticAmineCharge(mol); > m2s.createSmiString(mol, smilesb); > } >=20 > MfG, Joerg >=20 > >with the following code I read in a SMILES, build a molecule out of=20 > >it and reencode it as a string: > > > >----------------- BEGIN CODE -------------------------------- > > > >import joelib.molecule.*; > >import joelib.smiles.*; > > > >public class SmilesCanonifier { > > =20 > > public String canonify(String smiles) { > > JOEMol mol=3Dnew JOEMol(); > > JOEMol2Smi m2s =3D new JOEMol2Smi(); m2s.init(); > > StringBuffer smilesb =3D new StringBuffer(1000); > > > > // create mol object out of this smiles string > > JOESmilesParser.smiToMol(mol, smiles, smiles); > > > > // create mol to smiles converter > > m2s.init(); > > // do some correction > > m2s.correctAromaticAmineCharge(mol); > > > > // String buffer to hold the canonified string > > m2s.createSmiString(mol, smilesb); > > return smilesb.toString(); > > } > > > > public static void main(String args[]) { > > String smiles =3D args[0]; > > System.out.println(smiles); > > SmilesCanonifier sc =3D new SmilesCanonifier(); > > System.out.println(sc.canonify(smiles)); > > } > >} > > > >----------------- END CODE ---------------------------------- > > > >When I try this on a SMILES s0 I get an equivalent output smiles s1. > >When I try it on s1, I get an equivalent output smiles s2, which is=20 > >different from s1. > >When I try it on s2, I get an equivalent output smiles s3, which is=20 > >the same as s1, s3=3Ds1. > >When I try it on s3=3Ds1, I get an equivalent output smiles s4, which=20 > >is the same as s2, s4=3Ds2. > > > >The process repeats from now on, switching between two SMILES=20 > >versions. > >Is there no canonical version? Otherwise, how can I get one? > > > >Greetings, > >Andi > > > > > > > >------------------------------------------------------- > >SF email is sponsored by - The IT Product Guide > >Read honest & candid reviews on hundreds of IT Products from real=20 > >users. > >Discover which products truly live up to the hype. Start reading=20 > >now. http://productguide.itmanagersjournal.com/ > >_______________________________________________ > >Joelib-help mailing list > >Joe...@li... > >https://lists.sourceforge.net/lists/listinfo/joelib-help > > >=20 >=20 > --=20 > Dipl. Chem. Joerg K. Wegner > Center of Bioinformatics Tuebingen (ZBIT) > Department of Computer Architecture > Univ. Tuebingen, Sand 1, D-72076 Tuebingen, Germany > Phone: (+49/0) 7071 29 78970 > Fax: (+49/0) 7071 29 5091 > E-Mail: mailto:we...@in... > WWW: http://www-ra.informatik.uni-tuebingen.de > -- > Never mistake motion for action. > (E. Hemingway) >=20 > Never mistake action for meaningful action. > (Hugo Kubinyi,2004) >=20 >=20 >=20 > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real=20 > users. > Discover which products truly live up to the hype. Start reading now.=20 > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Joelib-help mailing list > Joe...@li... > https://lists.sourceforge.net/lists/listinfo/joelib-help Viele Gr=FC=DFe, Andi --=20 http://www.maunz.de Yoda of Borg are we: Futile is resistance. Assimilate you, we will. |