graphinvent/MolecularGraph.py
def atom_features(self, atom : rdkit.Chem.Atom) -> np.ndarray:
        """
        Generates the feature vector for a given node on a molecular graph. Uses
        the following descriptors to recreate the molecular graph: atom type,
        formal charge, and, if specified, number of implicit Hs and chirality.
        The first two descriptors are the bare minimum needed.

        Args:
        ----
            atom (rdkit.Chem.Atom) : Atom in molecule for which to get feature
                                     vector.

        Returns:
        -------
            feature_vector (numpy.ndarray) : Corresponding feature vector.
        """
        feature_vector_generator = itertools.chain(
            util.one_of_k_encoding(atom.GetSymbol(), self.constants.atom_types),
            util.one_of_k_encoding(atom.GetFormalCharge(),
                                   self.constants.formal_charge)
        )
        if not self.constants.use_explicit_H and not self.constants.ignore_H:
            feature_vector_generator = itertools.chain(
                feature_vector_generator,
                util.one_of_k_encoding(atom.GetTotalNumHs(),
                                       self.constants.imp_H)
            )
        if self.constants.use_chirality:
            try:
                chiral_state = atom.GetProp("_CIPCode")
            except KeyError:
                chiral_state = self.constants.chirality[0]  # "None"

            feature_vector_generator = itertools.chain(
                feature_vector_generator,
                util.one_of_k_encoding(chiral_state, self.constants.chirality)
            )

        feature_vector = np.fromiter(feature_vector_generator, int)

        return feature_vector

        Generates the feature vector for a given node on a molecular graph. Uses
        the following descriptors to recreate the molecular graph: atom type,
        formal charge, and, if specified, number of implicit Hs and chirality.
        The first two descriptors are the bare minimum needed.

        Args:
        ----
            atom (rdkit.Chem.Atom) : Atom in molecule for which to get feature
                                     vector.

        Returns:
        -------
            feature_vector (numpy.ndarray) : Corresponding feature vector.
        
Generates the feature vector for a given node on a molecular graph. Uses
the following descriptors to recreate the molecular graph: atom type,
formal charge, and, if specified, number of implicit Hs and chirality.
The first two descriptors are the bare minimum needed.
Generates the feature vector for a given node on a molecular graph . Uses the following descriptors to recreate the molecular graph : atom type formal charge and if specified number of implicit Hs and chirality . The first two descriptors are the bare minimum needed .
def atom_features(self, atom : rdkit.Chem.Atom) -> np.ndarray:
        feature_vector_generator = itertools.chain(
            util.one_of_k_encoding(atom.GetSymbol(), self.constants.atom_types),
            util.one_of_k_encoding(atom.GetFormalCharge(),
                                   self.constants.formal_charge)
        )
        if not self.constants.use_explicit_H and not self.constants.ignore_H:
            feature_vector_generator = itertools.chain(
                feature_vector_generator,
                util.one_of_k_encoding(atom.GetTotalNumHs(),
                                       self.constants.imp_H)
            )
        if self.constants.use_chirality:
            try:
                chiral_state = atom.GetProp("_CIPCode")
            except KeyError:
                chiral_state = self.constants.chirality[0]  
            feature_vector_generator = itertools.chain(
                feature_vector_generator,
                util.one_of_k_encoding(chiral_state, self.constants.chirality)
            )
        feature_vector = np.fromiter(feature_vector_generator, int)
        return feature_vector
def atom_features ( self , atom : rdkit . Chem . Atom ) -> np . ndarray : feature_vector_generator = itertools . chain ( util . one_of_k_encoding ( atom . GetSymbol ( ) , self . constants . atom_types ) , util . one_of_k_encoding ( atom . GetFormalCharge ( ) , self . constants . formal_charge ) ) if not self . constants . use_explicit_H and not self . constants . ignore_H : feature_vector_generator = itertools . chain ( feature_vector_generator , util . one_of_k_encoding ( atom . GetTotalNumHs ( ) , self . constants . imp_H ) ) if self . constants . use_chirality : try : chiral_state = atom . GetProp ( "_CIPCode" ) except KeyError : chiral_state = self . constants . chirality [ 0 ] feature_vector_generator = itertools . chain ( feature_vector_generator , util . one_of_k_encoding ( chiral_state , self . constants . chirality ) ) feature_vector = np . fromiter ( feature_vector_generator , int ) return feature_vector
Generates the feature vector for a given node on a molecular graph.
Generates the feature vector for a given node on a molecular graph .
"""
        Generates the feature vector for a given node on a molecular graph. Uses
        the following descriptors to recreate the molecular graph: atom type,
        formal charge, and, if specified, number of implicit Hs and chirality.
        The first two descriptors are the bare minimum needed.

        Args:
        ----
            atom (rdkit.Chem.Atom) : Atom in molecule for which to get feature
                                     vector.

        Returns:
        -------
            feature_vector (numpy.ndarray) : Corresponding feature vector.
        """ # "None"
feature_vector (numpy.ndarray) : Corresponding feature vector.
feature_vector ( numpy . ndarray ) : Corresponding feature vector .
self
atom
rdkit.Chem.Atom
Atom in molecule for which to get feature
vector.
Atom in molecule for which to get feature vector .