Hi Greg,
Thanks or the answer,
There is a small example that replaces terminal hydrogens with methyl
groups.
-----------------------
def mutatemol(mol, outputsdf):
outf=open(outputsdf, 'w+')
writer = Chem.SDWriter(outf)
patterns = ('[C,c;!H0]','[N;!H0]')
replacements = ('[#6](C)','[N](C)')
if (mol.HasProp('_Name')):
mName = mol.GetProp('_Name')
else:
mName = 'StructX'
for i in range(0, len(patterns)):
pat = Chem.MolFromSmarts(patterns[i])
repl = Chem.MolFromSmarts(replacements[i])
mutmol =
AllChem.ReplaceSubstructs(mol,pat,repl)
for j in range(0, len(mutmol)):
mname
='%s_%d_%d'%(mName,i,j)
mutmol[j].SetProp('_Name',
mname)
AllChem.SanitizeMol(mutmol[j])
AllChem.Compute2DCoords(mutmol[j])
writer.write(mutmol[j])
writer.flush()
outf.close()
-------------------------------------------
I would like to replace the second "for" loop with a function that puts
structures from mutmol in a temporary container of sorts. Is this possible?
Its not critical but it I think it would give me more flexibility in how to
manipulate the output.
Regards
Basil
From: Greg Landrum [mailto:[email protected]]
Sent: 07 November 2013 02:57
To: [email protected]
Cc: RDKit Discuss
Subject: Re: [Rdkit-discuss] ReplaceSubstructs Output
Hi Basil
On Tue, Nov 5, 2013 at 1:31 PM, Basil Hartzoulakis <[email protected]>
wrote:
Hello,
I am building a tool with multiple calls of the ReplaceSustructs on the same
structure.
Is there any easy way to place the output of each call in a pickle or some
temporary holder?
At the moment I have to iterate through each output and the code looks a bit
awkward.
I'm not quite sure what you mean. Can you provide a short code snippet that
shows the repeated calls?
-greg
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss