chemistry_tools.spectrum_similarity
¶
Mass spectrum similarity calculations.
Functions:
|
Create a |
|
Returns the normalised intensity for each rows of a |
|
Calculate the similarity score for two mass spectra. |
-
create_array
(intensities, mz)[source]¶ Create a
numpy.ndarray
, in a format appropriate forspectrum_similarity()
, from a list of intensities and a list of m/z values.
-
normalize
(row, max_val)[source]¶ Returns the normalised intensity for each rows of a
pandas.DataFrame
.
-
spectrum_similarity
(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]¶ Calculate the similarity score for two mass spectra.
- Parameters
spec_top (
ndarray
) – Array containing the experimental spectrum’s peak list with the m/z values in the first column and corresponding intensities in the secondspec_bottom (
ndarray
) – Array containing the reference spectrum’s peak list with the m/z values in the first column and corresponding intensities in the secondt (
float
) – numeric value specifying the tolerance used to align the m/z values of the two spectra. Default0.25
.b (
float
) – numeric value specifying the baseline threshold for peak identification. Expressed as a percent of the maximum intensity. Default10
.top_label (
Optional
[str
]) – string to label the top spectrum. DefaultNone
.bottom_label (
Optional
[str
]) – string to label the bottom spectrum. DefaultNone
.xlim (
Tuple
[int
,int
]) – tuple of length 2, defining the beginning and ending values of the x-axis. Default(50, 1200)
.x_threshold (
float
) – numeric value specifying. Default0
.print_alignment (
bool
) – whether the intensities should be printed. DefaultFalse
.output_list (
bool
) – whether the intensities should be returned as a third element of the tuple. DefaultFalse
.
- Return type
- Overloads
spectrum_similarity
(spec_top, spec_bottom, t = …, b = …, top_label:Optional
[str
] = …, bottom_label:Optional
[str
] = …, xlim = …, x_threshold = …, print_alignment = …, print_graphic = …, output_list:Literal
[True
] = True ) ->Tuple
[float
,float
,DataFrame
]spectrum_similarity
(spec_top, spec_bottom, t, b, top_label:Optional
[str
], bottom_label:Optional
[str
], xlim, x_threshold, print_alignment, print_graphic, output_list:Literal
[False
] ) ->Tuple
[float
,float
]