schrodinger.application.matsci.mlearn.descriptor module¶
Create polymer descriptor and molecule features using rdkit.
Copyright Schrodinger, LLC. All rights reserved.
- exception schrodinger.application.matsci.mlearn.descriptor.FeaturizeError¶
Bases:
RuntimeError
- __init__(*args, **kwargs)¶
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class schrodinger.application.matsci.mlearn.descriptor.Featurize(dataframe, smile_col='smiles', feature_types=('rdkit_descriptor', 'Morgan'), return_float64=False, logger=None)¶
Bases:
object
Create features from the structures
- __init__(dataframe, smile_col='smiles', feature_types=('rdkit_descriptor', 'Morgan'), return_float64=False, logger=None)¶
Initialize FeaturizeStructure class
- Parameters
dataframe (pandas.DataFrame) – pandas dataframe containing structures
smile_col (str) – Name of smiles column.
feature_types (list) – list of features to be calculated for given structures
return_float64 (bool) –
logger (
logging.Logger
) – The logger to log with
- getFeatures()¶
Create features from SMILES pattern of dataset
- Return type
pandas.DataFrame
- Returns
Dataframe containing structure, SMILES and full feature vector
- clearDataFrame()¶
Clear data
- createMols()¶
Create rdkit molecules from SMILES
- createRdkitDescriptors()¶
Create RDKit descriptors for the molecules
- findBondGroups(mol)¶
Find largest size of contiguous rotatable bonds present in the system
- Parameters
mol (
rdkit.Chem.mol
) – rdkit molecule- Return type
int
- Returns
length of largest contiguous rotatable bonds present
- createMatMinerDescriptors()¶
Create Mat-Miner descriptor from the rdkit molecule
- createMorganDescriptors()¶
Create Morgan descriptor from the rdkit molecule
- getMorganCount(mol, morgan_fp_generator)¶
Generate morgan fingerprint for one molecule
- Parameters
mol (
rdkit.Chem.mol
) – rdkit moleculemorgan_fp_generator (class object) – Morgan fingerprint generator object
- Returns
Dictionary with key as fingerprint name and value as fingerprint
- Return type
Dict
- createPolymerDescriptors()¶
Create polymer descriptors in the pandas dataframe.
- exception schrodinger.application.matsci.mlearn.descriptor.PolymerDescriptorError¶
Bases:
RuntimeError
- __init__(*args, **kwargs)¶
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class schrodinger.application.matsci.mlearn.descriptor.PolymerDescriptor(smiles)¶
Bases:
object
Class to create the polymer descriptor
- FLOAT_BASE = 'r_matsci'¶
- DESCRIPTORS = {'r_matsci_Backbone_Atoms_Fraction': 'backboneAtomsFraction', 'r_matsci_Double_Ring_Atoms_Fraction': 'doubleRingAtomsFraction', 'r_matsci_Ring_Atoms_Fraction': 'ringAtomsFraction', 'r_matsci_Rotatable_Bonds_Fraction': 'rotatableBondsFraction', 'r_matsci_Sp3_Atoms_Fraction': 'sp3AtomsFraction', 'r_matsci_Triple_Ring_Atoms_Fraction': 'tripleRingAtomsFraction'}¶
- __init__(smiles)¶
Initialize polymer descriptor class
- Parameters
mol (rdkit.Chem.rdchem.Mol) – rdkit mol object of polymer
- getFeatures()¶
Get descriptor for given polymer
- Return dict
Dictionary with key as name of the descriptor and value as descriptor
- run()¶
Generate polymer descriptors for the structure
- getDoubleAndTripleRingAtoms()¶
Calculate the number of atoms in double and triple fused rings
- ringAtomsFraction()¶
Get the fraction of atoms in rings in the polymer
- Return type
float
- Returns
The fraction of atoms in rings
- doubleRingAtomsFraction()¶
Get the fraction of atoms in double fused ring systems in the polymer
- Return type
float
- Returns
The fraction of atoms in double fused ring systems
- tripleRingAtomsFraction()¶
Get the fraction of atoms in triple fused ring systems in the polymer
- Return type
float
- Returns
The fraction of atoms in triple fused ring systems
- backboneAtomsFraction()¶
Get the fraction of backbone atoms in the polymer
- Return type
float
- Returns
The fraction of backbone atoms
- rotatableBondsFraction()¶
Get the fraction of rotatable bonds in the polymer
- Return type
float
- Returns
The fraction of rotatable bonds
- sp3AtomsFraction()¶
Get the fraction of sp3 atoms in the polymer
- Return type
float
- Returns
The fraction of sp3 atoms bonds
- schrodinger.application.matsci.mlearn.descriptor.create_oligomer(smiles, monomers)¶
Create an oligomer given the monomer SMILES and the number of monomer repetitions. The head and tail of the monomer should be denoted by the atom [At].
- Parameters
smiles (str) – The SMILES string of the monomer
monomers (int) – The number of monomers to repeat
- Return type
Chem.rdchem.Mol
- Returns
The oligomer as
Chem.rdchem.Mol