diff probecoverage.r @ 3:4f744d3aaf0b draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/probecoverage commit 8159fa0b4667a953c05aca50d412c33e619b5080
author artbio
date Sun, 24 Sep 2017 14:47:11 -0400
parents ebe5ec2e244d
children daec4df60281
line wrap: on
line diff
--- a/probecoverage.r	Sun Sep 24 13:34:16 2017 -0400
+++ b/probecoverage.r	Sun Sep 24 14:47:11 2017 -0400
@@ -12,6 +12,7 @@
     make_option("--xlab", type = "character", help="X-axis legend"),
     make_option("--ylab", type = "character", help="Y-axis legend"),
     make_option("--sample", type = "character", help="a space separated of sample labels"),
+    make_option("--method", type = "character", help="bedtools or pysam"),
     make_option(c("-o", "--output"), type = "character", help="path to the pdf plot")
     )
  
@@ -30,8 +31,11 @@
 }
 
 ## function
-
-cumul <- function(x,y) sum(Table[,y]/(Table$end-Table$start) > x)/length(Table$chromosome)
+if (args$method == 'bedtools') {
+    cumul <- function(x,y) sum(Table[,y]/(Table$end-Table$start) > x)/length(Table$chromosome)
+    } else {
+    cumul <- function(x,y) sum(Table[,y] > x)/length(Table$chromosome)
+    }
 scaleFUN <- function(x) sprintf("%.3f", x)
 
 ## end of function