Chemical Formula Operations

The Chemical Formulas submodule contains functions that allow the user to extract information out of chemical formulas (e.g., molecular weight).

Functions

get_molecular_weight(formula)

Function that returns the molecular weight of a passed chemical formula.

get_number_element_atoms(formula, element)

Function that returns the number of atoms of a given element present in a molecule based on a passed molecular formula.

chromaquant.utils.chemical_formulas.get_molecular_weight(formula: str | list[str]) float | list[float]

Function that returns the molecular weight of a passed chemical formula.

Parameters

formulastr | list[str]

A single chemical formula or list of formulas.

Returns

float | list[float]

A molecular weight or list of molecular weights.

chromaquant.utils.chemical_formulas.get_number_element_atoms(formula: str | list[str], element: str) int | list[int]

Function that returns the number of atoms of a given element present in a molecule based on a passed molecular formula.

Parameters

formulastr | list[str]

A single chemical formula or list of formulas.

elementstr

An element to search for (e.g., ‘C’ for carbon).

Returns

int | list[int]

A number of atoms of interest in the formula or list of numbers if function is passed a list of formulas.