Mercurial > repos > tomnl > assess_purity_msms
annotate frag4feature.R @ 23:c5ba85825284 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 04023134d8f28e85927ca293373c506484149ead-dirty
author | tomnl |
---|---|
date | Fri, 01 Jun 2018 15:28:32 -0400 |
parents | 6c8c4452b8ea |
children | 81c4fdfbcb5a |
rev | line source |
---|---|
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
1 library(optparse) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
2 library(msPurity) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
3 library(xcms) |
2
146699c00d38
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
1
diff
changeset
|
4 print(sessionInfo()) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
5 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
6 xset_pa_filename_fix <- function(opt, pa, xset){ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
7 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
8 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
9 if (!is.null(opt$mzML_files) && !is.null(opt$galaxy_names)){ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
10 # NOTE: Relies on the pa@fileList having the names of files given as 'names' of the variables |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
11 # needs to be done due to Galaxy moving the files around and screwing up any links to files |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
12 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
13 filepaths <- trimws(strsplit(opt$mzML_files, ',')[[1]]) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
14 filepaths <- filepaths[filepaths != ""] |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
15 new_names <- basename(filepaths) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
16 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
17 galaxy_names <- trimws(strsplit(opt$galaxy_names, ',')[[1]]) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
18 galaxy_names <- galaxy_names[galaxy_names != ""] |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
19 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
20 nsave <- names(pa@fileList) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
21 old_filenames <- basename(pa@fileList) |
4
7e633c70fdfc
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
2
diff
changeset
|
22 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
23 pa@fileList <- filepaths[match(names(pa@fileList), galaxy_names)] |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
24 names(pa@fileList) <- nsave |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
25 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
26 pa@puritydf$filename <- basename(pa@fileList[match(pa@puritydf$filename, old_filenames)]) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
27 pa@grped_df$filename <- basename(pa@fileList[match(pa@grped_df$filename, old_filenames)]) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
28 } |
4
7e633c70fdfc
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
2
diff
changeset
|
29 print(pa@fileList) |
7e633c70fdfc
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
2
diff
changeset
|
30 print(xset@filepaths) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
31 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
32 if(!all(basename(pa@fileList)==basename(xset@filepaths))){ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
33 if(!all(names(pa@fileList)==basename(xset@filepaths))){ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
34 print('FILELISTS DO NOT MATCH') |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
35 message('FILELISTS DO NOT MATCH') |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
36 quit(status = 1) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
37 }else{ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
38 xset@filepaths <- unname(pa@fileList) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
39 } |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
40 } |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
41 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
42 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
43 return(list(pa, xset)) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
44 } |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
45 |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
46 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
47 option_list <- list( |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
48 make_option(c("-o", "--out_dir"), type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
49 make_option("--pa", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
50 make_option("--xset", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
51 make_option("--ppm", default=10), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
52 make_option("--plim", default=0.0), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
53 make_option("--convert2RawRT", action="store_true"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
54 make_option("--mostIntense", action="store_true"), |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
55 make_option("--createDB", action="store_true"), |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
56 make_option("--cores", default=4), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
57 make_option("--mzML_files", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
58 make_option("--galaxy_names", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
59 make_option("--grp_peaklist", type="character") |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
60 ) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
61 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
62 # store options |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
63 opt<- parse_args(OptionParser(option_list=option_list)) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
64 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
65 loadRData <- function(rdata_path, name){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
66 #loads an RData file, and returns the named xset object if it is there |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
67 load(rdata_path) |
5
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
68 return(get(ls()[ls() %in% name])) |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
69 } |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
70 |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
71 # This function retrieve a xset like object |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
72 #@author Gildas Le Corguille lecorguille@sb-roscoff.fr |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
73 getxcmsSetObject <- function(xobject) { |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
74 # XCMS 1.x |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
75 if (class(xobject) == "xcmsSet") |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
76 return (xobject) |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
77 # XCMS 3.x |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
78 if (class(xobject) == "XCMSnExp") { |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
79 # Get the legacy xcmsSet object |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
80 suppressWarnings(xset <- as(xobject, 'xcmsSet')) |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
81 sampclass(xset) <- xset@phenoData$sample_group |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
82 return (xset) |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
83 } |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
84 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
85 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
86 # Requires |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
87 pa <- loadRData(opt$pa, 'pa') |
5
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
88 xset <- loadRData(opt$xset, c('xset','xdata')) |
faba6cd56875
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents:
4
diff
changeset
|
89 xset <- getxcmsSetObject(xset) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
90 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
91 pa@cores <- opt$cores |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
92 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
93 print(pa@fileList) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
94 print(xset@filepaths) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
95 |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
96 if(is.null(opt$mostIntense)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
97 mostIntense = FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
98 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
99 mostIntense = TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
100 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
101 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
102 if(is.null(opt$convert2RawRT)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
103 convert2RawRT = FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
104 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
105 convert2RawRT= TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
106 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
107 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
108 if(is.null(opt$createDB)){ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
109 createDB = FALSE |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
110 }else{ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
111 createDB = TRUE |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
112 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
113 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
114 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
115 fix <- xset_pa_filename_fix(opt, pa, xset) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
116 pa <- fix[[1]] |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
117 xset <- fix[[2]] |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
118 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
119 if(is.null(opt$grp_peaklist)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
120 grp_peaklist = NA |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
121 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
122 grp_peaklist = opt$grp_peaklist |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
123 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
124 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
125 print(pa@fileList) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
126 print(names(pa@fileList)) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
127 print(xset@filepaths) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
128 saveRDS(pa, 'test_pa.rds') |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
129 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
130 pa <- msPurity::frag4feature(pa=pa, xset=xset, ppm=opt$ppm, plim=opt$plim, |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
131 intense=opt$mostIntense, convert2RawRT=convert2RawRT, |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
132 db_name='alldata.sqlite', out_dir=opt$out_dir, grp_peaklist=grp_peaklist, |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
133 create_db=createDB) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
134 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
135 save(pa, file=file.path(opt$out_dir, 'frag4feature.RData')) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
136 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
137 print(head(pa@grped_df)) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
138 write.table(pa@grped_df, file.path(opt$out_dir, 'frag4feature.tsv'), row.names=FALSE, sep='\t') |