Dear Greg and rdkit-discuss members.

Thank you for your kindness.
Your messages are very helpful for me.
Thanks.

Taka


2012/7/22 Greg Landrum <greg.land...@gmail.com>:
> Dear Taka,
>
> On Sun, Jul 22, 2012 at 12:20 AM, Taka Seri <serit...@gmail.com> wrote:
>>
>> And I have one question.
>> Can I get selected pharmacophore feature positions from AtomIds?
>> Or how can I get selected pharmacophore features from AtomIds?
>> From feature object, it is easy to do that by useing "feature.GetPos()" 
>> method.
>> I want to do same thing by using AtomIds.
>
> There's not really a direct way to find the features that an atom is
> involved in, but you can find the atoms that make up a feature using
> the method MolChemicalFeature.GetAtomIds(). Given that you can do the
> following:
> def GetFeatsPerAtom(feats):
>   """  Returns a dictionary keyed by atom id, with lists of features as
>    the values
>
>   """
>   res = {}
>   for feat in feats:
>     for atomId in feat.GetAtomIds():
>       if res.has_key(atomId):
>         res[atomId].append(feat)
>       else:
>         res[atomId] = [feat]
>   return res
> (this code, which could really be improved using a python defaultdict,
> is taken from: 
> http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Python/qtGui/Search3D/SearchUtils.py?revision=2&view=markup&pathrev=2
> )
>
> To get the position of the Atoms themselves, you need to use the
> owning molecule's Conformer. something like this:
> In [6]: conf = atom.GetOwningMol().GetConformer()
>
> In [7]: conf.GetAtomPosition(atom.GetIdx())
> Out[7]: <rdkit.Geometry.rdGeometry.Point3D at 0x1045ebe20>
>
> I hope this helps,
> -greg
>
>
> -greg

------------------------------------------------------------------------------
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/
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to