variableWidthBins | R Documentation |
Make variable-width bins based on a reference BAM file. This can be a simulated file (produced by simulateReads
and aligned with your favourite aligner) or a real reference.
variableWidthBins(reads, binsizes, stepsizes = NULL, chromosomes = NULL)
reads |
A |
binsizes |
A vector with binsizes. Resulting bins will be close to the specified binsizes. |
stepsizes |
A vector of step sizes in base pairs, the same length as |
chromosomes |
A subset of chromosomes for which the bins are generated. |
Variable-width bins are produced by first binning the reference BAM file with fixed-width bins and selecting the desired number of reads per bin as the (non-zero) maximum of the histogram. A new set of bins is then generated such that every bin contains the desired number of reads.
A list()
of GRanges-class
objects with variable-width bins. If stepsizes
is specified, a list()
of GRangesList
objects with one entry per step.
Aaron Taudt
## Get an example BED file with single-cell-sequencing reads
bedfile <- system.file("extdata", "KK150311_VI_07.bam.bed.gz", package="AneuFinderData")
## Read the file into a GRanges object
reads <- bed2GRanges(bedfile, assembly='mm10', chromosomes=c(1:19,'X','Y'),
min.mapq=10, remove.duplicate.reads=TRUE)
## Make variable-width bins of size 500kb and 1Mb
bins <- variableWidthBins(reads, binsizes=c(5e5,1e6))
## Plot the distribution of binsizes
hist(width(bins[['binsize_1e+06']]), breaks=50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.