stacked.barplot: Produce a stacked barplot from the output of...

Description Usage Arguments Value Note Author(s) Examples

View source: R/viRome_functions.R View source: R/stacked.barplot.R

Description

The function produces a barplot for each read length showing the number of mapped reads of that read length at each position of the reference genome. One barplot will be plotted for each read length. The current graphical device will be used, and the function split.screen is used to produce the graphic

Usage

1
stacked.barplot(dm = NULL, minlen = 1, maxlen = 37, start = 1, end = 1e+07, internal.margins = c(0, 0, 0, 1), skip.x = 2, bicol=NULL, col.fun = rainbow, axis.col = "black", main.col = "black", main.adj = 1, samey=FALSE, ...)

Arguments

dm

The output of summarise.by.length

minlen

The minimum length of aligned read to consider

maxlen

The maximum length of aligned read to consider

start

The minimum start position to consider

end

The maximum start position to consider

internal.margins

The margins for each plot. See par. A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot.

skip.x

Only plot an x-axis every skip.x plots

bicol

Set this equal to a vector of two colours e.g. bicol=c("red","blue") and alterate graphs will take on the alternate colours. Unless this is NULL (the default), col.fun is ignored.

col.fun

A colour function to produce colours for the barplots. Defaults to rainbow

axis.col

A colour for the x-axis

main.col

A colour for the title of each plot (which will be the read length)

main.adj

Whether to plot the title left-justified (main.adj=0), centre-justified (main.adj=0.5) or right-justified (main.adj=1)

samey

Whether or not all barplots should have the same y-axis. If set to TRUE, all barplots will have ylim=c(min(dm),max(dm)). If set to FALSE, each barplot will have its y-axis set individually

...

Further graphical paramters to be passed to the plot() function

Value

A plot is drawn on the current graphical device

Note

When one draws multiple plots stacked one on top of another, one rapidly runs out of space vertically. Warnings are issued to this effect. If you run out of space, or receive errors to that effect, please use a plotting device such as png, jpeg, or pdf, and be sure to provide enough height to the device

Author(s)

Mick Watson <mick.watson@roslin.ed.ac.uk>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 ## Not run: infile <- system.file("data/SRR389184_vs_SINV_sorted.bam", package="viRome")
 ## Not run: bam <- read.bam(bamfile=infile, chr="SINV", start=1, end=11703, removeN=TRUE)
 ## Not run: bamc <- clip.bam(bam)
 ## Not run: dm <- summarise.by.length(bamc)

## Not run: stacked.barplot(dm)

## Not run: stacked.barplot(dm, internal.margins=c(0,2,0,1))

## Not run: stacked.barplot(dm, internal.margins=c(0,2,0,1), skip.x=4, main.adj=0.5)
	

mw55309/viRome_legacy documentation built on Dec. 21, 2021, 11:05 p.m.