annotate anticipated_purity_dims.R @ 22:c8b34df46dae draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 04023134d8f28e85927ca293373c506484149ead-dirty
author tomnl
date Fri, 01 Jun 2018 13:41:15 -0400
parents e05068fe15a1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
1 library(msPurity)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
2 library(optparse)
2
b83bcc259b76 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents: 0
diff changeset
3 print(sessionInfo())
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
4
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
5 option_list <- list(
dc00b7222a3c 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"),
dc00b7222a3c 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"),
dc00b7222a3c 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"),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
9 make_option("--minOffset", default=0.5),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
10 make_option("--maxOffset", default=0.5),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
11 make_option("--ilim", default=0.05),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
12 make_option("--ppm", default=4),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
13 make_option("--dimspy", action="store_true"),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
14 make_option("--sim", action="store_true"),
dc00b7222a3c 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"),
dc00b7222a3c 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
079bdef733e8 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
dc00b7222a3c 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"),
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
19 make_option("--isotope_matrix", type="character")
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
20 )
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
21
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
22 # store options
dc00b7222a3c 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))
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
24
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
25 print(sessionInfo())
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
26 print(opt)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
27
6
079bdef733e8 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents: 2
diff changeset
28 if (is.null(opt$dimspy)){
079bdef733e8 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents: 2
diff changeset
29
079bdef733e8 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')
079bdef733e8 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents: 2
diff changeset
31 filename = NA
14
e05068fe15a1 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
079bdef733e8 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents: 2
diff changeset
33 }else{
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
34 indf <- read.table(opt$peaks_file,
dc00b7222a3c 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
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
36
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
37
14
e05068fe15a1 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)){
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
39 mzml_file <- opt$mzML_file
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
40 }else{
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
41
e05068fe15a1 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]
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
43 print(filename)
e05068fe15a1 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
e05068fe15a1 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
e05068fe15a1 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]
e05068fe15a1 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])
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
48
e05068fe15a1 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)
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
50 print(filename)
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
51
e05068fe15a1 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)
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
53
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
54 }
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
55
11
2ccfae7470b3 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
dc00b7222a3c 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
e05068fe15a1 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
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
59 }
dc00b7222a3c 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'
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
61
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
62 if ('nan' %in% df$mz){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
63 df[df$mz=='nan',]$mz <- NA
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
64 }
dc00b7222a3c 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
e05068fe15a1 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
tomnl
parents: 11
diff changeset
66
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
67
6
079bdef733e8 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents: 2
diff changeset
68
079bdef733e8 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
tomnl
parents: 2
diff changeset
69
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
70 }
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
71
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
72 if (!is.null(opt$remove_nas)){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
73 df <- df[!is.na(df$mz),]
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
74 }
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
75
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
76 if (is.null(opt$isotope_matrix)){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
77 im <- NULL
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
78 }else{
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
79 im <- read.table(opt$isotope_matrix,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
80 header = TRUE, sep='\t', stringsAsFactors = FALSE)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
81 }
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
82
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
83 if (is.null(opt$exclude_isotopes)){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
84 isotopes <- FALSE
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
85 }else{
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
86 isotopes <- TRUE
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
87 }
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
88
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
89
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
90
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
91 if (is.null(opt$sim)){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
92 sim=FALSE
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
93 }else{
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
94 sim=TRUE
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
95 }
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
96
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
97 minOffset = as.numeric(opt$minOffset)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
98 maxOffset = as.numeric(opt$maxOffset)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
99
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
100
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
101
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
102 if (opt$iwNorm=='none'){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
103 iwNorm = FALSE
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
104 iwNormFun = NULL
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
105 }else if (opt$iwNorm=='gauss'){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
106 iwNorm = TRUE
dc00b7222a3c 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)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
108 }else if (opt$iwNorm=='rcosine'){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
109 iwNorm = TRUE
dc00b7222a3c 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)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
111 }else if (opt$iwNorm=='QE5'){
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
112 iwNorm = TRUE
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
113 iwNormFun = msPurity::iwNormQE.5()
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
114 }
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
115
7
4d2e58566178 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')
4d2e58566178 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents: 6
diff changeset
117 print(head(df))
10
bc108e873b97 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
tomnl
parents: 9
diff changeset
118 print(mzml_file)
0
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
119 predicted <- msPurity::dimsPredictPuritySingle(df$mz,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
120 filepth=mzml_file,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
121 minOffset=minOffset,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
122 maxOffset=maxOffset,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
123 ppm=opt$ppm,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
124 mzML=TRUE,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
125 sim = sim,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
126 ilim = opt$ilim,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
127 isotopes = isotopes,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
128 im = im,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
129 iwNorm = iwNorm,
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
130 iwNormFun = iwNormFun
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
131 )
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
132 predicted <- cbind(df, predicted)
dc00b7222a3c planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff changeset
133
7
4d2e58566178 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80
tomnl
parents: 6
diff changeset
134 print(head(predicted))
4d2e58566178 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'))
4d2e58566178 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')