moleculekit.smallmol.util module#

moleculekit.smallmol.util.convertToString(arr)#
moleculekit.smallmol.util.depictMultipleMols(mols_list, filename=None, ipython=False, legends=None, highlightAtoms=None, mols_perrow=3)#

Returns the image or the ipython rendering.

Parameters:
  • mols_list (list) – The list of the rdkit molecules to depict

  • filename (str) – The filename of the image

  • ipython (bool) – If True, the SVG rendering for jupiter-nootebook are returned

  • legends (list) – List of titles subfigure for each molecule

  • highlightAtoms (list) – List of list of atom index to highlight.

  • mols_perrow (int) – The number of subfigures per row

Returns:

svg – If ipython set as True, the SVG rendering is returned

Return type:

SVG

moleculekit.smallmol.util.getChemblLigandByDrugName(drugname, returnSmile=False)#

Returns a SmallMol object of a ligand by its drug name. This molecule is retrieve from Chembl. It is possible to return also the smile of the ligand.

Parameters:
  • drugname (str) – The drug name

  • returnSmile (bool) – If True, the smile is returned

Returns:

  • sm (moleculekit.smallmol.smallmol.SmallMol) – The SmallMol object

  • smile (str) – The smile

Example

>>> sm = getChemblLigandByDrugName('paracetamol')  
>>> sm.numAtoms  
20
>>> sm, smile = getChemblLigandByDrugName('paracetamol', returnSmile=True)  
>>> smile  
'CC(=O)Nc1ccc(O)cc1'
moleculekit.smallmol.util.getChemblSimilarLigandsBySmile(smi, threshold=85, returnSmiles=False)#

Returns a SmallMolLib object of the ligands having a similarity with a smile of at least the specified threshold.. This molecules are retrieve from Chembl. It is possible to return also the list smiles.

Parameters:
  • smi (str) – The smile

  • threshold (int) – The threshold value to apply for the similarity search

  • returnSmiles (bool) – If True, the list smiles is returned

Returns:

  • sm (moleculekit.smallmol.smallmol.SmallMol) – The SmallMol object

  • smiles (str) – The list of smiles

Example

>>> _, smile = getChemblLigandByDrugName('ibuprofen', returnSmile=True)  
>>> lib = getChemblSimilarLigandsBySmile(smile)  
>>> lib.numMols  
4
>>> lib, smiles = getChemblSimilarLigandsBySmile(smile, returnSmiles=True)  
>>> len(smiles)  
4
moleculekit.smallmol.util.getRCSBLigandByLigname(ligname, returnMol2=False)#

Returns a SmallMol object of a ligand by its three letter lignane. This molecule is retrieve from RCSB and a mol2 written. It is possible to return also the mol2 filename.

Parameters:
  • ligname (str) – The three letter ligand name

  • returnMol2 (bool) – If True, the mol2 filename is returned

Returns:

  • sm (moleculekit.smallmol.smallmol.SmallMol) – The SmallMol object

  • mol2filename (str) – The mol2 filename

Example

>>> from moleculekit.molecule import Molecule
>>> mol = Molecule('4eiy')
>>> np.unique(mol.get('resname', 'not protein and not water'))
array(['CLR', 'NA', 'OLA', 'OLB', 'OLC', 'PEG', 'ZMA'], dtype=object)
>>> sm = getRCSBLigandByLigname('ZMA')  
SmallMol module...
>>> sm.numAtoms
40
>>> sm, mol2filename = getRCSBLigandByLigname('ZMA', returnMol2=True)
>>> mol2filename  
'/tmp/tmp....mol2'