Mercurial > repos > tomnl > assess_purity_msms
annotate anticipated_purity_dims.R @ 23:c5ba85825284 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 04023134d8f28e85927ca293373c506484149ead-dirty
| author | tomnl |
|---|---|
| date | Fri, 01 Jun 2018 15:28:32 -0400 |
| parents | b20a4121a436 |
| children |
| 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 |
|
14
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
32 mzml_file <- opt$mzML_file |
|
6
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
33 }else{ |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
34 indf <- read.table(opt$peaks_file, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
35 header = TRUE, sep='\t', stringsAsFactors = FALSE) |
|
14
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
36 |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
37 |
|
14
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
38 if (file.exists(opt$mzML_file)){ |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
39 mzml_file <- opt$mzML_file |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
40 }else{ |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
41 |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
42 filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
43 print(filename) |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
44 # check if the data file is mzML or RAW (can only use mzML currently) so |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
45 # we expect an mzML file of the same name in the same folder |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
46 indf$i <- indf[,colnames(indf)==filename] |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
47 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
48 |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
49 filename = sub("raw", "mzML", filename, ignore.case = TRUE) |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
50 print(filename) |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
51 |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
52 mzml_file <- file.path(opt$mzML_file, filename) |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
53 |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
54 } |
|
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
55 |
|
11
b262a6306ffe
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
10
diff
changeset
|
56 df <- indf[4:nrow(indf),] |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
57 if ('blank_flag' %in% colnames(df)){ |
|
14
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
58 df <- df[df$blank_flag==1,] |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
59 } |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
60 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
|
61 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
62 if ('nan' %in% df$mz){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
63 df[df$mz=='nan',]$mz <- NA |
|
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 df$mz <- as.numeric(df$mz) |
|
14
b20a4121a436
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents:
11
diff
changeset
|
66 |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
67 |
|
6
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
68 |
|
e5f627fd21e8
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
2
diff
changeset
|
69 |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
70 } |
|
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 if (!is.null(opt$remove_nas)){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
73 df <- df[!is.na(df$mz),] |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
74 } |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
75 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
76 if (is.null(opt$isotope_matrix)){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
77 im <- NULL |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
78 }else{ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
79 im <- read.table(opt$isotope_matrix, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
80 header = TRUE, sep='\t', stringsAsFactors = FALSE) |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
81 } |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
82 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
83 if (is.null(opt$exclude_isotopes)){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
84 isotopes <- FALSE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
85 }else{ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
86 isotopes <- TRUE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
87 } |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
88 |
|
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 if (is.null(opt$sim)){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
92 sim=FALSE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
93 }else{ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
94 sim=TRUE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
95 } |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
96 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
97 minOffset = as.numeric(opt$minOffset) |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
98 maxOffset = as.numeric(opt$maxOffset) |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
99 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
100 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
101 |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
102 if (opt$iwNorm=='none'){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
103 iwNorm = FALSE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
104 iwNormFun = NULL |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
105 }else if (opt$iwNorm=='gauss'){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
106 iwNorm = TRUE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
107 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
|
108 }else if (opt$iwNorm=='rcosine'){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
109 iwNorm = TRUE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
110 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
|
111 }else if (opt$iwNorm=='QE5'){ |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
112 iwNorm = TRUE |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
113 iwNormFun = msPurity::iwNormQE.5() |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
114 } |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
115 |
|
7
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
116 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
|
117 print(head(df)) |
|
10
403ef9c57550
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
9
diff
changeset
|
118 print(mzml_file) |
|
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
119 predicted <- msPurity::dimsPredictPuritySingle(df$mz, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
120 filepth=mzml_file, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
121 minOffset=minOffset, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
122 maxOffset=maxOffset, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
123 ppm=opt$ppm, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
124 mzML=TRUE, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
125 sim = sim, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
126 ilim = opt$ilim, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
127 isotopes = isotopes, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
128 im = im, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
129 iwNorm = iwNorm, |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
130 iwNormFun = iwNormFun |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
131 ) |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
132 predicted <- cbind(df, predicted) |
|
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
133 |
|
7
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
134 print(head(predicted)) |
|
5a863e3d118d
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
6
diff
changeset
|
135 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
|
136 write.table(predicted, file.path(opt$out_dir, 'anticipated_purity_dims.tsv'), row.names=FALSE, sep='\t') |
