massdash.loaders.access.MzMLDataAccess
- class massdash.loaders.access.MzMLDataAccess(filename: str, readOptions='ondisk', verbose=False)
Bases:
objectClass for data loading and extracting operations of an .mzML file
- filename
The mzML file to load.
- Type:
str
- readOptions
The readOptions to use, either ‘ondisk’ or ‘cached’.
- Type:
str
- exp
The on disk experiment.
- Type:
OnDiscMSExperiment
- meta_data
The meta data.
- Type:
MSExperiment
- has_im
Whether the data has ion mobility.
- Type:
bool
- load_data()
Loads data from an mzML file as an on disc experiment for memory efficiency and meta data access without loading full data.
- get_target_ms_level_indices()
Extract spectrum indices for a specific mslevel(s).
- get_spectra_rt_list()
Get a list of RT for all the spectra using meta_exp.
- check_ion_mobility(num_lines_to_check=10000000)
Check if the mzML file contains ion mobility data
Args: mzml_file: (str) mzML file to load num_lines_to_check: (int) Number of lines to check for “Ion Mobility”
Returns: Return a boolean indicating if the mzML file contains ion mobility data
- filter_single_spectrum(spec_indice: int, feature: TransitionGroupFeature, config: TargetedDIAConfig) _MSSpectrumDF
Filter a single spectrum for a given spectrum indice.
- Parameters:
spec_indice – (int) an interger of the spectrum indice to extra a spectrum for
feature – (TransitionGroupFeature) metadata on feature
config – (TargetedDIAConfig object) an object of TargetedDIAConfig that contains configuration parameters of how wide filtering windows should be
- Returns:
po.MSSpectrum() a MSSpectrum object
- get_spectra_rt_list() array
Get a list of RT for all the spectra using meta_exp
- Parameters:
self – (object) self object containing meta_data
- Returns:
Return a list of RT values for spectra
- get_target_ms_level_indices(mslevel=[1, 2]) array
Extract spectrum indices for a specific mslevel(s).
- Parameters:
self – (object) self object containing meta_data
mslevel – (list) list of mslevel(s) to extract indices for
- Returns:
Return mslevel_indices a list of indices with request mslevel(s) to self
- load_data()
Method to load data from an mzML file as an on disc experiment for memory efficiency and meta data access without loading full data
- load_spectrum(spec_indice: int) Tuple[array, array, array]
Load a single spectrum for a given spectrum indice.
- Parameters:
spec_indice – (int) an interger of the spectrum indice to extra a spectrum for
- Returns:
mz array int_array: intensity array im_array: ion mobility array
- Return type:
mz_array
- msExperimentToFeatureMap(msExperiment: _MSExperimentDF, feature: TransitionGroupFeature, config: TargetedDIAConfig) FeatureMap
Convert filtered spectra to Pandas DataFrame
- Parameters:
msExperiment – (MSExperiment) MSExperiment object that contains filtered data
feature – (TransitionGroupFeature) metadata on feature
config – (TargetedDIAConfig object) an object of TargetedDIAConfig that contains configuration parameters of how wide filtering windows should be
- Returns:
a FeatureMap object that contains filtered spectra
- Return type:
- reduce_spectra(feature: TransitionGroupFeature, config: TargetedDIAConfig) FeatureMap
Main method for filtering raw mzML DIA/diaPASEF data given specific set of coordinates to filter for.
- Parameters:
feature – (TransitionGroupFeature) a TransitionGroupFeature object that contains coordinates to filter for
config – (TargetedDIAConfig object) an object of TargetedDIAConfig that contains configuration parameters of how wide filtering windows should be
- Returns:
a FeatureMap object that contains filtered spectra
- Return type: