On 11 October 2011 12:55, <[email protected]> wrote:
>
>
> (1)
> "
> from multiprocessing import Pool
> p4 = Pool(processes=4)
> def fps_calc(m):
> fps = [GetMorganFingerprint(x,3) for x in m]
> return fps
> fps = p4.map(fps_calc,ms)
> "
> ==>
> "TypeError: 'Mol' object is not iterable"
>
The object "m" is a single molecule and not an iterable (array, set etc).
I guess you snipped an important bit of code (what type is ms?)
> (2)
> "
> from multiprocessing import Pool
> p4 = Pool(processes=4)
> def distij(i,j,fps=fps):
> return 1-DataStructs.DiceSimilarity(fps[i],fps[j])
>
> def DivSelection(distij,nfps,quantity_train):
> picker = MaxMinPicker()
> picked_indices = picker.LazyPick(distij,nfps,quantity_train)
> return picked_indices
> "
> pickIndices = p4.map(DivSelection, ???)
>
I imagine, even if I haven't used the multiprocessing module, that you
would need to pass the list of parameters (tuples maybe?) to feed into
the multiple DivSelection calls.
>
> In the first case, I do not get the point what is going wrong. With the
> following conformer generation snippet, multiprocessing works perfect:
> "
> from multiprocessing import Pool
> def generateconformations(m):
> m = Chem.AddHs(m)
> ids=AllChem.EmbedMultipleConfs(m,numConfs=10)
> for id in ids:
> AllChem.UFFOptimizeMolecule(m,confId=id)
> return m
> p4 = Pool(processes=4)
> ms = [x for x in Chem.SDMolSupplier('blockbusters.sdf')]
> cms4=p4.map(generateconformations,ms)
> "
>
It works because ms is an array here ....
I hope this puts you on the right track... I am just filling in till
Greg gives an incredible one liner which will solve all your problems.
JP
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss