bin.bw: Get read counts from BigWig coverage file

Description Usage Arguments Details Value Author(s)

View source: R/bin.bw.R

Description

Count the number of reads from a BigWig file in specified bins. By default the output bin counts are writtent into a file, which is then automatically compressed and indexed.

Usage

1
2
3
bin.bw(bw.file, bin.df, outfile.prefix = NULL, appendIndex.outfile = TRUE,
  chunk.size = 10000, check.chr.name = TRUE, no.checks = FALSE,
  read.length = 100, fromSummaries = TRUE)

Arguments

bw.file

the BigWig file

bin.df

a data.frame with the information about the bins. Columns 'chr', 'start' and 'end' are required.

outfile.prefix

the prefix of the name of the output file. The suffix '.bgz' will be appended to this name prefix after compression. In practice this is present in the output of 'init.filenames' function.

appendIndex.outfile

if TRUE (default), the results will be appended regularly on the output file which will be ultimately compressed and indexed. This is recommend when a large number of bins are analyzed. If FALSE, a data.frame with the bin counts will be returned and no file is created.

chunk.size

the number of bins to analyze at a time (for memory optimization). Default is 10 000. Reduce this number if memory problems arise.

check.chr.name

if TRUE (default), the function will try to check that the definition of chromosome (e.g. '1' vs 'chr1') are consistent between the bin definition and the BAM file. If FALSE, the analysis will continue either way.

no.checks

if TRUE, won't stop if there are no reads or the chromosome names are inconsistent. Default is FALSE.

read.length

the read length, to normalize the counts. Default is 100.

fromSummaries

should the count be derived from the BigWig summaries (much faster). Default is TRUE.

Details

By default, the function tries to check that the bin definition and the BAM file have compatible chromosome names. For example, 'chr1' in both or '1' in both. Moreover it will stop if no reads are found in the BAM file. To switch off these checks use 'no.checks=TRUE'.

Value

a list:

bc

the final output file name if 'appendIndex.outfile' was TRUE; a data.frame with the bin counts if not.

nb.reads

the number of reads counted.

Author(s)

Jean Monlong


jmonlong/PopSV documentation built on Sept. 15, 2019, 9:29 p.m.