FormulaQuery
#
- class biotite.database.pubchem.FormulaQuery(formula, allow_other_elements=False, number=None)[source]#
Bases:
Query
A query that searches for compounds with the given molecular formula.
The formula can also be created from an
AtomArray
using thefrom_atoms()
method.- Parameters:
- formulastr
The molecular formula, i.e. each capitalized element with its count in the compound concatenated into a single string.
- allow_other_elementsbool, optional
If set to true, compounds with additional elements, not present in the molecular formula, will also match.
- numberint, optional
The maximum number of matches that this query may return. By default, the PubChem default value is used, which can be considered unlimited.
Examples
>>> print(search(FormulaQuery("C4H10", number=5))) [..., ..., ..., ..., ...] >>> atom_array = residue("ALA") >>> print(search(FormulaQuery.from_atoms(atom_array, number=5))) [..., ..., ..., ..., ...]
- static from_atoms(atoms, allow_other_elements=False, number=None)#
Create the query from an the given structure by using its molecular formula.
- Parameters:
- atomsAtomArray or AtomArrayStack
The structure to take the molecular formula from.
- allow_other_elementsbool, optional
If set to true, compounds with additional elements, not present in the molecular formula, will also match.
- numberint, optional
The maximum number of matches that this query may return. By default, the PubChem default value is used, which can be considered unlimited.
- Returns:
- queryFormulaQuery
The query.
- get_files()#
Get the POST file payload for this query.
- Returns:
- paramsdict (str -> object)
The file payload.
- get_input_url_path()#
Get the input part of the request URL.
- Returns:
- get_input_url_pathstr
The input part of the request URL. Must not contain slash characters at the beginning and end of the string.
- get_params()#
Get the POST payload for this query.
- Returns:
- paramsdict (str -> object)
The payload.