Reference

This page includes the reference documentation for all user-facing code from the Smartclass Python package.

Functions

bfs_search_classes_generator(classes, ...[, ...])

Perform substructure search using Breadth-First Search traversal.

calculate_mcs(mols[, threshold, ...])

Calculate Maximum Common Substructure (MCS) for a list of molecules.

check_missing_stereochemistry(smiles[, ...])

Check stereochemistry.

check_smiles_contains_no_dot(smiles)

Checks if SMILES contains no dot.

check_smiles_contains_no_isotope(smiles)

Checks if SMILES contains no isotope.

check_smiles_isomeric(smiles_isomeric[, ...])

Check isomeric smiles.

combine_csv_files(input_files, output_file)

Combine multiple CSV files into a single CSV file.

configure_logging([level, format_string, ...])

Configure logging for the smartclass package.

convert_chemical_formula(text)

Convert chemical formula.

convert_classyfire_dict([classyfire_json, ...])

Converts the classyfire json into a CHEMONTID dictionary.

convert_inchi_to_inchikey(inchi)

Convert a structure InChI to InChIKey.

convert_inchi_to_mass(inchi)

Convert a structure InChI to mass.

convert_inchi_to_mol(inchi)

Convert a structure InChI to MOL.

convert_inchi_to_smiles(inchi)

Convert a structure InChI to SMILES.

convert_list_of_dict(list_of_dict, key, value)

Convert a list of dictionaries to a dictionary with possible inversion.

convert_mol_to_cxsmiles(mol)

Convert a structure MOL to CXSMILES.

convert_mol_to_inchi(mol)

Convert a structure MOL to InChI.

convert_mol_to_inchikey(mol)

Convert an RDKit Mol object to an InChIKey.

convert_mol_to_smarts(mol)

Convert a structure MOL to SMARTS.

convert_mol_to_smiles(mol)

Convert a structure MOL to SMILES.

convert_molblock_to_mol(molblock)

Convert a structure MOLBlock to MOL.

convert_smarts_to_mol(smarts)

Convert a structure SMARTS to MOL.

convert_smiles_to_canonical_smiles(smiles)

Convert a structure SMILES to canonical SMILES.

convert_smiles_to_formula(smiles)

Convert a structure SMILES to a molecular formula.

convert_smiles_to_inchi(smiles)

Convert a structure SMILES to InChI.

convert_smiles_to_mass(smiles)

Convert a structure SMILES to an exact mass.

convert_smiles_to_mol(smiles[, sanitize])

Convert a SMILES string to an RDKit Mol object.

download_file_if_not_exists(url, output)

Downloads a file from the specified URL if it does not exist.

enumerate_structures(mol)

Enumerate structural variants of a molecule.

export_dict_to_json(dic, output)

Export dict to json.

export_results(output, results)

Export a list of dictionaries to a CSV or TSV file.

fix_inchi_tautomerization(smiles)

Fix InChI tautomerization.

get_class_structures(classes)

Build a mapping from class IDs to their SMARTS structures.

get_config()

Get the global configuration instance.

get_logger(name)

Get a logger for the given module name.

get_num_atoms_bonds(mol)

Get number of atoms and bonds.

get_num_matched_atoms_bonds(mol_1, mol_2)

Get number of matched atoms and bonds.

get_request(url, query[, max_retries, ...])

Send a GET request to a SPARQL endpoint and retrieve JSON data.

load_csv_from_path(path)

Load csv from path.

load_external_classes_file(file[, id_name, ...])

Load a Polars DataFrame from an external tsv file with chemical classes.

load_json_from_path(path)

Load json from path.

load_json_from_url(url)

Load JSON from URL.

load_json_from_url_or_path(url, name)

Load json from URL or path.

load_pkg_bitter_smiles()

Load bitter SMILES data from the package file into a Polars DataFrame.

load_pkg_chemical_hierarchy([file_path])

Load chemical class hierarchy from a TSV file.

load_pkg_classes()

Load chemical classes data from the package file into a Polars DataFrame.

load_pkg_data()

Load the package data.

load_pkg_file(file[, directory])

Load data from a package-bundled file into a Polars DataFrame.

load_pkg_mappings()

Load chemont__wd mappings data from the package file into a Polars DataFrame.

load_pkg_mia()

Load Mono Indole Alkaloids (MIA) data from the package file into a Polars DataFrame.

load_smiles(input[, column, limit])

Load unique SMILES strings from a CSV or TSV file.

load_tsv_from_path(path)

Load tsv from path.

read_query(query)

Read a SPARQL query from a file path or URL.

sample_list(items[, max_samples])

Randomly sample items from a list.

search_class(class_dict, structures[, params])

Search for a single class and return results as dictionaries.

search_classes([classes_file, ...])

Perform substructure search to classify chemical structures.

split_csv(input_file, output_dir[, ...])

Split a CSV file into multiple smaller CSV files.

standardize(smiles)

Standardize.

Classes

SmartclassError(message, *args, **kwargs)

Base exception for all smartclass errors.