position.barplot: Plot a barplot of alignments across a genome

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

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

Description

For a given reference, plot the counts of alignments of reads of a given size-range along the positive and negative strands

Usage

1
position.barplot(vdf = NULL, minlen = 1, maxlen = 37, reflen = 10000, samp = "", plot=TRUE, poscol="red", negcol-"green")

Arguments

vdf

A data.frame as output from read.bam and clip.bam

minlen

The shortest read/alignment to include. The beginning of the range of read sizes you wish to count.

maxlen

The longest read/alignment to include. The maxlen of the range of read sizes you wish to count.

reflen

The length of the reference. You should probably know this, if you performed the alignment; otherwise it will be in the header of the SAM/BAM file

samp

The sample name associated with the data - to be used in the title of the resulting graph

plot

Whether or not to create a plot using default settings. Set to FALSE to suppress the plot. The data to allow you to draw your own graph will be returned anyway.

poscol

The colour of the positive bars. Default: "red"

negcol

The colour of the negative bars. Default: "green"

Details

This function calculates counts of the occurrence of reads/alignments of a given size-range across a genome. The x-axis is the genome position, the y-axis is the count, and bars point upwards for the positive strand, and downwards for the negative strand.

Plots a barplot to the current device and also returns a data.frame of the results. Plotting can be turned off with "plot=FALSE"

The value used for the position is the most 5' minlen of the alignment relative to the positive strand of the reference.

Value

Plots a barplot to the current device and also returns a data.frame of the results

position

The position in the reference

poscount

Count on the positive strand

negcount

Count on the negative strand

Author(s)

Mick Watson

See Also

barplot.bam, clip.bam

Examples

1
2
3
4
5
6
## Not run: infile <- system.file("data/SRR389184_vs_SINV_sorted.bam", package="viRome")
## Not run: bam <- read.bam(bamfile=infile, chr="SINV", minlen=1, maxlen=11703, removeN=TRUE)
## Not run: bamc <- clip.bam(bam)

## Not run: bi <- position.barplot(vdf=bamc, minlen=21, maxlen=22, reflen=11703, samp="SRR389184")
## Not run: bi

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