barplot.bam: Draw/calculate a barplot showing the length distribution of...

Description Usage Arguments Details Value Author(s) See Also Examples

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

Description

This function counts the occurrence of reads of a given size range mapping to the positive and negative strands of a reference sequence.

Generally, users of viRome may be interested in how many 21-22bp (viRNA) and 24-29bp (piRNA) reads align to the reference genome, on both the positive and negative strand.

Usage

1
2
barplot.bam(vdf = NULL, minlen = 1, maxlen = 37, poscol="red", negcol="green", main = "Sequence length distribution", xlab = "Map length", ylab = "Count", legend = c("+ve strand", "-ve strand"),
legendx = NULL, legendy = NULL, plot=TRUE, down=FALSE, sym.axes=TRUE,  ...)

Arguments

vdf

A data.frame as produced by read.bam and clip.bam

minlen

The minimum length of aligned read to consider

maxlen

The maximum length of aligned read to consider

poscol

The colour of the "positive" bars. Defaults to "red"

negcol

The colour of the "negative" bars. Defaults to "green"

main

Title for the plot

xlab

Labels for the x-axis

ylab

Labels for the y-axis

legend

Vector of text for the positive and negative strand in the legend

legendx

The x location for the legend

legendy

The y location for the legend

plot

Whether or not to draw a plot. Set this to "FALSE" to suppress plotting.

down

Whether or not the plot for the negative strand should be plotted downwards. Defaults to FALSE.

sym.axes

If down is TRUE, this determines whether the x-axis is symmetrical around zero. Defaults to TRUE

...

Further parameters to pass to the barplot function

Details

A barplot is plotted, and the summarised data returned as a data.frame. Set plot=FALSE to suppress plotting.

Value

A barplot is plotted, and the data returned as a data.frame

lgth

The length of the aligned read

pos

Count of alignments on the positive strand

neg

Count of alignments on the negative strand

Author(s)

Mick Watson

See Also

read.bam, clip.bam

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 ## 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: bi <- barplot.bam(vdf=bamc, minlen=1, maxlen=37)
 ## Not run: bi

 ## Not run: bp <- barplot.bam(bamc)
 ## Not run: bp <- barplot.bam(bamc, down=TRUE)


 ## Not run: bp <- barplot.bam(bamc, space=c(0,0))
 ## Not run: bp <- barplot.bam(bamc, down=TRUE, space=c(0,0))


 ## Not run: bp <- barplot.bam(bamc, down=TRUE, space=c(0,0), minlen=17, maxlen=36, legendx=17)

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