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 2a insert

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

# plot figure 2a histogram insert
# expect 6 min 7 sec
single_mol.fig2a_insert(kro_file, elib_file)
_images/d0458feaaa0aea759306f5ba68a9b2ec214e952b8d1a4c10f23119b0073fc7e2.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)
671.3362 m/z: TFGSGEADCGLRPLFEKK (sp|P00734|THRB_HUMAN)
437.2456 m/z: GIWLEAGK (sp|Q9Y490|TLN1_HUMAN)
437.2456 m/z: GLQVLMGR (sp|Q7L576|CYFP1_HUMAN)
437.2456 m/z: GLQVLMGR (sp|Q96F07|CYFP2_HUMAN)
_images/79352ab83f4fb8ab9887a923ee78d44eec3cd8d619a06c33da811f10fa7bf4e6.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): 10523443416667
ID'd TIC: 4883887856314
46.4% of the signal
_images/b5e700ebd1f4d8e4835d50f0cda352fc6bbb7a62e556638eb0f1ac8d96964612.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: 5057320877
Ions mapped to peptides: 1222192892
24.2% of the signal
_images/f50caccc798acd8a47c3f326bf64b20ee026e42d75c83f99577b7bf61c407ebc.png