Miscellaneous Utilities
- count_fragments(mol)[source]
Count the number of fragments in a molecule
- Parameters:
mol (
Mol) – RDKit molecule- Return type:
- Returns:
number of fragments
- get_largest_fragment(mol)[source]
Return the fragment with the largest number of atoms
- Parameters:
mol (
Mol) – RDKit molecule- Return type:
Mol- Returns:
RDKit molecule with the largest number of atoms
- taylor_butina_clustering(fp_list, cutoff=0.65)[source]
Cluster a set of fingerprints using the RDKit Taylor-Butina implementation
- demo_block_logs()[source]
An example of another way to turn off RDKit logging
- Return type:
- Returns:
None
- boxplot_base64_image(dist, x_lim=[0, 10])[source]
Plot a distribution as a seaborn boxplot and save the resulting image as a base64 image.
- mol_to_base64_image(mol, target='html', pattern_mol=None, width=300, height=150)[source]
Convert an RDKit molecule to a base64 encoded image string, optionally highlighting atoms matching a SMARTS pattern.
- Parameters:
- Return type:
- Returns:
Base64 encoded image string.
- smi_to_base64_image(smiles, target='html', width=300, height=150)[source]
Convert a SMILES string to a base64 encoded image string.
- remove_dummy_atoms(mol)[source]
Remove dummy atoms (atomic number 0) from an RDKit molecule.
- Parameters:
mol (rdkit.Chem.Mol) – RDKit molecule from which to remove dummy atoms.
- Returns:
RDKit molecule with dummy atoms removed.
- Return type:
rdkit.Chem.Mol
- align_mols_to_template(template_smiles, smiles_list)[source]
Aligns a list of molecules to a template molecule defined by its SMILES string.
Removes dummy atoms (atomic number 0) from the template, generates 2D coordinates, and aligns each molecule in the input list to the template structure.
- Parameters:
template_smiles – SMILES string of the template molecule.
smiles_list – List of SMILES strings to align.
- Returns:
List of aligned RDKit molecule objects.