comparison probecoverage.r @ 1:ebe5ec2e244d draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/probecoverage commit 0d963d33685a407873cd17924c7ec2b6255b006f
author artbio
date Sat, 23 Sep 2017 12:56:17 -0400
parents dbeb4a0abfc6
children 4f744d3aaf0b
comparison
equal deleted inserted replaced
0:dbeb4a0abfc6 1:ebe5ec2e244d
30 } 30 }
31 31
32 ## function 32 ## function
33 33
34 cumul <- function(x,y) sum(Table[,y]/(Table$end-Table$start) > x)/length(Table$chromosome) 34 cumul <- function(x,y) sum(Table[,y]/(Table$end-Table$start) > x)/length(Table$chromosome)
35 scaleFUN <- function(x) sprintf("%.3f", x)
35 36
36 ## end of function 37 ## end of function
37 ## let's do a dataframe before plotting 38 ## let's do a dataframe before plotting
38 maxdepth <- trunc(max(Table[,5:length(Table)]/(Table$end-Table$start))) + 20 39 maxdepth <- trunc(max(Table[,5:length(Table)]/(Table$end-Table$start))) + 20
39 graphpoints <- data.frame(1:maxdepth) 40 graphpoints <- data.frame(1:maxdepth)
48 graphpoints <- melt(graphpoints, id.vars="Depth", variable.name="Samples", value.name="sample_value") 49 graphpoints <- melt(graphpoints, id.vars="Depth", variable.name="Samples", value.name="sample_value")
49 50
50 ## GRAPHS 51 ## GRAPHS
51 52
52 pdf(file=args$output) 53 pdf(file=args$output)
53 ggplot(data=graphpoints, aes(x=Depth, y=sample_value, group=Samples, colour=Samples)) + 54 ggplot(data=graphpoints, aes(x=Depth, y=sample_value, colour=Samples)) +
54 geom_line(size=1) + 55 geom_line(size=1) +
55 scale_x_continuous(trans='log2', breaks = 2^(seq(0,log(maxdepth, 2)))) + 56 scale_x_continuous(trans='log2', breaks = 2^(seq(0,log(maxdepth, 2)))) +
56 scale_y_continuous(breaks = seq(0, maxfrac, by=maxfrac/10)) + 57 scale_y_continuous(breaks = seq(0, maxfrac, by=maxfrac/10), labels=scaleFUN) +
57 labs(x=args$xlab, y=args$ylab, title=args$title) + 58 labs(x=args$xlab, y=args$ylab, title=args$title) +
58 theme(legend.position="top", legend.title=element_blank(), legend.text=element_text(colour="blue", size=7)) 59 theme(legend.position="top", legend.title=element_blank(), legend.text=element_text(colour="blue", size=7))
60
61
62 ## facet_wrap(~Samples, ncol=2)
59 63
60 devname=dev.off() 64 devname=dev.off()
61 65