Hi,
On Fri, Oct 9, 2009 at 7:37 AM, Xiaofeng Liu <[email protected]> wrote:
>
> I have been trying to percieve the chemo features from a Mol object, so I
> guess MolChemicalFeatureFactory is what I supposed to use, right?
exactly.
> I see that
> the method like "MolChemicalFeatureFactory.GetFeatureFamilies" requires a
> mandatory argument of "MolChemicalFeatureFactory instance". But the
> "__self__" method in MolChemicalFeatureFactory forbid to get a instance from
> python. So how should I use "MolChemicalFeatureFactory.GetFeatureFamilies"
> appropriately?
There's a function you need to call to create a
MolChemicalFeatureFactory. Here's some sample code:
#-------------
from rdkit import Chem
from rdkit.Chem import ChemicalFeatures
from rdkit import RDConfig
import os
fdef=os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef')
featFactory = ChemicalFeatures.BuildFeatureFactory(fdef)
m = Chem.MolFromSmiles('OC(=O)-c1ccccc1')
feats = featFactory.GetFeaturesForMol(m)
len(feats)
feats[0].GetFamily()
feats[0].GetType()
#-------------
The fdef file contains the feature definitions. An example file is
provided with the RDKit (the one I use in the example code above) and
there's documentation about the file format in
$RDBASE/Docs/Programs/RDPharm3D/FDefFile.htm
-greg