annotate track_rt_raw.R @ 14:69d5cb5a8e90 draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535-dirty
author tomnl
date Sun, 13 May 2018 09:39:56 -0400
parents ff61a6fb23bf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
1 library(optparse)
4
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
2
1
1a88758357ed planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents: 0
diff changeset
3 print(sessionInfo())
1a88758357ed planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents: 0
diff changeset
4
0
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
5 option_list <- list(
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
6 make_option(c("--xset_path"), type="character"),
4
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
7 make_option(c("-o", "--out_dir"), type="character"),
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
8 make_option(c("--extract_peaks"), action="store_true")
0
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
9 )
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
10
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
11 # store options
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
12 opt<- parse_args(OptionParser(option_list=option_list))
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
13
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
14 load(opt$xset_path)
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
15
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
16 print(xset)
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
17
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
18 rtraw <- xset@peaks[,c('rt', 'rtmin', 'rtmax')]
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
19 colnames(rtraw) <- c('rt_raw','rtmin_raw','rtmax_raw')
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
20 xset@peaks <- cbind(xset@peaks, rtraw)
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
21
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
22
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
23 print('saving RData')
fe7d7cc95ca5 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2e847122cf605951c334858455fc1d3ebdb189e9-dirty
tomnl
parents:
diff changeset
24 save.image(file.path(opt$out_dir, 'xset_rt_raw_tracked.RData'))
4
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
25
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
26 if(!is.null(opt$extract_peaks)){
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
27 write.table(xset@peaks, file.path(opt$out_dir, 'xset_peaks.tsv'), row.names=FALSE, sep='\t')
ff61a6fb23bf planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 9ea2ca0892fa55c21491c93afba790e8d9427e01-dirty
tomnl
parents: 1
diff changeset
28 }