Example usage

To use single_mol in a project:

import single_mol
import msions.utils as msutils

Define files

elib_file = "../panoramaweb_files/plasma-EV-01.mzML.elib"
mzml_file = "../panoramaweb_files/plasma-EV-01.mzML"
hk_file = "../panoramaweb_files/plasma-EV-01_MS1_3sn.hk"
kro_file = "../panoramaweb_files/plasma-EV-01_MS1_3sn.kro"

Figure 2a

fig2a will create the Figure 2a heatmap using the mzML and binning provided as arguments.

# create bins for m/z
mz_bin_size = 4
mz_bin_mult = 1.0005
mz_start = 399
mz_end = 1005

bin_mz_list = msutils.bin_list(mz_start, mz_end, mz_bin_size, mz_bin_mult)

# create bins for retention time
rt_bin_size = 0.25
rt_bin_mult = 1
rt_start = 0
rt_end = 100

bin_rt_list = msutils.bin_list(rt_start, rt_end, rt_bin_size, rt_bin_mult)
# plot figure 2a heatmap
# expect 1 min 36 sec
single_mol.fig2a(mzml_file, bin_rt_list, bin_mz_list, manu_mzml=True)
_images/d740629a7d9cb5a171ef81079c5a6c0f1f014d9e26a8f4dc8b0a14dcc6902d41.png

Figure 2b

fig2b will plot the identified and unidentified peaks from an MS1 scan and print the labels for the peaks.

# plot figure 2b MS1 peaks
# expect 3 min 29 s
single_mol.fig2b(mzml_file, hk_file, elib_file, scan_num=170933, id_peaks=7)
791.9327 m/z: IQPSGGTNINEALLR (sp|P19823|ITIH2_HUMAN)
545.3016 m/z: LLADPTGAFGK (sp|P30044|PRDX5_HUMAN)
545.3016 m/z: LDAQASFLPK (sp|P19827|ITIH1_HUMAN)
722.3533 m/z: LMQCLPNPEDVK (sp|P04003|C4BPA_HUMAN)
955.4457 m/z: LLATLCSAEVCQCAEGK (sp|P0C0L4|CO4A_HUMAN)
955.4457 m/z: LLATLCSAEVCQCAEGK (sp|P0C0L5|CO4B_HUMAN)
502.2885 m/z: QVVAGLNFR (sp|P01042|KNG1_HUMAN)
602.3121 m/z: GMTNINDGLLR (sp|Q06033|ITIH3_HUMAN)
671.3362 m/z: TFGSGEADCGLRPLFEKK (sp|P00734|THRB_HUMAN)
_images/527c2f5fc4f3a4bed6606f44ca39b36d1b1675411f63502f6ea332ea53a085df.png

Figure 2c

fig2c will plot the Total Ion Current (TIC) and identified ion current.

# plot figure 2c TIC
# expect 4 min 42 sec
single_mol.fig2c(mzml_file, hk_file, elib_file)
Total Ion Current (TIC): 1.052e+13
ID'd TIC: 4.88e+12
46.4% of the signal
_images/6c2acef6664171415aec2fb42dab780bbacc4ebd319d2f4fff478ba42b0a0377.png

Figure 2c insert

fig2c_insert will create the Figure 2c histogram insert from a Kronik file and EncyclopeDIA elib.

# plot figure 2c histogram insert
# expect 6 min 7 sec
single_mol.fig2c_insert(kro_file, elib_file)
_images/7f09a66755ea836b56e16813038ac5f5f697baa9806b9b1d3d933fa01df18ed3.png

Figure 2d

fig2d will plot the total ions and identified ions.

# plot figure 2d ions
# expect 4 min 42 sec
single_mol.fig2d(mzml_file, hk_file, elib_file)
Total # of ions: 5.06e+09
Ions mapped to peptides: 1.22e+09
24.1% of the signal
_images/7889db3f9fa910927036a1a18b1b3576ad935be1d0cff729cbaacc8d57ba0c3b.png