Mol Toolkits¶
chemper
wraps around existing cheminformatics packages
to extract information about atoms and bonds stored in molecules.
These are accessed through chemper.mol_toolks.mol_toolkit which
accesses the source code for only the installed cheminformatics package.
Right now we support OpenEye Toolkits
These and any future packge support follow the template laid out as adapters.
adapters.py
This script contains adapters or the structure for molecules, atoms, and bonds. Our chemical perception code is designed to be independent of the users cheminformatics packages. For each cheminformatics package we support we will provide classes following the structure in these adapters.
- class chemper.mol_toolkits.adapters.AtomAdapter[source]¶
This is a ChemPer wrapper for an atom from one of the cheminformatics toolkits. ChemPer Atoms are initiated from the reference package object. Currently we support OpenEye and RDKit toolkits.
- atom¶
- Type
Atom from reference toolkit
- abstract atomic_number()[source]¶
- Returns
atomic_number – atomic number for the atom
- Return type
int
- abstract connectivity()[source]¶
- Returns
connectivity – connectivity or total number of bonds (regardless of order) around the atom
- Return type
int
- abstract degree()[source]¶
- Returns
degree – degree or number of explicit bond orders around the atom
- Return type
int
- abstract get_bonds()[source]¶
- Returns
bonds – Bonds connected to this atom
- Return type
list[ChemPer Bonds]
- abstract get_molecule()[source]¶
Extracts the parent molecule this atom is from.
- Returns
mol – Molecule this atom is stored in
- Return type
ChemPer Mol
- abstract get_neighbors()[source]¶
- Returns
neighbors – Atoms that are one bond away from this atom
- Return type
list[ChemPer Atoms]
- abstract hydrogen_count()[source]¶
- Returns
H_count – total number of hydrogen atoms connected to this Atom
- Return type
int
- abstract is_aromatic()[source]¶
- Returns
is_aromatic – True if the atom is aromatic otherwise False
- Return type
boolean
- abstract is_connected_to(atom2)[source]¶
- Parameters
atom2 (ChemPer Atom) – Atom to check if it is bonded to this atom
- Returns
connected – True if atom2 is a bonded to atom1
- Return type
boolean
- abstract min_ring_size()[source]¶
- Returns
min_ring_size – size of the smallest ring this atom is a part of
- Return type
int
- class chemper.mol_toolkits.adapters.BondAdapter[source]¶
This is a ChemPer wrapper for a bond from one of the cheminformatics toolkits. ChemPer Bonds are initiated from the reference package object. Currently we support OpenEye and RDKit toolkits.
- bond¶
- Type
Bond from reference class
- abstract get_atoms()[source]¶
- Returns
atoms – The two atoms connected by this bond
- Return type
list[ChemPer Atoms]
- abstract get_index()[source]¶
- Returns
index – index of this bond in its parent molecule
- Return type
int
- abstract get_molecule()[source]¶
Extracts the parent molecule this bond is from
- Returns
mol – Molecule this bond is stored in
- Return type
ChemPer Mol
- abstract get_order()[source]¶
- Returns
order – This is the absolute order, returns 1.5 if bond is aromatic
- Return type
int or float
- abstract is_aromatic()[source]¶
- Returns
is_aromatic – True if it is an aromatic bond
- Return type
boolean
- class chemper.mol_toolkits.adapters.MolAdapter[source]¶
This is a ChemPer wrapper for a molecule from one of the cheminformatics toolkits. ChemPer molecules are initiated from the reference package molecule object. Currently we support OpenEye and RDKit toolkits.
- mol¶
Mol object from the reference cheminformatics toolkit
- Type
toolkit Mol
- abstract classmethod from_smiles(smiles)[source]¶
Creates a ChemPer Mol form a SMILES string
- Parameters
smiles (str) – SMILES used to create molecule with wrapped toolkit
- Returns
Mol
- Return type
ChemPer Mol
- abstract get_atom_by_index(idx)[source]¶
- Parameters
idx (int) – atom index
- Returns
atom – atom with index idx
- Return type
ChemPer Atom
- abstract get_atoms()[source]¶
- Returns
atom_list – list of all atoms in the molecule
- Return type
list[ChemPer Atoms]
- abstract get_bond_by_atoms(atom1, atom2)[source]¶
Finds a bond between two atoms
- Parameters
atom1 (ChemPer Atom) –
atom2 (ChemPer Atom) –
- Returns
bond – If atoms are connected returns bond otherwise None
- Return type
ChemPer Bond or None
- abstract get_bond_by_index(idx)[source]¶
- Parameters
idx (int) – bond index
- Returns
bond – bond with index idx
- Return type
ChemPer Bond
- abstract get_bonds()[source]¶
- Returns
bond_list – list of all bonds in the molecule
- Return type
list[ChemPer Bonds]
- abstract set_aromaticity_mdl()[source]¶
Sets the aromaticity flags in this molecule to use the MDL model
- abstract smirks_search(smirks)[source]¶
Performs a substructure search on the molecule with the provided SMIRKS pattern. Note - this function expects SMIRKS patterns with indexed atoms that is with :n for at least some atoms.
- Parameters
smirks (str) – SMIRKS pattern with indexed atoms (:n)
- Returns
matches – match dictionaries have the form {smirks index: atom index}
- Return type
list[match dictionary]