问题
I am using Deepchem to create features for the my GraphConvolution model as follows.
import deepchem as dc
from rdkit import Chem
import numpy as np
import pandas as pd
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
smile = 'O=C(C1=CC=C(C=C1)C(O)=O)O'
molecules = []
molecules.append(Chem.MolFromSmiles(smile))
featurizer = dc.feat.graph_features.ConvMolFeaturizer()
mol_object = featurizer.featurize(mols=molecules)
Now I want to know the output mol_object
. I know that dc.feat.graph_features.ConvMolFeaturizer()
returns an array object. But it actually does to the input.
So the featurizer.featurize(mols=molecules)
takes molecules
as input.
The molecules[0]
will print the following graph.
As molecules
is a list which contains only one element at index 0 which is molecules[0]
. That means that mols
in dc.feat.graph_features.ConvMolFeaturizer()
takes this image as input and outputs mol_object
.
What is this mol_object
output and how can I see it? Is shows that it is an array but I can not see the content of this array?
print(np.shape(mol_object))
(1,)
print(type(mol_object))
<class 'numpy.ndarray'>
print(mol_object)
[<deepchem.feat.mol_graphs.ConvMol object at 0x7f96a68c6e48>]
How do I inspect or see [<deepchem.feat.mol_graphs.ConvMol object at 0x7f96a68c6e48>]
?
回答1:
Why not look at the source code for the ConvMol object?
The output of the featurizer returns an array of ConvMol objects (one for each rdkit molecule input) i.e. deepchem.feat.mol_graphs.ConvMol, what you actually want to inspect is the first element of the array, mol_object[0].
Looking at the source code you can then understand what information about the molecule is contained such as the atom features which can be accessed ConvMol.atom_features, or in your case mol_object[0].atom_features
来源:https://stackoverflow.com/questions/58280528/output-of-graph-convolution-in-deepchem