|
From: Joerg K. W. <we...@in...> - 2004-11-30 07:13:12
|
Hi Andreas,
here is the code fragment used by joelib.io.types.Smiles. Please note
that the actual morgan algorithm can not deal with salts. A solution
would be to get all contiguous fragments in decreasing order (method
mol.contiguousFragments(List)) and apply the morgan algorithm to each
fragment. Then you must simply connect those fragments in the SMILES
String with frag1smiles.frag2smiles.frag3smiles
Mmhh, its not a big deal but i'm at the moment heavily busy with the
JOELib2 refactoring. Anyway, here is the code:
if (doCanonical)
{
JOEMol tMol = (JOEMol) mol.clone(false);
morgan.calculate(tMol);
JOEMol rMol = morgan.renumber(tMol);
m2s.correctAromaticAmineCharge(rMol);
m2s.createSmiString(rMol, smilesb);
}
else
{
m2s.correctAromaticAmineCharge(mol);
m2s.createSmiString(mol, smilesb);
}
MfG, Joerg
> with the following code I read in a SMILES, build a molecule out of it and reencode it as a string:
>
> ----------------- BEGIN CODE --------------------------------
>
> import joelib.molecule.*;
> import joelib.smiles.*;
>
> public class SmilesCanonifier {
>
> public String canonify(String smiles) {
> JOEMol mol=new JOEMol();
> JOEMol2Smi m2s = new JOEMol2Smi(); m2s.init();
> StringBuffer smilesb = 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 = args[0];
> System.out.println(smiles);
> SmilesCanonifier sc = 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 different from s1.
> When I try it on s2, I get an equivalent output smiles s3, which is the same as s1, s3=s1.
> When I try it on s3=s1, I get an equivalent output smiles s4, which is the same as s2, s4=s2.
>
> The process repeats from now on, switching between two SMILES 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 users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Joelib-help mailing list
> Joe...@li...
> https://lists.sourceforge.net/lists/listinfo/joelib-help
>
--
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)
Never mistake action for meaningful action.
(Hugo Kubinyi,2004)
|