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)#
Depicts multiple molecules in a single grid image.
Optionally saves the image to a file and/or returns an SVG rendering for Jupyter notebooks.
- Parameters:
mols_list (
list) – The list of the rdkit molecules to depictipython (
bool) – If True, the SVG rendering for jupiter-nootebook are returnedlegends (
list|None) – List of titles subfigure for each moleculehighlightAtoms (
list|None) – List of list of atom index to highlight.mols_perrow (
int) – The number of subfigures per row
- Returns:
svg – An SVG rendering object if
ipythonis True, otherwise None- Return type:
IPython.display.SVGorNone
- 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:
- Returns:
sm – The SmallMol object for the matched drug, or None if no drug matched the name. If
returnSmileis True, a tuple(sm, smile)is returned instead, wheresmileis the canonical SMILES string of the ligand.- Return type:
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:
- Returns:
lib – A SmallMolLib containing the similar ligands. If
returnSmilesis True, a tuple(lib, smiles)is returned instead, wheresmilesis the list of SMILES strings of the ligands.- Return type:
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:
- Returns:
sm (
moleculekit.smallmol.smallmol.SmallMol) – The SmallMol objectmol2filename (
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'