Mercurial > repos > tomnl > assess_purity_msms
annotate anticipated_purity_dims.R @ 13:eea94e398c26 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 97c9122c9af9ddca3a2498185ce8c7919c0df03a
author | tomnl |
---|---|
date | Tue, 08 May 2018 05:30:13 -0400 |
parents | b262a6306ffe |
children | b20a4121a436 |
rev | line source |
---|---|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
1 library(msPurity) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
2 library(optparse) |
2
146699c00d38
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
3 print(sessionInfo()) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
4 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
5 option_list <- list( |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
6 make_option(c("--mzML_file"), type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
7 make_option(c("--peaks_file"), type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
8 make_option(c("-o", "--out_dir"), type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
9 make_option("--minOffset", default=0.5), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
10 make_option("--maxOffset", default=0.5), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
11 make_option("--ilim", default=0.05), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
12 make_option("--ppm", default=4), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
13 make_option("--dimspy", action="store_true"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
14 make_option("--sim", action="store_true"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
15 make_option("--remove_nas", action="store_true"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
16 make_option("--iwNorm", default="none", type="character"), |
6
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
17 make_option("--file_num_dimspy", default=1), |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
18 make_option("--exclude_isotopes", action="store_true"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
19 make_option("--isotope_matrix", type="character") |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
20 ) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
21 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
22 # store options |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
23 opt<- parse_args(OptionParser(option_list=option_list)) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
24 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
25 print(sessionInfo()) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
26 print(opt) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
27 |
6
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
28 if (is.null(opt$dimspy)){ |
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
29 |
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
30 df <- read.table(opt$peaks_file, header = TRUE, sep='\t') |
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
31 filename = NA |
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
32 }else{ |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
33 indf <- read.table(opt$peaks_file, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
34 header = TRUE, sep='\t', stringsAsFactors = FALSE) |
9
91f38a17d82a
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
8
diff
changeset
|
35 |
8
30160c2016d7
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
7
diff
changeset
|
36 filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] |
9
91f38a17d82a
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
8
diff
changeset
|
37 print(filename) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
38 # check if the data file is mzML or RAW (can only use mzML currently) so |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
39 # we expect an mzML file of the same name in the same folder |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
40 indf$i <- indf[,colnames(indf)==filename] |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
41 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
42 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
43 filename = sub("raw", "mzML", filename, ignore.case = TRUE) |
9
91f38a17d82a
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
8
diff
changeset
|
44 print(filename) |
11
b262a6306ffe
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
10
diff
changeset
|
45 df <- indf[4:nrow(indf),] |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
46 if ('blank_flag' %in% colnames(df)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
47 df <- df[df$blank_flag==1,] |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
48 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
49 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
50 colnames(df)[colnames(df)=='m.z'] <- 'mz' |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
51 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
52 if ('nan' %in% df$mz){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
53 df[df$mz=='nan',]$mz <- NA |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
54 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
55 df$mz <- as.numeric(df$mz) |
10
403ef9c57550
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
9
diff
changeset
|
56 mzml_file <- file.path(opt$mzML_file, filename) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
57 |
6
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
58 |
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
59 |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
60 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
61 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
62 if (!is.null(opt$remove_nas)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
63 df <- df[!is.na(df$mz),] |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
64 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
65 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
66 if (is.null(opt$isotope_matrix)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
67 im <- NULL |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
68 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
69 im <- read.table(opt$isotope_matrix, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
70 header = TRUE, sep='\t', stringsAsFactors = FALSE) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
71 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
72 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
73 if (is.null(opt$exclude_isotopes)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
74 isotopes <- FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
75 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
76 isotopes <- TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
77 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
78 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
79 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
80 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
81 if (is.null(opt$sim)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
82 sim=FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
83 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
84 sim=TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
85 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
86 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
87 minOffset = as.numeric(opt$minOffset) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
88 maxOffset = as.numeric(opt$maxOffset) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
89 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
90 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
91 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
92 if (opt$iwNorm=='none'){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
93 iwNorm = FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
94 iwNormFun = NULL |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
95 }else if (opt$iwNorm=='gauss'){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
96 iwNorm = TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
97 iwNormFun = msPurity::iwNormGauss(minOff=-minOffset, maxOff=maxOffset) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
98 }else if (opt$iwNorm=='rcosine'){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
99 iwNorm = TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
100 iwNormFun = msPurity::iwNormRcosine(minOff=-minOffset, maxOff=maxOffset) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
101 }else if (opt$iwNorm=='QE5'){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
102 iwNorm = TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
103 iwNormFun = msPurity::iwNormQE.5() |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
104 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
105 |
7
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
106 print('FIRST ROWS OF PEAK FILE') |
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
107 print(head(df)) |
10
403ef9c57550
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
9
diff
changeset
|
108 print(mzml_file) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
109 predicted <- msPurity::dimsPredictPuritySingle(df$mz, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
110 filepth=mzml_file, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
111 minOffset=minOffset, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
112 maxOffset=maxOffset, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
113 ppm=opt$ppm, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
114 mzML=TRUE, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
115 sim = sim, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
116 ilim = opt$ilim, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
117 isotopes = isotopes, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
118 im = im, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
119 iwNorm = iwNorm, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
120 iwNormFun = iwNormFun |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
121 ) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
122 predicted <- cbind(df, predicted) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
123 |
7
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
124 print(head(predicted)) |
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
125 print(file.path(opt$out_dir, 'anticipated_purity_dims.tsv')) |
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
126 write.table(predicted, file.path(opt$out_dir, 'anticipated_purity_dims.tsv'), row.names=FALSE, sep='\t') |