moleculekit.smallmol.tools.tautomers module

class moleculekit.smallmol.tools.tautomers.Fragment(name, ftype)

Bases: object

The Fragment class store information about the molecule fragment

Parameters
  • name (int - The id of the fragment) –

  • ftype (str - The fragment type (choices: single, aromatic, double)) –

name
Type

int - The id of the fragment

ftype
Type

str - The fragment type (choices: single, aromatic, double)

atoms
Type

list - List of the atom indeces

graphs
Type

list - List of the Fragment.name of the the Fragment object connected with this Fragment

connection

this Fragment (Only double and aromatic.)

Type

list - List of the Fragment.name of the the Fragment object connected with

get_connection()

The function returns the connections :returns: connections – (Only double and aromatic.) :rtype: list - List of the Fragment.name of the the Fragment object connected with this Fragment

class moleculekit.smallmol.tools.tautomers.MolFragmenter(mol)

Bases: object

Parameters

mol (rdkit.Chem.rdchem.Mol - the rdkit molecule object) –

mol
Type

rdkit.Chem.rdchem.Mol - the rdkit molecule object

fragments
Type

list - list of Fragment objects

paths
Type

list - list of list containing fragment objects part of the path

SCORE_dict = {'aromatic': 3, 'double': 1}
compute_paths()

The function inpect and detect all the possible conjugate paths

fragment()

The method creates and stores Fragment objects for each bond in the molecule and based on the atom type

get_conjugate_length(path)

The function returns the length of the conjugate path

Parameters

path (list - List of Fragment objects that are part of the same conjugate path) –

Returns

length

Return type

int - The lenght of the conjugate path

get_depiction_atoms(path)

The function returns all the atom indeces that are part of a conjugate path

Parameters

path (list - List of Fragment objects that are part of the same conjugate path) –

Returns

atoms

Return type

list - List of atoms indeces part of a cpnjugate path

get_fragment(attr, value)

The function returns the Fragment objects based on the attribute and value provided

Parameters
  • attr (Fragment.attributename - the Fragment object attribute (selector)) –

  • value (Fragment.attributevalue - the Fragment object attribute value to match) –

Returns

fragments

Return type

list - The list of Fragment objects matching the parameters provided

get_graphs()

The function inspect for each conjugate Fragment (double aromatic) all the possible pattern that will set as connections

get_longest_path()

The function return the longest path

Returns

highest_path

Return type

list - The list of fragmaent that represents the longest path

get_num_fragments()
Returns: int

Total number of fragments.

search_fragment_by_atom(atom_idx, fragmenttype=None)

The function returns the Fragment objects based on the atomIdx and fragmenttype provided (default: all type)

Parameters
  • atom_idx (int - The atom idx) –

  • fragmenttype (Fragment.ftype value - The fragment type to match) –

Returns

fragment

Return type

list - The list of Fragment objects matching the parameters provided

class moleculekit.smallmol.tools.tautomers.TautomerCanonicalizer(transforms=TautomerTransform('1,3 (thio)keto/enol f', '[CX4!H0]-[C]=[O,S,Se,Te;X1]', [], []), TautomerTransform('1,3 (thio)keto/enol r', '[O,S,Se,Te;X2!H0]-[C]=[C]', [], []), TautomerTransform('1,5 (thio)keto/enol f', '[CX4,NX3;!H0]-[C]=[C][CH0]=[O,S,Se,Te;X1]', [], []), TautomerTransform('1,5 (thio)keto/enol r', '[O,S,Se,Te;X2!H0]-[CH0]=[C]-[C]=[C,N]', [], []), TautomerTransform('aliphatic imine f', '[CX4!H0]-[C]=[NX2]', [], []), TautomerTransform('aliphatic imine r', '[NX3!H0]-[C]=[CX3]', [], []), TautomerTransform('special imine f', '[N!H0]-[C]=[CX3R0]', [], []), TautomerTransform('special imine r', '[CX4!H0]-[c]=[n]', [], []), TautomerTransform('1,3 aromatic heteroatom H shift f', '[#7!H0]-[#6R1]=[O,#7X2]', [], []), TautomerTransform('1,3 aromatic heteroatom H shift r', '[O,#7;!H0]-[#6R1]=[#7X2]', [], []), TautomerTransform('1,3 heteroatom H shift', '[#7,S,O,Se,Te;!H0]-[#7X2,#6,#15]=[#7,#16,#8,Se,Te]', [], []), TautomerTransform('1,5 aromatic heteroatom H shift', '[#7,#16,#8;!H0]-[#6,#7]=[#6]-[#6,#7]=[#7,#16,#8;H0]', [], []), TautomerTransform('1,5 aromatic heteroatom H shift f', '[#7,#16,#8,Se,Te;!H0]-[#6,nX2]=[#6,nX2]-[#6,#7X2]=[#7X2,S,O,Se,Te]', [], []), TautomerTransform('1,5 aromatic heteroatom H shift r', '[#7,S,O,Se,Te;!H0]-[#6,#7X2]=[#6,nX2]-[#6,nX2]=[#7,#16,#8,Se,Te]', [], []), TautomerTransform('1,7 aromatic heteroatom H shift f', '[#7,#8,#16,Se,Te;!H0]-[#6,#7X2]=[#6,#7X2]-[#6,#7X2]=[#6]-[#6,#7X2]=[#7X2,S,O,Se,Te,CX3]', [], []), TautomerTransform('1,7 aromatic heteroatom H shift r', '[#7,S,O,Se,Te,CX4;!H0]-[#6,#7X2]=[#6]-[#6,#7X2]=[#6,#7X2]-[#6,#7X2]=[NX2,S,O,Se,Te]', [], []), TautomerTransform('1,9 aromatic heteroatom H shift f', '[#7,O;!H0]-[#6,#7X2]=[#6,#7X2]-[#6,#7X2]=[#6,#7X2]-[#6,#7X2]=[#6,#7X2]-[#6,#7X2]=[#7,O]', [], []), TautomerTransform('1,11 aromatic heteroatom H shift f', '[#7,O;!H0]-[#6,nX2]=[#6,nX2]-[#6,nX2]=[#6,nX2]-[#6,nX2]=[#6,nX2]-[#6,nX2]=[#6,nX2]-[#6,nX2]=[#7X2,O]', [], []), TautomerTransform('furanone f', '[O,S,N;!H0]-[#6r5]=[#6X3r5;$([#6]([#6r5])=[#6r5])]', [], []), TautomerTransform('furanone r', '[#6r5!H0;$([#6]([#6r5])[#6r5])]-[#6r5]=[O,S,N]', [], []), TautomerTransform('keten/ynol f', '[C!H0]=[C]=[O,S,Se,Te;X1]', [rdkit.Chem.rdchem.BondType.TRIPLE, rdkit.Chem.rdchem.BondType.SINGLE], []), TautomerTransform('keten/ynol r', '[O,S,Se,Te;!H0X2]-[C]#[C]', [rdkit.Chem.rdchem.BondType.DOUBLE, rdkit.Chem.rdchem.BondType.DOUBLE], []), TautomerTransform('ionic nitro/aci-nitro f', '[C!H0]-[N+;$([N][O-])]=[O]', [], []), TautomerTransform('ionic nitro/aci-nitro r', '[O!H0]-[N+;$([N][O-])]=[C]', [], []), TautomerTransform('oxim/nitroso f', '[O!H0]-[N]=[C]', [], []), TautomerTransform('oxim/nitroso r', '[C!H0]-[N]=[O]', [], []), TautomerTransform('oxim/nitroso via phenol f', '[O!H0]-[N]=[C]-[C]=[C]-[C]=[OH0]', [], []), TautomerTransform('oxim/nitroso via phenol r', '[O!H0]-[c]=[c]-[c]=[c]-[N]=[OH0]', [], []), TautomerTransform('cyano/iso-cyanic acid f', '[O!H0]-[C]#[N]', [rdkit.Chem.rdchem.BondType.DOUBLE, rdkit.Chem.rdchem.BondType.DOUBLE], []), TautomerTransform('cyano/iso-cyanic acid r', '[N!H0]=[C]=[O]', [rdkit.Chem.rdchem.BondType.TRIPLE, rdkit.Chem.rdchem.BondType.SINGLE], []), TautomerTransform('isocyanide f', '[C-0!H0]#[N+0]', [rdkit.Chem.rdchem.BondType.TRIPLE], [- 1, 1]), TautomerTransform('isocyanide r', '[N+!H0]#[C-]', [rdkit.Chem.rdchem.BondType.TRIPLE], [- 1, 1]), TautomerTransform('phosphonic acid f', '[OH]-[PH0]', [rdkit.Chem.rdchem.BondType.DOUBLE], []), TautomerTransform('phosphonic acid r', '[PH]=[O]', [rdkit.Chem.rdchem.BondType.SINGLE], []), scores=TautomerScore('benzoquinone', '[#6]1([#6]=[#6][#6]([#6]=[#6]1)=,:[N,S,O])=,:[N,S,O]', 25), TautomerScore('oxim', '[#6]=[N][OH]', 4), TautomerScore('C=O', '[#6]=,:[#8]', 2), TautomerScore('N=O', '[#7]=,:[#8]', 2), TautomerScore('P=O', '[#15]=,:[#8]', 2), TautomerScore('C=hetero', '[#6]=[!#1;!#6]', 1), TautomerScore('methyl', '[CX4H3]', 1), TautomerScore('guanidine terminal=N', '[#7][#6](=[NR0])[#7H0]', 1), TautomerScore('guanidine endocyclic=N', '[#7;R][#6;R]([N])=[#7;R]', 2), TautomerScore('aci-nitro', '[#6]=[N+]([O-])[OH]', - 4), max_tautomers=1000)

Bases: object

The molvs class refactores

__call__(mol)

Calling a TautomerCanonicalizer instance like a function is the same as calling its canonicalize(mol) method.

canonicalize(mol)

Return a canonical tautomer by enumerating and scoring all possible tautomers.

Parameters

mol (Mol) – The input molecule

Returns

tau – The canonical tautomer.

Return type

Mol

compute_score(mol, returndetails=False, log=False)

Return a canonical tautomer by enumerating and scoring all possible tautomers.

Parameters

mol (Mol) – The input molecule

Returns

  • tau (list Mol) – The canonical tautomers

  • t_score (list) – The tautomer scores

depict_tautomers(tautomers, scores, atoms, details=None)
static filter_tautomers(tautomers, scores, threshold=2)

The function returns the tautomers as rdkit molecule objects based on the scores and the threshold

Parameters
  • tautomers (list - List of rdkit.Chem.Molecule of the tautomers identified) –

  • scores (list - List of the scores for each tatutomer) –

  • threshold (int - The threshold value to be used as difference from the highest one) –

Returns

t_filtered

Return type

list - List of rdkit.Chem.Molecule of the tautomers filtered

get_conjugate(tautomer)

The functions called the MolFragmeter and returns the conjugate length and the atoms member of the path

Parameters

tautomer (rdkit.Chem.Molecule - A tautomer object) –

Returns

  • n_conj (int - the lenght of the conjugate path)

  • atoms (list - The list of the atoms part of the path)