Mercurial > repos > tomnl > assess_purity_msms
annotate frag4feature.R @ 1:c694d8172abf draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
author | tomnl |
---|---|
date | Tue, 27 Mar 2018 05:41:35 -0400 |
parents | b6b051e7a5ef |
children | 146699c00d38 |
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) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
4 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
5 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
|
6 |
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 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
|
9 # 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
|
10 # 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
|
11 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
12 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
|
13 filepaths <- filepaths[filepaths != ""] |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
14 new_names <- basename(filepaths) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
15 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
16 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
|
17 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
|
18 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
19 nsave <- names(pa@fileList) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
20 old_filenames <- basename(pa@fileList) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
21 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
|
22 names(pa@fileList) <- nsave |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
23 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
24 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
|
25 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
|
26 } |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
27 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
28 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
29 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
|
30 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
|
31 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
|
32 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
|
33 quit(status = 1) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
34 }else{ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
35 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
|
36 } |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
37 } |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
38 |
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 return(list(pa, xset)) |
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 |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
43 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
44 option_list <- list( |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
45 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
|
46 make_option("--pa", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
47 make_option("--xset", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
48 make_option("--ppm", default=10), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
49 make_option("--plim", default=0.0), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
50 make_option("--convert2RawRT", action="store_true"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
51 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
|
52 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
|
53 make_option("--cores", default=4), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
54 make_option("--mzML_files", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
55 make_option("--galaxy_names", type="character"), |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
56 make_option("--grp_peaklist", type="character") |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
57 ) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
58 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
59 # store options |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
60 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
|
61 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
62 loadRData <- function(rdata_path, name){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
63 #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
|
64 load(rdata_path) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
65 return(get(ls()[ls() == name])) |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
66 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
67 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
68 # Requires |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
69 pa <- loadRData(opt$pa, 'pa') |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
70 xset <- loadRData(opt$xset, 'xset') |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
71 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
72 pa@cores <- opt$cores |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
73 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
74 print(pa@fileList) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
75 print(xset@filepaths) |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
76 |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
77 if(is.null(opt$mostIntense)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
78 mostIntense = FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
79 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
80 mostIntense = TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
81 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
82 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
83 if(is.null(opt$convert2RawRT)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
84 convert2RawRT = FALSE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
85 }else{ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
86 convert2RawRT= TRUE |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
87 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
88 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
89 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
|
90 createDB = FALSE |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
91 }else{ |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
92 createDB = TRUE |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
93 } |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
94 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
95 |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
96 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
|
97 pa <- fix[[1]] |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
98 xset <- fix[[2]] |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
99 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
100 if(is.null(opt$grp_peaklist)){ |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
101 grp_peaklist = NA |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
102 |
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
103 |
0
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 grp_peaklist = opt$grp_peaklist |
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 print('heck') |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
109 print(pa@fileList) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
110 print(names(pa@fileList)) |
0
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
111 print(xset@filepaths) |
1
c694d8172abf
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
0
diff
changeset
|
112 saveRDS(pa, 'test_pa.rds') |
0
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 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
|
115 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
|
116 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
|
117 create_db=createDB) |
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 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
|
120 |
b6b051e7a5ef
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f9591483bef88aef71a9f0cc0ffc75cf6eab480c
tomnl
parents:
diff
changeset
|
121 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
|
122 write.table(pa@grped_df, file.path(opt$out_dir, 'frag4feature.tsv'), row.names=FALSE, sep='\t') |