calculateBamCoverageByInterval: Function to calculate coverage from BAM file

Description Usage Arguments Value Author(s) See Also Examples

View source: R/calculateBamCoverageByInterval.R

Description

Takes a BAM file and an interval file as input and returns coverage for each interval. Coverage should be then GC-normalized using the correctCoverageBias function before determining purity and ploidy with runAbsoluteCN. Uses the scanBam function and applies low quality, duplicate reads as well as secondary alignment filters.

Usage

1
2
3
4
5
6
7
8
calculateBamCoverageByInterval(
  bam.file,
  interval.file,
  output.file = NULL,
  index.file = bam.file,
  keep.duplicates = FALSE,
  ...
)

Arguments

bam.file

Filename of a BAM file.

interval.file

File specifying the intervals. Interval is expected in first column in format CHR:START-END.

output.file

Optionally, write minimal coverage file. Can be read with the readCoverageFile function.

index.file

The bai index. This is expected without the .bai file suffix, see ?scanBam.

keep.duplicates

Keep or remove duplicated reads.

...

Additional parameters passed to ScanBamParam.

Value

Returns total and average coverage by intervals.

Author(s)

Markus Riester

See Also

preprocessIntervals correctCoverageBias runAbsoluteCN

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
bam.file <- system.file("extdata", "ex1.bam", package = "PureCN",
    mustWork = TRUE)
interval.file <- system.file("extdata", "ex1_intervals.txt",
    package = "PureCN", mustWork = TRUE)

# Calculate raw coverage from BAM file. These need to be corrected for
# GC-bias using the correctCoverageBias function before determining purity
# and ploidy.
coverage <- calculateBamCoverageByInterval(bam.file = bam.file,
    interval.file = interval.file)

PureCN documentation built on Nov. 8, 2020, 5:37 p.m.