Hi Paul,
When I look at your definition below and the one that worked there is a slight
difference.
In fps_calc you are passing a molecule and then you try to iterate over it (in
>> fps = [GetMorganFingerprint(x,3) for x in m] ). Whereas in
generateconformations(m) you also pass a single molecule but then just work on
this single molecule - so you don't try to iterate over a molecule.
I don't know anything about the multiprocessing module - but given at your code
I would assume that you try to split a list of molecules into multiple
processes and then passing one field of the list to each call of the function
... so your code should (in my opinion) look like
from multiprocessing import Pool
p4 = Pool(processes=4)
def fps_calc(m):
return GetMorganFingerprint(m,3)
fps = p4.map(fps_calc,ms)
As said - this is just by looking at your examples - and not kowing anything
about mulyiprocessing. Sorry that I cannot test more but I have to run to a
meeting :-(
Nik
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, October 11, 2011 1:55 PM
To: RDKit Discuss
Subject: [Rdkit-discuss] multiprocessing & rdkit
Dear RDkitters,
I'm trying to use Python's multiprocessing module in conjunction with
RDKit.
It should be applied in 2 cases:
(1) fingerprint calculation
&
(2) Picking Diverse Molecules
(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"
(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, ???)
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)
"
In the second case, I'm not sure how to properly pass the variables.
Cheers & Thanks,
Paul
This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure. If you are not the intended recipient,
you must not copy this message or attachment or disclose the contents to
any other person. If you have received this transmission in error, please
notify the sender immediately and delete the message and any attachment
from your system. Merck KGaA, Darmstadt, Germany and any of its
subsidiaries do not accept liability for any omissions or errors in this
message which may arise as a result of E-Mail-transmission or for damages
resulting from any unauthorized changes of the content of this message and
any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
subsidiaries do not guarantee that this message is free of viruses and does
not accept liability for any damages caused by any virus transmitted
therewith.
Click http://disclaimer.merck.de to access the German, French, Spanish and
Portuguese versions of this disclaimer.
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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