From: Noel O'B. <bao...@gm...> - 2012-09-26 15:50:34
|
Atoms with atomic number 0 are written as *. Bonds with BO 4 are written as $. So...the following hack may work for you in most cases. :-) >>> import pybel >>> mol = pybel.readstring("smi", "CC(=O)Cl") >>> mol.atoms[0].OBAtom.SetAtomicNum(0) >>> print mol *C(=O)Cl >>> mol.atoms[2].OBAtom.SetAtomicNum(0) >>> print mol *C(=*)Cl >>> bond = mol.OBMol.GetBond(2, 3) >>> bond.GetBO() 2 >>> bond.SetBO(4) >>> print mol *C($*)Cl >>> print mol.write("smi").replace("$", "~") *C(~*)Cl - Noel On 26 September 2012 16:16, Pascal Muller <pas...@gm...> wrote: > Dear all, > > Having a molecule (let's say ethylpyridine CCc1cccnc1) and its scaffold > (pyridine c1ccncc1), I would like to create a generic scaffold (smarts) for > substructure searches: considered atoms become "any" atom (*), and bonds > becomes "any" bond (~). > I.e., the smarts should be CC*~1~*~*~*~*~*~1 (parts not belonging to the > scaffold don't change). > > Is there a way in Pybel to mutate atom / bond into "*~" apart from string > replacement in the smiles? I anticipate problems with brackets doing so. > Any other idea welcome :) > > Many thanks, > Pascal > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > OpenBabel-discuss mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > |