chemistry_tools
¶
Table of Contents
chemistry_tools.cas
¶
-
chemistry_tools.cas.
cas_int_to_string
(cas_no)[source]¶ Converts an integer CAS number to a hyphenated string
Parameters: cas_no (int) – Returns: Return type: str
-
chemistry_tools.cas.
cas_string_to_int
(cas_no)[source]¶ Converts a hyphenated string CAS number to a integer
Parameters: cas_no (str) – Returns: Return type: int
-
chemistry_tools.cas.
check_cas_number
(cas_no)[source]¶ Checks the CAS number to ensure the check digit is valid with respect to the rest of the number.
If the CAS number is valid 0 is returned. If there is a problem the difference between the computed check digit and that given as part of the CAS number is returned.
Parameters: cas_no (int) – Returns: Return type: int
chemistry_tools.lookup
¶
Lookup properties for compound by name or CAS number Uses data from PubChem and toxnet
-
chemistry_tools.lookup.
get_assays
(identifier, namespace='aid', **kwargs)[source]¶ Retrieve the specified assay records from PubChem.
Parameters: - identifier – The assay identifier to use as a search query.
- namespace – (optional) The identifier type.
-
chemistry_tools.lookup.
get_compounds
(identifier, namespace='cid', searchtype=None, as_dataframe=False, **kwargs)[source]¶ Retrieve the specified compound records from PubChem.
Parameters: - identifier – The compound identifier to use as a search query.
- namespace – (optional) The identifier type, one of cid, name, smiles, sdf, inchi, inchikey or formula.
- searchtype – (optional) The advanced search type, one of substructure, superstructure or similarity.
- as_dataframe – (optional) Automatically extract the
Compound
properties into a pandasDataFrame
and return that.
-
chemistry_tools.lookup.
get_substances
(identifier, namespace='sid', as_dataframe=False, **kwargs)[source]¶ Retrieve the specified substance records from PubChem.
Parameters: - identifier – The substance identifier to use as a search query.
- namespace – (optional) The identifier type, one of sid, name or sourceid/<source name>.
- as_dataframe – (optional) Automatically extract the
Substance
properties into a pandasDataFrame
and return that.
chemistry_tools.names
¶
Lookup properties for compound by name or CAS number Uses data from PubChem and toxnet
-
chemistry_tools.lookup.
get_assays
(identifier, namespace='aid', **kwargs)[source] Retrieve the specified assay records from PubChem.
Parameters: - identifier – The assay identifier to use as a search query.
- namespace – (optional) The identifier type.
-
chemistry_tools.lookup.
get_compounds
(identifier, namespace='cid', searchtype=None, as_dataframe=False, **kwargs)[source] Retrieve the specified compound records from PubChem.
Parameters: - identifier – The compound identifier to use as a search query.
- namespace – (optional) The identifier type, one of cid, name, smiles, sdf, inchi, inchikey or formula.
- searchtype – (optional) The advanced search type, one of substructure, superstructure or similarity.
- as_dataframe – (optional) Automatically extract the
Compound
properties into a pandasDataFrame
and return that.
-
chemistry_tools.lookup.
get_substances
(identifier, namespace='sid', as_dataframe=False, **kwargs)[source] Retrieve the specified substance records from PubChem.
Parameters: - identifier – The substance identifier to use as a search query.
- namespace – (optional) The identifier type, one of sid, name or sourceid/<source name>.
- as_dataframe – (optional) Automatically extract the
Substance
properties into a pandasDataFrame
and return that.
chemistry_tools.property_format
¶
Format Physical Properties for Chemicals
chemistry_tools.spectrum_similarity
¶
-
chemistry_tools.spectrum_similarity.
SpectrumSimilarity
(spec_top, spec_bottom, t=0.25, b=10, top_label=None, bottom_label=None, xlim=(50, 1200), x_threshold=0, print_alignment=False, print_graphic=True, output_list=False)[source]¶ Parameters: - spec_top (numpy.array) – Array containing the experimental spectrum’s peak list with the m/z values in the first column and corresponding intensities in the second
- spec_bottom (numpy.array) – Array containing the reference spectrum’s peak list with the m/z values in the first column and corresponding intensities in the second
- t (float) – numeric value specifying the tolerance used to align the m/z values of the two spectra.
- b (float) – numeric value specifying the baseline threshold for peak identification. Expressed as a percent of the maximum intensity.
- top_label (str) – string to label the top spectrum.
- bottom_label (str) – string to label the bottom spectrum.
- xlim (tuple of int) – tuple of length 2, defining the beginning and ending values of the x-axis.
- x_threshold (float) – numeric value specifying
- print_alignment (bool) – whether the intensities should be printed
- print_graphic (bool) –
- output_list (bool) – whether the intensities should be returned
Returns: Return type:
chemistry_tools.toxnet
¶
Read data from National Library of Medicine TOXNET
chemistry_tools.utils
¶
General utilities.
-
chemistry_tools.utils.
defaultnamedtuple
(typename, field_names, defaults=())[source]¶ Generates a new subclass of tuple with default values.
- typename : string
- The name of the class.
- field_names : str or iterable
- An iterable of splitable string.
- defaults : iterable
- Default values for
field_names
, counting[-len(defaults):]
.
>>> Body = defaultnamedtuple('Body', 'x y z density', (1.0,)) >>> Body.__doc__ 'Body(x, y, z, density)' >>> b = Body(10, z=3, y=5) >>> b._asdict() == dict(x=10, y=5, z=3, density=1.0) True
A new tuple subclass named
typename