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