Mercurial > repos > tomnl > create_sqlite_db
annotate anticipated_purity_dims.R @ 10:cf82f99f3638 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
author | tomnl |
---|---|
date | Thu, 03 May 2018 07:34:42 -0400 |
parents | cc4464eb380f |
children | 4acad02faf32 |
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 |
9ab472c5714c
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
1
diff
changeset
|
32 }else{ |
0
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
33 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
|
34 header = TRUE, sep='\t', stringsAsFactors = FALSE) |
8
f6996ad60d8f
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
7
diff
changeset
|
35 |
7
d7f4696a1f86
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
6
diff
changeset
|
36 filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] |
8
f6996ad60d8f
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
7
diff
changeset
|
37 print(filename) |
0
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
38 # check if the data file is mzML or RAW (can only use mzML currently) so |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
39 # we expect an mzML file of the same name in the same folder |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
40 indf$i <- indf[,colnames(indf)==filename] |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
41 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
42 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
43 filename = sub("raw", "mzML", filename, ignore.case = TRUE) |
8
f6996ad60d8f
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
7
diff
changeset
|
44 print(filename) |
10
cf82f99f3638
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
9
diff
changeset
|
45 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
|
46 if ('blank_flag' %in% colnames(df)){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
47 df <- df[df$blank_flag==1,] |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
48 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
49 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
50 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
|
51 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
52 if ('nan' %in% df$mz){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
53 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
|
54 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
55 df$mz <- as.numeric(df$mz) |
9
cc4464eb380f
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
8
diff
changeset
|
56 mzml_file <- file.path(opt$mzML_file, filename) |
0
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
57 |
5
9ab472c5714c
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
1
diff
changeset
|
58 |
9ab472c5714c
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents:
1
diff
changeset
|
59 |
0
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
60 } |
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 (!is.null(opt$remove_nas)){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
63 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
|
64 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
65 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
66 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
|
67 im <- NULL |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
68 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
69 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
|
70 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
|
71 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
72 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
73 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
|
74 isotopes <- FALSE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
75 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
76 isotopes <- TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
77 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
78 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
79 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
80 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
81 if (is.null(opt$sim)){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
82 sim=FALSE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
83 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
84 sim=TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
85 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
86 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
87 minOffset = as.numeric(opt$minOffset) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
88 maxOffset = as.numeric(opt$maxOffset) |
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 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
92 if (opt$iwNorm=='none'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
93 iwNorm = FALSE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
94 iwNormFun = NULL |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
95 }else if (opt$iwNorm=='gauss'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
96 iwNorm = TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
97 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
|
98 }else if (opt$iwNorm=='rcosine'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
99 iwNorm = TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
100 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
|
101 }else if (opt$iwNorm=='QE5'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
102 iwNorm = TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
103 iwNormFun = msPurity::iwNormQE.5() |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
104 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
105 |
6
3d8bde261c95
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
5
diff
changeset
|
106 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
|
107 print(head(df)) |
8
f6996ad60d8f
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents:
7
diff
changeset
|
108 print(mzml_file) |
0
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
109 predicted <- msPurity::dimsPredictPuritySingle(df$mz, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
110 filepth=mzml_file, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
111 minOffset=minOffset, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
112 maxOffset=maxOffset, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
113 ppm=opt$ppm, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
114 mzML=TRUE, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
115 sim = sim, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
116 ilim = opt$ilim, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
117 isotopes = isotopes, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
118 im = im, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
119 iwNorm = iwNorm, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
120 iwNormFun = iwNormFun |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
121 ) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
122 predicted <- cbind(df, predicted) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
123 |
6
3d8bde261c95
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
5
diff
changeset
|
124 print(head(predicted)) |
3d8bde261c95
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents:
5
diff
changeset
|
125 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
|
126 write.table(predicted, file.path(opt$out_dir, 'anticipated_purity_dims.tsv'), row.names=FALSE, sep='\t') |