bin.bam.2d: Get read counts between pairs of bins from BAM file

Description Usage Arguments Details Value Author(s)

View source: R/bin.bam.2d.R

Description

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

Usage

1
2
3
bin.bam.2d(bam.file, bins.df, outfile.prefix = NULL,
  appendIndex.outfile = TRUE, chunk.size = 1000, check.chr.name = TRUE,
  no.checks = FALSE, bai.file = NULL)

Arguments

bam.file

the BAM file

bins.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 1000. 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.

bai.file

the index file of the BAM. If NULL it will be guessed.

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

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

Author(s)

Jean Monlong


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