annotate MS2snoop.R @ 0:91a3242fd67f draft

"planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
author workflow4metabolomics
date Mon, 25 Apr 2022 08:23:54 +0000
parents
children df2672c37732
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
1 #'
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
2 #' read and process mspurity W4M files
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
3 #' create a summary of fragment for each precursor and a graphics of peseudo
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
4 #' spectra + correlation on which checking of fragment is based on
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
5 #' V3 try to identify and process multiple files for 1 precursor which may
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
6 #' occur if different collision energy are used
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
7 #' V4 elimination of correlation = NA. Correlation is done with precursor, if
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
8 #' precursor is not present correlation with most intense peak
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
9 #' author: Jean-Francois Martin
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
10 #' V5 is versionned, lintR-compliant, packaged, unit-tested, documented and
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
11 #' tested against data from other labs.
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
12 #' new maintainer: Lain Pavot - lain.pavot@inrae.fr
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
13 #'
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
14 #' @import optparse
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
15 #'
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
16 NULL
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
17
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
18
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
19 assign("DEFAULT_PRECURSOR_PATH", "peaklist_precursors.tsv")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
20 assign("DEFAULT_FRAGMENTS_PATH", "peaklist_fragments.tsv")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
21 assign("DEFAULT_COMPOUNDS_PATH", "compounds_pos.txt")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
22 assign("DEFAULT_OUTPUT_PATH", "compound_fragments_result.txt")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
23 assign("DEFAULT_TOLMZ", 0.01)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
24 assign("DEFAULT_TOLRT", 20)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
25 assign("DEFAULT_MZDECIMAL", 0)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
26 assign("DEFAULT_R_THRESHOLD", 0.85)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
27 assign("DEFAULT_MINNUMBERSCAN", 8)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
28 assign("DEFAULT_SEUIL_RA", 0.5)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
29 lockBinding("DEFAULT_PRECURSOR_PATH", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
30 lockBinding("DEFAULT_FRAGMENTS_PATH", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
31 lockBinding("DEFAULT_COMPOUNDS_PATH", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
32 lockBinding("DEFAULT_OUTPUT_PATH", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
33 lockBinding("DEFAULT_TOLMZ", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
34 lockBinding("DEFAULT_TOLRT", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
35 lockBinding("DEFAULT_MZDECIMAL", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
36 lockBinding("DEFAULT_R_THRESHOLD", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
37 lockBinding("DEFAULT_MINNUMBERSCAN", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
38 lockBinding("DEFAULT_SEUIL_RA", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
39
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
40 assign("DEFAULT_EXTRACT_FRAGMENTS_R_THRESHOLD", 0.85)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
41 assign("DEFAULT_EXTRACT_FRAGMENTS_SEUIL_RA", 0.1)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
42 assign("DEFAULT_EXTRACT_FRAGMENTS_TOLMZ", 0.01)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
43 assign("DEFAULT_EXTRACT_FRAGMENTS_TOLRT", 60)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
44 lockBinding("DEFAULT_EXTRACT_FRAGMENTS_R_THRESHOLD", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
45 lockBinding("DEFAULT_EXTRACT_FRAGMENTS_SEUIL_RA", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
46 lockBinding("DEFAULT_EXTRACT_FRAGMENTS_TOLMZ", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
47 lockBinding("DEFAULT_EXTRACT_FRAGMENTS_TOLRT", globalenv())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
48
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
49
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
50 debug <- FALSE
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
51
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
52
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
53 ########################################################################
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
54
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
55 #' @title plot_pseudo_spectra
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
56 #' @param x
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
57 #' @param r_threshold
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
58 #' @param fid
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
59 #' @param sum_int
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
60 #' @param vmz
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
61 #' @param cor_abs_int
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
62 #' @param refcol
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
63 #' @param c_name
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
64 #' @description plot_pseudo_spectra
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
65 #' function to compute sum of intensities among scans for all
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
66 #' m/z kept (cor > r_threshold & minimum number of scans)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
67 #' and plot pseudo spectra
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
68 #' x dataframe scan X fragments with scans number in the 1st column and
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
69 #' ions in next with intensities
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
70 #' fid file id when several a precursor has been detected in several files
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
71 plot_pseudo_spectra <- function(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
72 x,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
73 r_threshold,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
74 fid,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
75 sum_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
76 vmz,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
77 cor_abs_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
78 refcol,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
79 c_name
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
80 ) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
81 ## du fait de la difference de nombre de colonne entre la dataframe qui
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
82 ## inclue les scans en 1ere col, mzRef se decale de 1
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
83 refcol <- refcol - 1
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
84 ## compute relative intensities max=100%
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
85 rel_int <- sum_int[-1]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
86 rel_int <- rel_int / max(rel_int)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
87
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
88 ## define max value on vertical axis (need to increase in order to plot the
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
89 ## label of fragments)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
90 ymax <- max(rel_int) + 0.2 * max(rel_int)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
91
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
92 par(mfrow = c(2, 1))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
93 plot(vmz, rel_int, type = "h", ylim = c(0, ymax), main = c_name)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
94 ## low correl coef. will be display in grey
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
95 cor_low <- which(round(cor_abs_int, 2) < r_threshold)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
96
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
97 lbmzcor <- sprintf("%s(r=%s)", vmz, round(cor_abs_int, 2))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
98
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
99 if (length(cor_low) > 0) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
100 text(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
101 vmz[cor_low],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
102 rel_int[cor_low],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
103 lbmzcor[cor_low],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
104 cex = 0.5,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
105 col = "grey",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
106 srt = 90,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
107 adj = 0
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
108 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
109 if (length(vmz) - length(cor_low) > 1) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
110 text(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
111 vmz[-c(refcol, cor_low)],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
112 rel_int[-c(refcol, cor_low)],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
113 lbmzcor[-c(refcol, cor_low)],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
114 cex = 0.6,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
115 col = 1,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
116 srt = 90,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
117 adj = 0
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
118 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
119 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
120 } else {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
121 if (length(vmz) > 1) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
122 text(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
123 vmz[-c(refcol)],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
124 rel_int[-c(refcol)],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
125 lbmzcor[-c(refcol)],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
126 cex = 0.6,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
127 col = 1,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
128 srt = 90,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
129 adj = 0
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
130 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
131 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
132 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
133
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
134 text(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
135 vmz[refcol],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
136 rel_int[refcol],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
137 lbmzcor[refcol],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
138 cex = 0.8,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
139 col = 2,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
140 srt = 90,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
141 adj = 0
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
142 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
143
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
144 ## prepare result file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
145 corValid <- (round(cor_abs_int, 2) >= r_threshold) ##nolint object_name_linter
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
146 cp_res <- data.frame(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
147 rep(c_name, length(vmz)),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
148 rep(fid, length(vmz)),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
149 vmz,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
150 cor_abs_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
151 sum_int[-1],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
152 rel_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
153 corValid
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
154 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
155
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
156 colnames(cp_res) <- c(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
157 "compoundName",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
158 "fileid",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
159 "fragments_mz",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
160 "CorWithPrecursor",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
161 "AbsoluteIntensity",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
162 "relativeIntensity",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
163 "corValid"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
164 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
165 return(cp_res)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
166
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
167 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
168
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
169 #'
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
170 #' @title extract_fragments
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
171 #'
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
172 #' @param precursors the precursor list from mspurity
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
173 #' @param fragments the fragments list from ms purity
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
174 #' @param mzref
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
175 #' @param rtref
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
176 #' @param c_name
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
177 #' @param r_threshold default = DEFAULT_EXTRACT_FRAGMENTS_R_THRESHOLD
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
178 #' @param seuil_ra default = DEFAULT_EXTRACT_FRAGMENTS_SEUIL_RA
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
179 #' @param tolmz default = DEFAULT_EXTRACT_FRAGMENTS_TOLMZ
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
180 #' @param tolrt default = DEFAULT_EXTRACT_FRAGMENTS_TOLRT
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
181 #' @returns
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
182 #'
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
183 #' @description
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
184 #' function for extraction of fragments corresponding to precursors
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
185 #' detected by MSPurity
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
186 extract_fragments <- function( ## nolint cyclocomp_linter
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
187 precursors,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
188 fragments,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
189 mzref,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
190 rtref,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
191 c_name,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
192 min_number_scan,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
193 mzdecimal,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
194 r_threshold=DEFAULT_EXTRACT_FRAGMENTS_R_THRESHOLD,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
195 seuil_ra=DEFAULT_EXTRACT_FRAGMENTS_SEUIL_RA,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
196 tolmz=DEFAULT_EXTRACT_FRAGMENTS_TOLMZ,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
197 tolrt=DEFAULT_EXTRACT_FRAGMENTS_TOLRT
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
198 ) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
199 ## filter precursor in the precursors file based on mz and rt in the
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
200 ## compound list
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
201 cat("processing ", c_name, "\n")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
202 selected_precursors <- which(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
203 (abs(precursors$precurMtchMZ - mzref) <= tolmz)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
204 & (abs(precursors$precurMtchRT - rtref) <= tolrt)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
205 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
206
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
207 ## check if there is the precursor in the file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
208 if (length(selected_precursors) > 0) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
209
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
210 sprecini <- precursors[selected_precursors, ]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
211
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
212 ## check if fragments corresponding to precursor are found in several
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
213 ## files (collision energy)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
214 ## this lead to a processing for each fileid
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
215 mf <- levels(as.factor(sprecini$fileid))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
216 if (length(mf) > 1) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
217 cat(" several files detected for this compounds :\n")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
218 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
219
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
220 for (f in seq_along(mf)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
221
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
222 sprec <- sprecini[sprecini$fileid == mf[f], ]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
223
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
224 ## selection of fragment in the fragments file with the grpid common in
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
225 ## both fragments and precursors
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
226 selfrgt <- levels(as.factor(sprec$grpid))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
227 sfrgt <- fragments[
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
228 fragments$grpid %in% selfrgt
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
229 & fragments$fileid == mf[f],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
230 ]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
231
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
232 ## filter fragments on relative intensity seuil_ra = user defined
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
233 ## parameter (MSpurity flags could be used here)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
234 sfrgtfil <- sfrgt[sfrgt$ra > seuil_ra, ]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
235
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
236 mznominal <- round(x = sfrgtfil$mz, mzdecimal)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
237 sfrgtfil <- data.frame(sfrgtfil, mznominal)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
238
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
239 ## creation of cross table row=scan col=mz X=ra
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
240 vmz <- levels(as.factor(sfrgtfil$mznominal))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
241
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
242 cat(" fragments :", vmz)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
243
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
244 ## mz of precursor in data precursor to check correlation with
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
245 mz_prec <- paste0("mz", round(mean(sprec$mz), mzdecimal))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
246
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
247 for (m in seq_along(vmz)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
248
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
249 ## absolute intensity
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
250 cln <- c(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
251 which(colnames(sfrgtfil) == "acquisitionNum"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
252 which(colnames(sfrgtfil) == "i")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
253 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
254 int_mz <- sfrgtfil[sfrgtfil$mznominal == vmz[m], cln]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
255 colnames(int_mz)[2] <- paste0("mz", vmz[m])
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
256
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
257 ## average intensities of mass in duplicate scans
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
258 comp_scans <- aggregate(x = int_mz, by = list(int_mz[[1]]), FUN = mean)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
259 int_mz <- comp_scans[, -1]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
260
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
261 if (m == 1) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
262 ds_abs_int <- int_mz
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
263 } else {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
264 ds_abs_int <- merge(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
265 x = ds_abs_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
266 y = int_mz,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
267 by.x = 1,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
268 by.y = 1,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
269 all.x = TRUE,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
270 all.y = TRUE
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
271 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
272 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
273 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
274 if (debug) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
275 write.table(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
276 x = ds_abs_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
277 file = paste0(c_name, "ds_abs_int.txt"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
278 row.names = FALSE,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
279 sep = "\t"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
280 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
281 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
282
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
283 ## elimination of mz with less than min_number_scan scans (user defined
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
284 ## parameter)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
285 xmz <- rep(NA, ncol(ds_abs_int) - 1)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
286 sum_int <- rep(NA, ncol(ds_abs_int))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
287 nbxmz <- 0
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
288 nb_scan_check <- min(nrow(ds_abs_int), min_number_scan)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
289
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
290 for (j in 2:ncol(ds_abs_int)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
291 sum_int[j] <- sum(ds_abs_int[j], na.rm = TRUE)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
292 if (sum(!is.na(ds_abs_int[[j]])) < nb_scan_check) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
293 nbxmz <- nbxmz + 1
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
294 xmz[nbxmz] <- j
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
295 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
296 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
297
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
298 xmz <- xmz[-which(is.na(xmz))]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
299 if (length(xmz) > 0) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
300 ds_abs_int <- ds_abs_int[, -c(xmz)]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
301 sum_int <- sum_int[-c(xmz)]
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
302 ## liste des mz keeped decale de 1 avec ds_abs_int
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
303 vmz <- as.numeric(vmz[-c(xmz - 1)])
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
304 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
305
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
306 ## reference ion for correlation computing = precursor OR maximum
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
307 ## intensity ion in precursor is not present
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
308 refcol <- which(colnames(ds_abs_int) == mz_prec)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
309 if (length(refcol) == 0) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
310 refcol <- which(sum_int == max(sum_int, na.rm = TRUE))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
311 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
312 pdf(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
313 file = sprintf("%s_processing_file%s.pdf", c_name, mf[f]),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
314 width = 8,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
315 height = 11
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
316 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
317 par(mfrow = c(3, 2))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
318
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
319 ## Pearson correlations between absolute intensities computing
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
320 cor_abs_int <- rep(NA, length(vmz))
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
321
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
322 if (length(refcol) > 0) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
323 for (i in 2:length(ds_abs_int)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
324 cor_abs_int[i - 1] <- cor(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
325 x = ds_abs_int[[refcol]],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
326 y = ds_abs_int[[i]],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
327 use = "pairwise.complete.obs",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
328 method = "pearson"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
329 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
330 plot(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
331 ds_abs_int[[refcol]],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
332 ds_abs_int[[i]],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
333 xlab = colnames(ds_abs_int)[refcol],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
334 ylab = colnames(ds_abs_int)[i],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
335 main = sprintf(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
336 "%s corr coeff r=%s", c_name, round(cor_abs_int[i - 1], 2)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
337 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
338 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
339 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
340 ## plot pseudo spectra
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
341 res_comp_by_file <- plot_pseudo_spectra(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
342 x = ds_abs_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
343 r_threshold = r_threshold,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
344 fid = mf[f],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
345 sum_int = sum_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
346 vmz = vmz,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
347 cor_abs_int = cor_abs_int,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
348 refcol = refcol,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
349 c_name = c_name
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
350 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
351 if (f == 1) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
352 res_comp <- res_comp_by_file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
353 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
354 } else {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
355 res_comp_by_file <- NULL
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
356 cat(" non detected in fragments file \n")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
357 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
358 if (!is.null(res_comp_by_file)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
359 res_comp <- rbind(res_comp, res_comp_by_file)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
360 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
361 cat("\n")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
362 dev.off()
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
363 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
364 } else {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
365 res_comp <- NULL
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
366 cat(" non detected in precursor file \n")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
367 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
368 return(res_comp)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
369 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
370
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
371
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
372 create_parser <- function() {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
373 parser <- optparse::OptionParser()
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
374 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
375 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
376 c("-v", "--verbose"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
377 action = "store_true",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
378 default = FALSE,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
379 help = "Print extra output [default %default]"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
380 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
381 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
382 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
383 c("-o", "--output"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
384 type = "character",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
385 default = DEFAULT_OUTPUT_PATH,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
386 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
387 help = "Path to the output file [default %default]"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
388 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
389 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
390 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
391 c("-p", "--precursors"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
392 type = "character",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
393 default = DEFAULT_PRECURSOR_PATH,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
394 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
395 help = "Path to the precursors file [default %default]"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
396 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
397 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
398 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
399 c("-f", "--fragments"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
400 type = "character",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
401 default = DEFAULT_FRAGMENTS_PATH,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
402 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
403 help = "Path to the fragments file [default %default]"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
404 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
405 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
406 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
407 c("-c", "--compounds"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
408 type = "character",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
409 default = DEFAULT_COMPOUNDS_PATH,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
410 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
411 help = "Path to the compounds file [default %default]"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
412 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
413 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
414 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
415 c("--tolmz"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
416 type = "numeric",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
417 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
418 default = DEFAULT_TOLMZ,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
419 metavar = "number"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
420 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
421 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
422 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
423 c("--tolrt"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
424 type = "integer",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
425 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
426 default = DEFAULT_TOLRT,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
427 metavar = "number"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
428 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
429 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
430 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
431 c("--seuil_ra"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
432 type = "numeric",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
433 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
434 help = "relative intensity threshold",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
435 default = DEFAULT_SEUIL_RA,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
436 metavar = "number"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
437 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
438 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
439 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
440 c("--mzdecimal"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
441 type = "integer",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
442 default = DEFAULT_MZDECIMAL,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
443 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
444 help = "nb decimal for mz",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
445 metavar = "number"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
446 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
447 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
448 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
449 c("--r_threshold"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
450 type = "integer",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
451 default = DEFAULT_R_THRESHOLD,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
452 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
453 help = paste0(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
454 "r pearson correlation threshold between precursor and fragment ",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
455 "absolute intensity"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
456 ),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
457 metavar = "number"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
458 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
459 parser <- optparse::add_option(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
460 parser,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
461 c("--min_number_scan"),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
462 type = "numeric",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
463 action = "store",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
464 default = DEFAULT_MINNUMBERSCAN,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
465 help = paste0(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
466 "fragments are kept if there are found in a minimum number ",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
467 "of scans"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
468 ),
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
469 metavar = "number"
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
470 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
471 return(parser)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
472 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
473
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
474 main <- function(args) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
475 ## FOLDER AND FILES
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
476 ## MSpurity precursors file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
477 precursors <- read.table(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
478 file = args$precursors,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
479 header = TRUE,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
480 sep = "\t",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
481 quote = "\""
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
482 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
483 ## MSpurity fragments file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
484 fragments <- read.table(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
485 file = args$fragments,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
486 header = TRUE,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
487 sep = "\t",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
488 quote = "\""
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
489 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
490 ## list of compounds : col1=Name of molecule, col2=m/z, col3=retention time
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
491 compounds <- read.table(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
492 file = args$compounds,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
493 sep = "\t",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
494 quote = "\"",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
495 header = TRUE
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
496 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
497 ## PARAMETERS
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
498 ## tolerance for mz(dalton) rt(seconds) to match the standard in the compounds
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
499 ## list with the precursor MSpurity file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
500 tolmz <- args$tolmz
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
501 tolrt <- args$tolrt
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
502
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
503 ## relative intensity threshold
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
504 seuil_ra <- args$seuil_ra
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
505 ## nb decimal for mz
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
506 mzdecimal <- args$mzdecimal
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
507 ## r pearson correlation threshold between precursor and
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
508 # #fragment absolute intensity
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
509 r_threshold <- args$r_threshold
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
510 ## fragments are kept if there are found in a minimum number of scans
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
511 min_number_scan <- args$min_number_scan
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
512
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
513 for (i in seq_len(nrow(compounds))) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
514 ## loop execution for all compounds in the compounds file
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
515 res_cor <- NULL
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
516 res_cor <- extract_fragments(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
517 precursors = precursors,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
518 fragments = fragments,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
519 mzref = compounds[[2]][i],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
520 rtref = compounds[[3]][i],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
521 c_name = compounds[[1]][i],
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
522 min_number_scan = min_number_scan,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
523 mzdecimal = mzdecimal,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
524 r_threshold = r_threshold,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
525 seuil_ra = seuil_ra,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
526 tolmz = tolmz,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
527 tolrt = tolrt
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
528 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
529 if (i == 1 & !is.null(res_cor)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
530 res_all <- res_cor
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
531 } else if (!is.null(res_cor)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
532 res_all <- rbind(res_all, res_cor)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
533 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
534 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
535
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
536 if (is.null(res_all)) {
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
537 stop("No result at all!")
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
538 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
539 write.table(
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
540 x = res_all,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
541 file = args$output,
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
542 sep = "\t",
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
543 row.names = FALSE
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
544 )
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
545 }
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
546
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
547 args <- optparse::parse_args(create_parser())
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
548 sessionInfo()
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
549 main(args)
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
550
91a3242fd67f "planemo upload commit c7676a9c7ac542043691d735285ae19e430bf032"
workflow4metabolomics
parents:
diff changeset
551 warnings()