comparison 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
comparison
equal deleted inserted replaced
2:35d2db3753d9 3:4f744d3aaf0b
10 make_option(c("-i", "--input"), type="character", help="Path to dataframe"), 10 make_option(c("-i", "--input"), type="character", help="Path to dataframe"),
11 make_option(c("-t", "--title"), type="character", help="Main Title"), 11 make_option(c("-t", "--title"), type="character", help="Main Title"),
12 make_option("--xlab", type = "character", help="X-axis legend"), 12 make_option("--xlab", type = "character", help="X-axis legend"),
13 make_option("--ylab", type = "character", help="Y-axis legend"), 13 make_option("--ylab", type = "character", help="Y-axis legend"),
14 make_option("--sample", type = "character", help="a space separated of sample labels"), 14 make_option("--sample", type = "character", help="a space separated of sample labels"),
15 make_option("--method", type = "character", help="bedtools or pysam"),
15 make_option(c("-o", "--output"), type = "character", help="path to the pdf plot") 16 make_option(c("-o", "--output"), type = "character", help="path to the pdf plot")
16 ) 17 )
17 18
18 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) 19 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list)
19 args = parse_args(parser) 20 args = parse_args(parser)
28 headers <- c(headers, samples[[1]][i]) 29 headers <- c(headers, samples[[1]][i])
29 colnames(Table) <- headers 30 colnames(Table) <- headers
30 } 31 }
31 32
32 ## function 33 ## function
33 34 if (args$method == 'bedtools') {
34 cumul <- function(x,y) sum(Table[,y]/(Table$end-Table$start) > x)/length(Table$chromosome) 35 cumul <- function(x,y) sum(Table[,y]/(Table$end-Table$start) > x)/length(Table$chromosome)
36 } else {
37 cumul <- function(x,y) sum(Table[,y] > x)/length(Table$chromosome)
38 }
35 scaleFUN <- function(x) sprintf("%.3f", x) 39 scaleFUN <- function(x) sprintf("%.3f", x)
36 40
37 ## end of function 41 ## end of function
38 ## let's do a dataframe before plotting 42 ## let's do a dataframe before plotting
39 maxdepth <- trunc(max(Table[,5:length(Table)]/(Table$end-Table$start))) + 20 43 maxdepth <- trunc(max(Table[,5:length(Table)]/(Table$end-Table$start))) + 20