Denoising search: bacth mode
The denoising_search_batch function is essentially a wrapper function of denoising_search for batch data, while implemented in parallel processing.
The function takes similari parameters as denoising_search, but msms, pmz are now list or iteratable objects instead of single spectrum and float.
Example usage: The demo data can be found here.
import pandas as pd
import spectral_denoising as sd
quene_spectra= sd.read_msp('sample_data/query_spectra.msp')
reference_library =sd.read_msp('sample_data/reference_library.msp')
results = sd.denoising_search_batch(quene_spectra['peaks'], quene_spectra['precursor_mz'],reference_library)
The results will be a list. At each index, it will give all candidate spectra with denoised information, just as in denoising_search.
References
- spectral_denoising.denoising_search_batch(msms_query, pmz_query, reference_lib, identitiy_search_mass_error=0.01, mass_tolernace=0.005, pmz_col='precursor_mz', smiles_col='smiles', adduct_col='adduct', msms_col='peaks', first_n='all')[source]
Perform batch denoising search on given MS/MS data and precursor m/z values with parallel processing.
- Parameters:
msms_query (list): List of MS/MS spectra to be denoised.
pmz_query (list): List of precursor m/z values corresponding to the MS/MS spectra.
reference_lib (pandas.DataFrame): Reference library containing known spectra for comparison.
identitiy_search_mass_error (float, optional): Mass error tolerance for identity search. Default is 0.01.
mass_tolerance (float, optional): Maximum allowed tolerance for denoising. Default is 0.005.
pmz_col (str, optional): Column name for precursor m/z in the reference library. Default is ‘precursor_mz’.
smiles_col (str, optional): Column name for SMILES in the reference library. Default is ‘smiles’.
adduct_col (str, optional): Column name for adducts in the reference library. Default is ‘adduct’.
msms_col (str, optional): Column name for MS/MS peaks in the reference library. Default is ‘peaks’.
- Returns:
pandas.DataFrame: DataFrame containing the results of the denoising search. Each index in the result DataFrame corresponds to the denoising search result of the corresponding input MS/MS spectrum.