diff 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
line wrap: on
line diff
--- a/filter.R	Tue Jun 16 04:34:09 2020 -0400
+++ b/filter.R	Mon Apr 12 14:47:09 2021 +0000
@@ -15,6 +15,7 @@
 		make_option("--nbcall",type="character",default=NULL, dest="nbcall"),
 		make_option("--length",type="character",default=NULL, dest="length"),
 		make_option("--probes",type="character",default=NULL, dest="probes"),
+		make_option("--settings_signal",type="character",default=NULL, dest="settings_signal"),
 		make_option("--outputlog",type="character",default=NULL, dest="outputlog"),
 		make_option("--log",type="character",default=NULL, dest="log")
 	);
@@ -35,6 +36,7 @@
 nbcall=opt$nbcall
 length=as.numeric(opt$length)
 probes=as.numeric(opt$probes)
+signal=opt$settings_signal
 log=opt$log
 outputlog=opt$outputlog
 
@@ -47,14 +49,20 @@
 nbcall_tmp <- strsplit(nbcall,",")
 nbcall_vecstring <-unlist(nbcall_tmp)
 
-nbcall_vecstring
-
 library(MPAgenomics)
-workdir=file.path(tmp_dir, "mpagenomics")
+workdir=file.path(tmp_dir)
+if (!dir.exists(workdir))
+  dir.create(workdir, showWarnings = TRUE, recursive = TRUE)
 setwd(workdir)
 
 segcall = read.table(input, header = TRUE)
-filtercall=filterSeg(segcall,length,probes,nbcall_vecstring)
+if (signal=="fracB") {
+	segcall=cbind(segcall,calls=rep("normal",nrow(segcall)))
+	filtercall=filterSeg(segcall,length,probes,nbcall_vecstring)
+        filtercall=filtercall[,1:(ncol(filtercall)-1)]
+} else {
+	filtercall=filterSeg(segcall,length,probes,nbcall_vecstring)
+}
 #sink(output)
 #print(format(filtercall),row.names=FALSE)
 #sink()