Toolkits#
app.modules.toolkits.rdkit_wrapper module#
- app.modules.toolkits.rdkit_wrapper.check_RO5_violations(molecule)[source]#
Check the molecule for violations of Lipinski’s Rule of Five.
- Return type:
int
- Args:
molecule (Chem.Mol): RDKit molecule object.
- Returns:
int: Number of Lipinski Rule violations.
- app.modules.toolkits.rdkit_wrapper.get_2d_mol(molecule)[source]#
Generate a 2D Mol block representation from a given SMILES string.
- Return type:
str
- Args:
molecule (Chem.Mol): RDKit molecule object.
- Returns:
str: 2D Mol block representation. If an error occurs during SMILES parsing, an error message is returned.
- app.modules.toolkits.rdkit_wrapper.get_3d_conformers(molecule, depict=True)[source]#
Convert a SMILES string to an RDKit Mol object with 3D coordinates.
- Return type:
Mol
- Args:
molecule (Chem.Mol): RDKit molecule object. depict (bool, optional): If True, returns the molecule’s 3D structure in MolBlock format.
If False, returns the 3D molecule without hydrogen atoms.
- Returns:
- str or rdkit.Chem.rdchem.Mol: If depict is True, returns the 3D structure in MolBlock format.
Otherwise, returns an RDKit Mol object.
- app.modules.toolkits.rdkit_wrapper.get_properties(sdf_file)[source]#
Extracts properties from a single molecule contained in an SDF file.
This function uses the RDKit library to read an SDF (Structure-Data File) and extract properties from the first molecule in the file. It checks if the supplied SDF file contains a valid molecule and retrieves its properties as a dictionary.
- Return type:
dict
- Args:
sdf_file (str): The path to the SDF file containing the molecule.
- Returns:
Dict or None: A dictionary containing the properties of the molecule. If the SDF file contains a valid molecule, the dictionary will have property names as keys and property values as values. If no valid molecule is found, or if there are no properties associated with the molecule, None is returned.
- Raises:
ValueError: If the SDF file is not found or cannot be read.
- app.modules.toolkits.rdkit_wrapper.get_rdkit_CXSMILES(molecule)[source]#
Generate CXSMILES representation with coordinates from a given SMILES string.
- Return type:
str
- Args:
molecule (Chem.Mol): RDKit molecule object.
- Returns:
str: CXSMILES representation with coordinates. If an error occurs during SMILES parsing, an error message is returned.
- async app.modules.toolkits.rdkit_wrapper.get_rdkit_HOSE_codes(molecule, noOfSpheres)[source]#
Calculate and retrieve RDKit HOSE codes for a given SMILES string. This function takes a SMILES string as input and returns the calculated HOSE codes.
- Return type:
List[str]
- Args:
molecule (Chem.Mol): RDKit molecule object. no_of_spheres (int): Number of spheres for which to generate HOSE codes.
- Returns:
List[str]: List of HOSE codes generated for each atom.
- Raises:
ValueError: If the input SMILES string is empty or contains whitespace.
- app.modules.toolkits.rdkit_wrapper.get_rdkit_descriptors(molecule)[source]#
Calculate a selected set of molecular descriptors for the input SMILES string.
- Return type:
Union[tuple,str]
- Args:
molecule (Chem.Mol): RDKit molecule object.
- Returns:
- dict: Dictionary of calculated molecular descriptors.
If an error occurs during SMILES parsing, an error message is returned.
- app.modules.toolkits.rdkit_wrapper.get_tanimoto_similarity_rdkit(mol1, mol2)[source]#
Calculate the Tanimoto similarity index between two SMILES strings using Morgan Fingerprints.
- Return type:
Union[float,str]
- Args:
mol1 (Chem.Mol): First molecule object. mol2 (Chem.Mol): Second molecule object.
- Returns:
float or str: Tanimoto similarity index if molecules are valid.
- app.modules.toolkits.rdkit_wrapper.has_stereochemistry(molecule)[source]#
Check if the given SMILES string contains stereochemistry information.
- Return type:
bool
- Args:
molecule (Chem.Mol): RDKit molecule object.
- Returns:
bool: True if the SMILES contains stereochemistry information, False otherwise.
- app.modules.toolkits.rdkit_wrapper.is_valid_molecule(input_text)[source]#
Check whether the input text represents a valid molecule in SMILES or Molblock format.
- Return type:
Union[str,bool]
- Args:
input_text (str): SMILES string or Molblock.
- Returns:
str: “smiles” if the input is a valid SMILES, “mol” if the input is a valid Molblock, otherwise False.
app.modules.toolkits.cdk_wrapper module#
app.modules.toolkits.openbabel_wrapper module#
- app.modules.toolkits.openbabel_wrapper.get_ob_InChI(smiles, InChIKey=False)[source]#
Convert a SMILES string to InChI.
- Return type:
str
- Args:
smiles (str): Input SMILES string. InChIKey (bool, optional): Whether to return InChIKey. Defaults to False.
- Returns:
str: InChI string or InChIKey string if InChIKey is True.
- app.modules.toolkits.openbabel_wrapper.get_ob_canonical_SMILES(smiles)[source]#
Convert a SMILES string to Canonical SMILES.
- Return type:
str
- Args:
smiles (str): Input SMILES string.
- Returns:
str: Canonical SMILES string.
- app.modules.toolkits.openbabel_wrapper.get_ob_mol(smiles, threeD=False, depict=False)[source]#
Convert a SMILES string to a 2D/3D mol block.
- Return type:
str
- Args:
smiles (str): Input SMILES string. threeD (bool, optional): Generate 3D structure. Defaults to False. depict (bool, optional): Generate 3D structure for depiction. Defaults to False.
- Returns:
str: Mol block (2D/3D).