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[source]

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)[source]

Bases: object

Create features from the structures

__init__(dataframe, smile_col='smiles', feature_types=('rdkit_descriptor', 'Morgan'), return_float64=False, logger=None)[source]

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()[source]

Create features from SMILES pattern of dataset

Return type

pandas.DataFrame

Returns

Dataframe containing structure, SMILES and full feature vector

clearDataFrame()[source]

Clear data

createMols()[source]

Create rdkit molecules from SMILES

createRdkitDescriptors()[source]

Create RDKit descriptors for the molecules

findBondGroups(mol)[source]

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()[source]

Create Mat-Miner descriptor from the rdkit molecule

createMorganDescriptors()[source]

Create Morgan descriptor from the rdkit molecule

getMorganCount(mol, morgan_fp_generator)[source]

Generate morgan fingerprint for one molecule

Parameters
  • mol (rdkit.Chem.mol) – rdkit molecule

  • morgan_fp_generator (class object) – Morgan fingerprint generator object

Returns

Dictionary with key as fingerprint name and value as fingerprint

Return type

Dict

createPolymerDescriptors()[source]

Create polymer descriptors in the pandas dataframe.

exception schrodinger.application.matsci.mlearn.descriptor.PolymerDescriptorError[source]

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)[source]

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)[source]

Initialize polymer descriptor class

Parameters

mol (rdkit.Chem.rdchem.Mol) – rdkit mol object of polymer

getFeatures()[source]

Get descriptor for given polymer

Return dict

Dictionary with key as name of the descriptor and value as descriptor

run()[source]

Generate polymer descriptors for the structure

getDoubleAndTripleRingAtoms()[source]

Calculate the number of atoms in double and triple fused rings

ringAtomsFraction()[source]

Get the fraction of atoms in rings in the polymer

Return type

float

Returns

The fraction of atoms in rings

doubleRingAtomsFraction()[source]

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()[source]

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()[source]

Get the fraction of backbone atoms in the polymer

Return type

float

Returns

The fraction of backbone atoms

rotatableBondsFraction()[source]

Get the fraction of rotatable bonds in the polymer

Return type

float

Returns

The fraction of rotatable bonds

sp3AtomsFraction()[source]

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)[source]

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