comparison filter.R @ 4:3fcbb8030fcc draft

"planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 40eda5ea3551e8b3bae32d0a8f405fe90ef22646-dirty"
author sblanck
date Mon, 12 Apr 2021 14:47:09 +0000
parents 4d539083cf7f
children
comparison
equal deleted inserted replaced
3:94fc6ed13946 4:3fcbb8030fcc
13 make_option("--output",type="character",default=NULL, dest="output"), 13 make_option("--output",type="character",default=NULL, dest="output"),
14 make_option("--new_file_path",type="character",default=NULL, dest="new_file_path"), 14 make_option("--new_file_path",type="character",default=NULL, dest="new_file_path"),
15 make_option("--nbcall",type="character",default=NULL, dest="nbcall"), 15 make_option("--nbcall",type="character",default=NULL, dest="nbcall"),
16 make_option("--length",type="character",default=NULL, dest="length"), 16 make_option("--length",type="character",default=NULL, dest="length"),
17 make_option("--probes",type="character",default=NULL, dest="probes"), 17 make_option("--probes",type="character",default=NULL, dest="probes"),
18 make_option("--settings_signal",type="character",default=NULL, dest="settings_signal"),
18 make_option("--outputlog",type="character",default=NULL, dest="outputlog"), 19 make_option("--outputlog",type="character",default=NULL, dest="outputlog"),
19 make_option("--log",type="character",default=NULL, dest="log") 20 make_option("--log",type="character",default=NULL, dest="log")
20 ); 21 );
21 22
22 opt_parser = OptionParser(option_list=option_list); 23 opt_parser = OptionParser(option_list=option_list);
33 output=opt$output 34 output=opt$output
34 tmp_dir=opt$new_file_path 35 tmp_dir=opt$new_file_path
35 nbcall=opt$nbcall 36 nbcall=opt$nbcall
36 length=as.numeric(opt$length) 37 length=as.numeric(opt$length)
37 probes=as.numeric(opt$probes) 38 probes=as.numeric(opt$probes)
39 signal=opt$settings_signal
38 log=opt$log 40 log=opt$log
39 outputlog=opt$outputlog 41 outputlog=opt$outputlog
40 42
41 if (outputlog){ 43 if (outputlog){
42 sinklog <- file(log, open = "wt") 44 sinklog <- file(log, open = "wt")
45 } 47 }
46 48
47 nbcall_tmp <- strsplit(nbcall,",") 49 nbcall_tmp <- strsplit(nbcall,",")
48 nbcall_vecstring <-unlist(nbcall_tmp) 50 nbcall_vecstring <-unlist(nbcall_tmp)
49 51
50 nbcall_vecstring
51
52 library(MPAgenomics) 52 library(MPAgenomics)
53 workdir=file.path(tmp_dir, "mpagenomics") 53 workdir=file.path(tmp_dir)
54 if (!dir.exists(workdir))
55 dir.create(workdir, showWarnings = TRUE, recursive = TRUE)
54 setwd(workdir) 56 setwd(workdir)
55 57
56 segcall = read.table(input, header = TRUE) 58 segcall = read.table(input, header = TRUE)
57 filtercall=filterSeg(segcall,length,probes,nbcall_vecstring) 59 if (signal=="fracB") {
60 segcall=cbind(segcall,calls=rep("normal",nrow(segcall)))
61 filtercall=filterSeg(segcall,length,probes,nbcall_vecstring)
62 filtercall=filtercall[,1:(ncol(filtercall)-1)]
63 } else {
64 filtercall=filterSeg(segcall,length,probes,nbcall_vecstring)
65 }
58 #sink(output) 66 #sink(output)
59 #print(format(filtercall),row.names=FALSE) 67 #print(format(filtercall),row.names=FALSE)
60 #sink() 68 #sink()
61 if (outputlog){ 69 if (outputlog){
62 sink(type="output") 70 sink(type="output")