Mercurial > repos > tomnl > create_sqlite_db
annotate anticipated_purity_dims.R @ 0:fe7d7cc95ca5 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
author | tomnl |
---|---|
date | Tue, 27 Mar 2018 06:03:50 -0400 |
parents | |
children | 1a88758357ed |
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) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
3 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
4 option_list <- list( |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
5 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
|
6 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
|
7 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
|
8 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
|
9 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
|
10 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
|
11 make_option("--ppm", default=4), |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
12 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
|
13 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
|
14 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
|
15 make_option("--iwNorm", default="none", type="character"), |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
16 make_option("--dimspy_file_num", default=1), |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
17 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
|
18 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
|
19 ) |
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 # store options |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
22 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
|
23 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
24 print(sessionInfo()) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
25 print(opt) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
26 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
27 if (opt$dimspy){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
28 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
|
29 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
|
30 filename = colnames(indf)[8:ncol(indf)][opt$dimspy_file_num] |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
31 # 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
|
32 # 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
|
33 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
|
34 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
|
35 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
36 filename = sub("raw", "mzML", filename, ignore.case = TRUE) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
37 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
38 df <- indf[4:nrow(indf),] |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
39 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
|
40 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
|
41 } |
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 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
|
44 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
45 if ('nan' %in% df$mz){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
46 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
|
47 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
48 df$mz <- as.numeric(df$mz) |
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 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
51 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
52 df <- read.table(opt$peaks_file, header = TRUE, sep='\t') |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
53 filename = 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 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
56 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
|
57 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
|
58 } |
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 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
|
61 im <- NULL |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
62 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
63 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
|
64 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
|
65 } |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
66 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
67 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
|
68 isotopes <- FALSE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
69 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
70 isotopes <- TRUE |
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 print('FIRST ROWS OF PEAK FILE') |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
74 print(head(df)) |
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 (dir.exists(opt$mzML_file)){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
77 # if directory then we need to add a file name |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
78 print(filename) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
79 if (is.na(filename)){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
80 print('ERROR: If a directory is provided then a filename needs to be entered |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
81 directory or automatically obtained by using a dimspy output') |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
82 quit() |
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 mzml_file <- file.path(opt$mzML_file, filename) |
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 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
87 mzml_file <- opt$mzML_file |
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 if (is.null(opt$sim)){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
91 sim=FALSE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
92 }else{ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
93 sim=TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
94 } |
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 minOffset = as.numeric(opt$minOffset) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
97 maxOffset = as.numeric(opt$maxOffset) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
98 |
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 if (opt$iwNorm=='none'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
102 iwNorm = FALSE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
103 iwNormFun = NULL |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
104 }else if (opt$iwNorm=='gauss'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
105 iwNorm = TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
106 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
|
107 }else if (opt$iwNorm=='rcosine'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
108 iwNorm = TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
109 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
|
110 }else if (opt$iwNorm=='QE5'){ |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
111 iwNorm = TRUE |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
112 iwNormFun = msPurity::iwNormQE.5() |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
113 } |
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 |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
116 predicted <- msPurity::dimsPredictPuritySingle(df$mz, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
117 filepth=mzml_file, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
118 minOffset=minOffset, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
119 maxOffset=maxOffset, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
120 ppm=opt$ppm, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
121 mzML=TRUE, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
122 sim = sim, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
123 ilim = opt$ilim, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
124 isotopes = isotopes, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
125 im = im, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
126 iwNorm = iwNorm, |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
127 iwNormFun = iwNormFun |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
128 ) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
129 predicted <- cbind(df, predicted) |
fe7d7cc95ca5
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff
changeset
|
130 |
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 write.table(predicted, file.path(opt$out_dir, 'anticipated_dims_purity.tsv'), row.names=FALSE, sep='\t') |