Mercurial > repos > computational-metabolomics > mspurity_createdatabase
annotate purityA.R @ 0:f52287a06c02 draft
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
| author | computational-metabolomics | 
|---|---|
| date | Wed, 27 Nov 2019 13:44:58 -0500 | 
| parents | |
| children | 600a866a510c | 
| rev | line source | 
|---|---|
| 
0
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
1 library(msPurity) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
2 library(optparse) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
3 print(sessionInfo()) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
4 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
5 option_list <- list( | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
6 make_option(c("-o", "--out_dir"), type="character"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
7 make_option("--mzML_files", type="character"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
8 make_option("--galaxy_names", type="character"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
9 make_option("--minOffset", default=0.5), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
10 make_option("--maxOffset", default=0.5), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
11 make_option("--ilim", default=0.05), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
12 make_option("--iwNorm", default="none", type="character"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
13 make_option("--exclude_isotopes", action="store_true"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
14 make_option("--isotope_matrix", type="character"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
15 make_option("--mostIntense", action="store_true"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
16 make_option("--plotP", action="store_true"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
17 make_option("--nearest", action="store_true"), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
18 make_option("--cores", default=4), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
19 make_option("--ppmInterp", default=7) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
20 ) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
21 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
22 opt <- parse_args(OptionParser(option_list=option_list)) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
23 print(opt) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
24 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
25 minOffset = as.numeric(opt$minOffset) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
26 maxOffset = as.numeric(opt$maxOffset) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
27 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
28 if (opt$iwNorm=='none'){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
29 iwNorm = FALSE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
30 iwNormFun = NULL | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
31 }else if (opt$iwNorm=='gauss'){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
32 iwNorm = TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
33 iwNormFun = msPurity::iwNormGauss(minOff=-minOffset, maxOff=maxOffset) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
34 }else if (opt$iwNorm=='rcosine'){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
35 iwNorm = TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
36 iwNormFun = msPurity::iwNormRcosine(minOff=-minOffset, maxOff=maxOffset) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
37 }else if (opt$iwNorm=='QE5'){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
38 iwNorm = TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
39 iwNormFun = msPurity::iwNormQE.5() | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
40 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
41 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
42 filepaths <- trimws(strsplit(opt$mzML_files, ',')[[1]]) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
43 filepaths <- filepaths[filepaths != ""] | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
44 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
45 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
46 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
47 if(is.null(opt$minOffset) || is.null(opt$maxOffset)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
48 offsets = NA | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
49 }else{ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
50 offsets = as.numeric(c(opt$minOffset, opt$maxOffset)) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
51 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
52 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
53 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
54 if(is.null(opt$mostIntense)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
55 mostIntense = FALSE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
56 }else{ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
57 mostIntense = TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
58 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
59 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
60 if(is.null(opt$nearest)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
61 nearest = FALSE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
62 }else{ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
63 nearest = TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
64 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
65 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
66 if(is.null(opt$plotP)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
67 plotP = FALSE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
68 plotdir = NULL | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
69 }else{ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
70 plotP = TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
71 plotdir = opt$out_dir | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
72 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
73 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
74 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
75 if (is.null(opt$isotope_matrix)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
76 im <- NULL | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
77 }else{ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
78 im <- read.table(opt$isotope_matrix, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
79 header = TRUE, sep='\t', stringsAsFactors = FALSE) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
80 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
81 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
82 if (is.null(opt$exclude_isotopes)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
83 isotopes <- FALSE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
84 }else{ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
85 isotopes <- TRUE | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
86 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
87 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
88 pa <- msPurity::purityA(filepaths, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
89 cores = opt$cores, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
90 mostIntense = mostIntense, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
91 nearest = nearest, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
92 offsets = offsets, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
93 plotP = plotP, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
94 plotdir = plotdir, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
95 interpol = "linear", | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
96 iwNorm = iwNorm, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
97 iwNormFun = iwNormFun, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
98 ilim = opt$ilim, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
99 mzRback = "pwiz", | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
100 isotopes = isotopes, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
101 im = im, | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
102 ppmInterp = opt$ppmInterp) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
103 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
104 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
105 if (!is.null(opt$galaxy_names)){ | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
106 galaxy_names <- trimws(strsplit(opt$galaxy_names, ',')[[1]]) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
107 galaxy_names <- galaxy_names[galaxy_names != ""] | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
108 names(pa@fileList) <- galaxy_names | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
109 } | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
110 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
111 print(pa) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
112 save(pa, file=file.path(opt$out_dir, 'purityA_output.RData')) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
113 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
114 pa@puritydf$filename <- sapply(pa@puritydf$fileid, function(x) names(pa@fileList)[as.integer(x)]) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
115 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
116 print(head(pa@puritydf)) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
117 write.table(pa@puritydf, file.path(opt$out_dir, 'purityA_output.tsv'), row.names=FALSE, sep='\t') | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
118 | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
119 # removed_peaks <- data.frame(removed_peaks) | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
120 # write.table(data.frame('ID'=rownames(removed_peaks),removed_peaks), | 
| 
 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 
computational-metabolomics 
parents:  
diff
changeset
 | 
121 # file.path(opt$out_dir, 'removed_peaks.txt'), row.names=FALSE, sep='\t') | 
