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