pyms.eic
¶
Class to model a subset of data from an Intensity Matrix.
Classes:
|
Represents an extracted subset of the chromatographic data. |
Functions:
|
Given an intensity matrix and a list of masses, construct a |
-
class
ExtractedIntensityMatrix
(time_list, mass_list, intensity_array)[source]¶ Bases:
BaseIntensityMatrix
Represents an extracted subset of the chromatographic data.
- Parameters:
- Authors:
Dominic Davis-Foster
New in version 2.3.0.
Methods:
__eq__
(other)Return whether this intensity matrix object is equal to another object.
__len__
()Returns the number of scans in the intensity matrix.
crop_mass
(mass_min, mass_max)Crops mass spectrum.
dump
(file_name[, protocol])Dumps an object to a file through
pickle.dump()
.get_ic_at_index
(ix)Returns the ion chromatogram at the specified index.
get_ic_at_mass
([mass])Returns the ion chromatogram for the nearest binned mass to the specified mass.
get_index_at_time
(time)Returns the nearest index corresponding to the given time.
get_index_of_mass
(mass)Returns the index of the nearest binned mass to the given mass.
Returns binned mass at index.
get_ms_at_index
(ix)Returns a mass spectrum for a given scan index.
Returns the spectral intensities for scan index.
Returns time at given index.
Iterate over column indices.
Iterates over row indices.
null_mass
(mass)Ignore given (closest) mass in spectra.
reduce_mass_spectra
([n_intensities])Reduces the mass spectra by retaining the top n_intensities, discarding all other intensities.
set_ic_at_index
(ix, ic)Sets the intensity of the mass at index
ix
in each scan to a new value.Attributes:
Constructs a Base Peak Chromatogram from the data.
Returns an
IonChromatogram
object representing this EIC.Returns a copy of the intensity array.
Returns a copy of the intensity array as a list of lists of floats.
Returns a copy of the intensity matrix.
Returns a list of the masses.
Returns the intensity matrix as a list of lists of floats.
Returns the maximum m/z value in the spectrum.
Returns the minimum m/z value in the spectrum.
Gets the size of intensity matrix.
Returns a copy of the time list.
-
__eq__
(other)¶ Return whether this intensity matrix object is equal to another object.
- Parameters:
other – The other object to test equality with.
- Return type:
-
property
bpc
¶ Constructs a Base Peak Chromatogram from the data.
This represents the most intense ion – out of those used to create the
ExtractedIntensityMatrix
– for each scan.- Authors:
Dominic Davis-Foster
New in version 2.3.0.
- Return type:
-
crop_mass
(mass_min, mass_max)¶ Crops mass spectrum.
-
dump
(file_name, protocol=3)¶ Dumps an object to a file through
pickle.dump()
.
-
property
eic
¶ Returns an
IonChromatogram
object representing this EIC.- Return type:
-
get_ic_at_index
(ix)¶ Returns the ion chromatogram at the specified index.
- Parameters:
ix (
int
) – Index of an ion chromatogram in the intensity data matrix.- Return type:
- Returns:
Ion chromatogram at given index.
- Authors:
Qiao Wang, Andrew Isaac, Vladimir Likic
-
get_ic_at_mass
(mass=None)[source]¶ Returns the ion chromatogram for the nearest binned mass to the specified mass.
If no mass value is given, the function returns the extracted ion chromatogram.
-
get_index_at_time
(time)¶ Returns the nearest index corresponding to the given time.
- Parameters:
time (
float
) – Time in seconds- Return type:
- Returns:
Nearest index corresponding to given time
- Authors:
Lewis Lee, Tim Erwin, Vladimir Likic
Changed in version 2.3.0: Now returns
-1
if no index is found.
-
get_index_of_mass
(mass)¶ Returns the index of the nearest binned mass to the given mass.
-
get_mass_at_index
(ix)¶ Returns binned mass at index.
-
get_ms_at_index
(ix)¶ Returns a mass spectrum for a given scan index.
- Parameters:
ix (
int
) – The index of the scan.- Author:
Andrew Isaac
- Return type:
-
get_scan_at_index
(ix)¶ Returns the spectral intensities for scan index.
-
get_time_at_index
(ix)¶ Returns time at given index.
-
property
intensity_array
¶ Returns a copy of the intensity array.
- Return type:
- Returns:
Matrix of intensity values.
- Authors:
Andrew Isaac, Lewis Lee
-
property
intensity_array_list
¶ Returns a copy of the intensity array as a list of lists of floats.
-
property
intensity_matrix
¶ Returns a copy of the intensity matrix.
- Return type:
- Returns:
Matrix of intensity values.
- Author:
Andrew Isaac
-
property
mass_list
¶ Returns a list of the masses.
-
property
matrix_list
¶ Returns the intensity matrix as a list of lists of floats.
- Return type:
- Returns:
Matrix of intensity values
- Author:
Andrew Isaac
-
property
max_mass
¶ Returns the maximum m/z value in the spectrum.
-
property
min_mass
¶ Returns the minimum m/z value in the spectrum.
-
null_mass
(mass)¶ Ignore given (closest) mass in spectra.
- Parameters:
mass (
float
) – Mass value to remove- Author:
Andrew Isaac
-
reduce_mass_spectra
(n_intensities=5)¶ Reduces the mass spectra by retaining the top n_intensities, discarding all other intensities.
- Parameters:
n_intensities (
int
) – The number of top intensities to keep. Default5
.- Author:
Vladimir Likic
-
set_ic_at_index
(ix, ic)¶ Sets the intensity of the mass at index
ix
in each scan to a new value.- Parameters:
ix (
int
) – Index of an ion chromatogram in the intensity data matrix to be setic (
IonChromatogram
) – Ion chromatogram that will be copied at positionix
in the data matrix
The length of the ion chromatogram must match the appropriate dimension of the intensity matrix.
- Author:
Vladimir Likic
-
property
size
¶ Gets the size of intensity matrix.
-
build_extracted_intensity_matrix
(im, masses, left_bound=0.5, right_bound=0.5)[source]¶ Given an intensity matrix and a list of masses, construct a
ExtractedIntensityMatrix
for those masses.The masses can either be:
single masses (of type
float
),an iterable of masses.
left_bound
andright_bound
specify a range in which to include values for around each mass. For example, a mass of169
with bounds of0.3
and0.7
would include every mass between168.7
and169.7
(inclusive on both sides).Set the bounds to
0
to include only the given masses.- Parameters:
- Return type: