binReads {chromstaR} | R Documentation |
Convert aligned reads in .bam or .bed(.gz) format into read counts in equidistant windows.
binReads(file, experiment.table = NULL, ID = NULL, assembly, bamindex = file, chromosomes = NULL, pairedEndReads = FALSE, min.mapq = 10, remove.duplicate.reads = TRUE, max.fragment.width = 1000, blacklist = NULL, binsizes = 1000, stepsizes = binsizes/2, reads.per.bin = NULL, bins = NULL, variable.width.reference = NULL, use.bamsignals = TRUE, format = NULL)
file |
A file with aligned reads. Alternatively a |
experiment.table |
An |
ID |
Optional ID to select a row from the |
assembly |
Please see |
bamindex |
BAM index file. Can be specified without the .bai ending. If the index file does not exist it will be created and a warning is issued. |
chromosomes |
If only a subset of the chromosomes should be binned, specify them here. |
pairedEndReads |
Set to |
min.mapq |
Minimum mapping quality when importing from BAM files. Set |
remove.duplicate.reads |
A logical indicating whether or not duplicate reads should be removed. |
max.fragment.width |
Maximum allowed fragment length. This is to filter out erroneously wrong fragments due to mapping errors of paired end reads. |
blacklist |
A |
binsizes |
An integer vector specifying the bin sizes to use. |
stepsizes |
An integer vector specifying the step size. One number can be given for each element in |
reads.per.bin |
Approximate number of desired reads per bin. The bin size will be selected accordingly. |
bins |
A |
variable.width.reference |
A BAM file that is used as reference to produce variable width bins. See |
use.bamsignals |
If |
format |
One of |
Convert aligned reads from .bam or .bed(.gz) files into read counts in equidistant windows (bins). This function uses GenomicRanges::countOverlaps
to calculate the read counts, or alternatively bamsignals::bamProfile
if option use.bamsignals
is set (only effective for .bam files).
If only one bin size was specified for option binsizes
, the function returns a single GRanges-class
object with meta data column 'counts' that contains the read count. If multiple binsizes
were specified , the function returns a named list()
of GRanges-class objects.
## Get an example BAM file with ChIP-seq reads file <- system.file("extdata", "euratrans", "lv-H3K27me3-BN-male-bio2-tech1.bam", package="chromstaRData") ## Bin the file into bin size 1000bp data(rn4_chrominfo) data(experiment_table) binned <- binReads(file, experiment.table=experiment_table, assembly=rn4_chrominfo, binsizes=1000, stepsizes=500, chromosomes='chr12') print(binned)