dgllife.utils.AttentiveFPAtomFeaturizer¶
-
class
dgllife.utils.
AttentiveFPAtomFeaturizer
(atom_data_field='h')[source]¶ The atom featurizer used in AttentiveFP
AttentiveFP is introduced in Pushing the Boundaries of Molecular Representation for Drug Discovery with the Graph Attention Mechanism.
The atom features include:
One hot encoding of the atom type. The supported atom types include
B
,C
,N
,O
,F
,Si
,P
,S
,Cl
,As
,Se
,Br
,Te
,I
,At
, andother
.One hot encoding of the atom degree. The supported possibilities include
0 - 5
.Formal charge of the atom.
Number of radical electrons of the atom.
One hot encoding of the atom hybridization. The supported possibilities include
SP
,SP2
,SP3
,SP3D
,SP3D2
, andother
.Whether the atom is aromatic.
One hot encoding of the number of total Hs on the atom. The supported possibilities include
0 - 4
.Whether the atom is chiral center
One hot encoding of the atom chirality type. The supported possibilities include
R
, andS
.
We assume the resulting DGLGraph will not contain any virtual nodes.
- Parameters
atom_data_field (str) – Name for storing atom features in DGLGraphs, default to ‘h’.
Examples
>>> from rdkit import Chem >>> from dgllife.utils import AttentiveFPAtomFeaturizer
>>> mol = Chem.MolFromSmiles('CCO') >>> atom_featurizer = AttentiveFPAtomFeaturizer(atom_data_field='feat') >>> atom_featurizer(mol) {'feat': tensor([[0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0.], [0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.], [0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.]])}
>>> # Get feature size for nodes >>> print(atom_featurizer.feat_size('feat')) 39
See also
BaseAtomFeaturizer
,CanonicalAtomFeaturizer
,WeaveAtomFeaturizer
,PretrainAtomFeaturizer
,PAGTNAtomFeaturizer
-
__init__
(atom_data_field='h')[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([atom_data_field])Initialize self.
feat_size
([feat_name])Get the feature size for
feat_name
.