/// <summary> /// Generate Smiles /// </summary> /// <param name="mol"></param> /// <param name="flags"></param> /// <returns></returns> public static String AtomContainerToSmiles( IAtomContainer mol, SmilesGeneratorType flags) { ApplyAromaticity(mol); SmilesGenerator sg = null; if ((flags & SmilesGeneratorType.Generic) != 0) { sg = SmilesGenerator.generic(); } else if ((flags & SmilesGeneratorType.Isomeric) != 0) { sg = SmilesGenerator.isomeric(); } else if ((flags & SmilesGeneratorType.Unique) != 0) { sg = SmilesGenerator.unique(); } else if ((flags & SmilesGeneratorType.Absolute) != 0) { sg = SmilesGenerator.unique(); } else { throw new Exception("Canonical/Stereo/Isotop types not defined"); } if ((flags & SmilesGeneratorType.NotAromatic) != 0) { } // not aromatic else { sg = sg.aromatic(); // aromatic by default even if not specified } if ((flags & SmilesGeneratorType.WithAtomClasses) != 0) { sg = sg.withAtomClasses(); } string smiles = sg.create(mol); return(smiles); }
public static string CanonicalizeSmiles( string smiles, SmilesGeneratorType smiGenFlags) { IAtomContainer mol = SmilesToAtomContainer(smiles); if (mol.getAtomCount() == 0) { return(""); } else { string smiles2 = AtomContainerToSmiles(mol, smiGenFlags); return(smiles2); } }
/// <summary> /// CanonicalizeSmiles /// </summary> /// <param name="smiles"></param> /// <returns></returns> public static string CanonicalizeSmiles(string smiles) { SmilesGeneratorType smiGenFlags = SmilesGeneratorType.Unique | SmilesGeneratorType.Aromatic; return(CanonicalizeSmiles(smiles, smiGenFlags)); }