binReads | R Documentation |
Convert aligned reads in .bam or .bed(.gz) format into read counts in equidistant windows.
binReads(file, assembly, ID = basename(file), bamindex = file,
chromosomes = NULL, pairedEndReads = FALSE, min.mapq = 10,
remove.duplicate.reads = TRUE, max.fragment.width = 1000,
blacklist = NULL, outputfolder.binned = "binned_data", binsizes = 1e+06,
stepsizes = NULL, reads.per.bin = NULL, reads.per.step = NULL,
bins = NULL, variable.width.reference = NULL, save.as.RData = FALSE,
calc.complexity = TRUE, call = match.call(), reads.store = FALSE,
outputfolder.reads = "data", reads.return = FALSE,
reads.overwrite = FALSE, reads.only = FALSE, use.bamsignals = FALSE)
file |
A file with aligned reads. Alternatively a |
assembly |
Please see |
ID |
An identifier that will be used to identify the file throughout the workflow and in plotting. |
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 |
outputfolder.binned |
Folder to which the binned data will be saved. If the specified folder does not exist, it will be created. |
binsizes |
An integer vector with bin sizes. If more than one value is given, output files will be produced for each bin size. |
stepsizes |
A vector of step sizes the same length as |
reads.per.bin |
Approximate number of desired reads per bin. The bin size will be selected accordingly. Output files are produced for each value. |
reads.per.step |
Approximate number of desired reads per step. |
bins |
A named |
variable.width.reference |
A BAM file that is used as reference to produce variable width bins. See |
save.as.RData |
If set to |
calc.complexity |
A logical indicating whether or not to estimate library complexity. |
call |
The |
reads.store |
If |
outputfolder.reads |
Folder to which the read fragments will be saved. If the specified folder does not exist, it will be created. |
reads.return |
If |
reads.overwrite |
Whether or not an existing file with read fragments should be overwritten. |
reads.only |
If |
use.bamsignals |
If |
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.
The function produces a list()
of GRanges-class
or GRangesList
objects with meta data columns 'counts', 'mcounts', 'pcounts' that contain the total, minus and plus read count. This binned data will be either written to file (save.as.RData=FALSE
) or given as return value (save.as.RData=FALSE
).
binning
## Get an example BED file with single-cell-sequencing reads
bedfile <- system.file("extdata", "KK150311_VI_07.bam.bed.gz", package="AneuFinderData")
## Bin the BED file into bin size 1Mb
binned <- binReads(bedfile, assembly='mm10', binsize=1e6,
chromosomes=c(1:19,'X','Y'))
print(binned)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.