MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / createMS2Precursor

Function createMS2Precursor

tools/scripts/create_im_with_swathIm.py:62–84  ·  view source on GitHub ↗
(allmz, allint, allim, imCenterIdx, imWidth, base_int, baseFragmentMz = 100, nr_peaks = NR_PEAKS, im_bins=IM_BINS, imWinLim=None)

Source from the content-addressed store, hash-verified

60# nr_peaks = number of fragment peaks to create
61# imWinLim = window limits of IM, do not plot anything outside of this window
62def createMS2Precursor(allmz, allint, allim, imCenterIdx, imWidth, base_int, baseFragmentMz = 100, nr_peaks = NR_PEAKS, im_bins=IM_BINS, imWinLim=None):
63 if imWinLim is None:
64 for im_idx in range(*im_bins):
65 for i in range(nr_peaks):
66 if (imCenterIdx - imWidth) < im_idx < (imCenterIdx + imWidth):
67 apex_dist = abs( imCenterIdx - im_idx)
68 p = Peak1D()
69 p.setMZ(baseFragmentMz+i)
70 p.setIntensity(base_int * (i + 1) - base_int * (i + 1) * apex_dist / imWidth)
71 allmz.append(p.getMZ())
72 allint.append(p.getIntensity())
73 allim.append( im_idx / 500.0)
74 else: # have to check if in range of IM upper limit
75 for im_idx in range(*im_bins):
76 for i in range(nr_peaks):
77 if (imCenterIdx - imWidth) < im_idx < (imCenterIdx + imWidth) and (imWinLim[0] < im_idx < imWinLim[1] ):
78 apex_dist = abs( imCenterIdx - im_idx)
79 p = Peak1D()
80 p.setMZ(baseFragmentMz+i)
81 p.setIntensity(base_int * (i + 1) - base_int * (i + 1) * apex_dist / imWidth)
82 allmz.append(p.getMZ())
83 allint.append(p.getIntensity())
84 allim.append( im_idx / 500.0)
85
86
87# add values to spectrum across IM corresponding with a precursor

Callers 1

Calls 5

Peak1DFunction · 0.50
setMZMethod · 0.45
appendMethod · 0.45
getMZMethod · 0.45
getIntensityMethod · 0.45

Tested by

no test coverage detected