moleculekit.smallmol.util module#
- moleculekit.smallmol.util.convertToString(arr)#
- moleculekit.smallmol.util.depictMultipleMols(mols_list: list, filename: str | None = None, ipython: bool = False, legends: list | None = None, highlightAtoms: list | None = None, mols_perrow: int = 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 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 – An SVG rendering object if
ipythonis True, otherwise None- Return type:
IPython.display.SVG or None
- moleculekit.smallmol.util.getChemblLigandByDrugName(drugname: str, returnSmile: bool = 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: str, threshold: int = 85, returnSmiles: bool = 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: str, returnMol2: bool = 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 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'