annotate size_histogram.r @ 0:234b83159ea8 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
author artbio
date Tue, 11 Jul 2017 11:44:36 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
1 ## Setup R error handling to go to stderr
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
2 options( show.error.messages=F,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
3 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
4 library(RColorBrewer)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
5 library(lattice)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
6 library(latticeExtra)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
7 library(grid)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
8 library(gridExtra)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
9 library(optparse)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
10
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
11 # Parse arguments
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
12 option_list <- list(
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
13 make_option(c("-g", "--global"), type="character", help="Whether distribution is plotted globally or by chromosome"),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
14 make_option(c("-s", "--size_distribution_tab"), type="character", help="Path to file with tabular size distribution"),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
15 make_option("--size_distribution_pdf", type="character", help="Path to file with size distribution plot"),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
16 make_option("--title", type="character", help="Title for readmaps and size distribution"),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
17 make_option("--ylabel", type="character", help="ylabel for readmaps and size distribution"),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
18 make_option("--yrange", type="integer", help="Y-axis range"),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
19 make_option("--rows_per_page", type="integer", help="rows_per_page")
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
20 )
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
21
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
22 parser <- OptionParser(usage = "%prog [options] file", option_list=option_list)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
23 args = parse_args(parser)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
24
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
25 ##cheetahtemplate data frame implementation
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
26 size=read.delim(args$size_distribution_tab, header=T, row.names=NULL)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
27 n_samples = length(unique (size$sample))
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
28 n_genes = length (unique (levels(size$gene)))
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
29
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
30 if (args$yrange != 0) {
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
31 # This is used for specifying the y-axis limits
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
32 ylim=c(-args$yrange, args$yrange)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
33 } else { ylim="" }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
34
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
35 par.settings.size=list(layout.heights=list(top.padding=1, bottom.padding=1),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
36 strip.background = list(col = c("lightblue", "lightgreen"))
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
37 )
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
38
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
39 smR.prepanel=function(x,y,...){; yscale=c(-max(abs(y)), max(abs(y)));list(ylim=yscale);} # use if one want y axis in the middle of the plot
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
40
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
41 plot_size_distribution = function(df, ...) {
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
42 bc= barchart(count~as.factor(size)|factor(sample, levels=unique(sample))+gene, data = df, origin = 0,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
43 horizontal=FALSE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
44 group=polarity,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
45 stack=TRUE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
46 col=c('red', 'blue'),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
47 cex=0.75,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
48 scales=list(y=list(tick.number=4, rot=90, relation="free", cex=0.5, alternating=T), x=list(cex=.6 ) ),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
49 xlab = "readsize in nucleotides",
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
50 ylab = args$ylabel,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
51 main = args$title,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
52 par.strip.text = list(cex=0.75),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
53 as.table=TRUE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
54 newpage = T,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
55 ...)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
56
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
57 combineLimits(update(useOuterStrips(bc,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
58 strip.left = strip.custom(par.strip.text = list(cex=0.5))
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
59 ),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
60 layout=c(n_samples,args$rows_per_page)),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
61 margin.x=F, margin.y=1)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
62 }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
63
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
64 # per_gene_size=lapply(genes, function(x) subset(size, gene==x)) # no object in this script
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
65
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
66 if (args$global == "no") {
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
67 width = 8.2677*n_samples/4
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
68 } else { width = 8.2677 }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
69
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
70 options(warn=-1)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
71 pdf(file=args$size_distribution_pdf, paper="special", height=11.69, width=width)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
72
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
73 if (ylim == "" && args$global=="no") {
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
74 plot_size_distribution(size, par.settings=par.settings.size)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
75 }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
76 if (ylim != "" && args$global=="no") { plot_size_distribution(size, par.settings=par.settings.size, ylim=ylim)
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
77 }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
78 if (ylim == "" && args$global=="yes") { bc= barchart(count~as.factor(size)|factor(sample, levels=unique(sample)),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
79 data = size, origin = 0,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
80 horizontal=FALSE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
81 group=polarity,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
82 stack=TRUE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
83 col=c('red', 'blue'),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
84 scales=list(y=list(tick.number=4, rot=90, relation="same"), cex=1),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
85 xlab = "readsize in nucleotides",
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
86 ylab = args$ylabel,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
87 main = args$title, as.table=TRUE, newpage = T,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
88 aspect=0.5,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
89 strip = strip.custom(par.strip.text = list(cex = 1), which.given=1, bg="lightblue")
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
90 )
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
91 bc
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
92 }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
93 if (ylim != "" && args$global=="yes") { bc= barchart(count~as.factor(size)|factor(sample, levels=unique(sample)),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
94 data = size, origin = 0,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
95 horizontal=FALSE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
96 group=polarity,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
97 stack=TRUE,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
98 col=c('red', 'blue'),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
99 scales=list(y=list(tick.number=4, rot=90, relation="same"), cex=1),
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
100 xlab = "readsize in nucleotides",
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
101 ylab = args$ylabel,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
102 ylim = ylim,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
103 main = args$title, as.table=TRUE, newpage = T,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
104 aspect=0.5,
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
105 strip = strip.custom(par.strip.text = list(cex = 1), which.given=1, bg="lightblue")
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
106 )
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
107 bc
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
108 }
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
109
234b83159ea8 planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/small_read_size_histograms commit ab983b2e57321e8913bd4d5f8fc89c3223c69869
artbio
parents:
diff changeset
110 devname=dev.off()