emzed.ms2.attach_ms2_spectra module

class emzed.ms2.attach_ms2_spectra.LookupMS2(spectra, dmz=0.01, drt=10)[source]

Bases: object

fast lookup of spectra for given peak limits. uses binning + dictionary for fast lookup.

find_spectra(mzmin, mzmax, rtmin, rtmax)[source]
emzed.ms2.attach_ms2_spectra.attach_ms2_spectra(peak_table, mode='union', mz_tolerance=0.0013, print_final_report=True)[source]

takes peak_table with columns “rtmin”, “rtmax”, “mzmin”, “mzmax” and “peakmap” and extracts the ms2 spectra for these peaks.

the peak_table is modified in place, an extra column “ms2_spectra” is added. the content of such a cell in the table is always a list of spectra. for modes “union” and “intersection” this list contains one single spectrum.

modes:
  • “all”: extracts a list of ms2 spectra per peak

  • “max_range”: extracts spec with widest m/z range

  • “max_signal”: extrats spec with maximal energy

  • “union”: merges all ms2 spectra from one peak to one spectrum containing all peaks

  • “intersection”: merges all ms2 spectra from one peak to one spectrum containing peaks which appear in all ms2 spectra.

mz_tolerance: only needed for modes “union” and “intersection”.

print_final_report: prints some final report with diagnosis messages for testing

if mz_tolerance parameter fits, you shoud set this parameter to True if you are not sure if mz_tolerance fits to your machines resolution.

emzed.ms2.attach_ms2_spectra.print_report(peak_table)[source]