comparison anticipated_purity_dims.R @ 5:9ab472c5714c draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit afee93a926072b534bb3541e1524f1ad6a7decb9
author tomnl
date Mon, 23 Apr 2018 06:10:07 -0400
parents 1a88758357ed
children 3d8bde261c95
comparison
equal deleted inserted replaced
4:ff61a6fb23bf 5:9ab472c5714c
12 make_option("--ppm", default=4), 12 make_option("--ppm", default=4),
13 make_option("--dimspy", action="store_true"), 13 make_option("--dimspy", action="store_true"),
14 make_option("--sim", action="store_true"), 14 make_option("--sim", action="store_true"),
15 make_option("--remove_nas", action="store_true"), 15 make_option("--remove_nas", action="store_true"),
16 make_option("--iwNorm", default="none", type="character"), 16 make_option("--iwNorm", default="none", type="character"),
17 make_option("--dimspy_file_num", default=1), 17 make_option("--file_num_dimspy", default=1),
18 make_option("--exclude_isotopes", action="store_true"), 18 make_option("--exclude_isotopes", action="store_true"),
19 make_option("--isotope_matrix", type="character") 19 make_option("--isotope_matrix", type="character")
20 ) 20 )
21 21
22 # store options 22 # store options
23 opt<- parse_args(OptionParser(option_list=option_list)) 23 opt<- parse_args(OptionParser(option_list=option_list))
24 24
25 print(sessionInfo()) 25 print(sessionInfo())
26 print(opt) 26 print(opt)
27 27
28 if (opt$dimspy){ 28 if (is.null(opt$dimspy)){
29
30 df <- read.table(opt$peaks_file, header = TRUE, sep='\t')
31 filename = NA
32 }else{
29 indf <- read.table(opt$peaks_file, 33 indf <- read.table(opt$peaks_file,
30 header = TRUE, sep='\t', stringsAsFactors = FALSE) 34 header = TRUE, sep='\t', stringsAsFactors = FALSE)
31 filename = colnames(indf)[8:ncol(indf)][opt$dimspy_file_num] 35 filename = colnames(indf)[8:ncol(indf)][opt$dimspy_file_num]
32 # check if the data file is mzML or RAW (can only use mzML currently) so 36 # check if the data file is mzML or RAW (can only use mzML currently) so
33 # we expect an mzML file of the same name in the same folder 37 # we expect an mzML file of the same name in the same folder
47 df[df$mz=='nan',]$mz <- NA 51 df[df$mz=='nan',]$mz <- NA
48 } 52 }
49 df$mz <- as.numeric(df$mz) 53 df$mz <- as.numeric(df$mz)
50 54
51 55
52 }else{ 56
53 df <- read.table(opt$peaks_file, header = TRUE, sep='\t') 57
54 filename = NA
55 } 58 }
56 59
57 if (!is.null(opt$remove_nas)){ 60 if (!is.null(opt$remove_nas)){
58 df <- df[!is.na(df$mz),] 61 df <- df[!is.na(df$mz),]
59 } 62 }