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 <pascal.jm.mul...@gmail.com> 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 > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss