coverageBams: Coverage

View source: R/bioinfo_sequences.R

coverageBamsR Documentation

Coverage

Description

Calculate the breadth (fraction of the genome that is covered by reads) and depth (average number of times each position in the genome has been sequenced) of coverage from a set of BAM file(s) (see Molnar & Ilie (2015)). Results are identical to those from samtools depth.

Usage

coverageBams(
  bamFiles,
  yieldSize = 10^4,
  seq.ids = NULL,
  out.file = NULL,
  max.depth = 10^4,
  min.base.quality = 1,
  min.mapq = 5,
  min.nucleotide.depth = 1,
  distinguish.strands = FALSE,
  distinguish.nucleotides = FALSE,
  ignore.query.Ns = FALSE,
  include.deletions = FALSE,
  include.insertions = FALSE,
  is.paired = NA,
  is.proper.pair = NA,
  is.unmapped.query = FALSE,
  has.unmapped.mate = NA,
  is.minus.strand = NA,
  is.mate.minus.strand = NA,
  is.first.mate.read = NA,
  is.second.mate.read = NA,
  is.secondary.align = FALSE,
  is.not.passing.qc = FALSE,
  is.dupl = FALSE,
  verbose = 1,
  nb.cores = 1
)

Arguments

bamFiles

vector of paths to BAM file(s), each of them having an index file with the same name but finishing by ".bai"; if there are several BAM files, all of them should contain reads aligned on the same set of sequences (i.e. the same reference genome)

yieldSize

number of records to yield each time the file is read from (see BamFile)

seq.ids

sequence identifier(s) to focus on, e.g. "chr2" or c("chr2","chr5"); if NULL, all of them

out.file

if not NULL, the output will be transformed into a data.frame and written into the given file

max.depth

see PileupParam

min.base.quality

see PileupParam

min.mapq

see PileupParam

min.nucleotide.depth

see PileupParam

distinguish.strands

see PileupParam

distinguish.nucleotides

see PileupParam

ignore.query.Ns

see PileupParam

include.deletions

see PileupParam

include.insertions

see PileupParam

is.paired

see scanBamFlag

is.proper.pair

see scanBamFlag

is.unmapped.query

see scanBamFlag

has.unmapped.mate

see scanBamFlag

is.minus.strand

see scanBamFlag

is.mate.minus.strand

see scanBamFlag

is.first.mate.read

see scanBamFlag

is.second.mate.read

see scanBamFlag

is.secondary.align

see scanBamFlag

is.not.passing.qc

see scanBamFlag

is.dupl

see scanBamFlag

verbose

verbosity level (0/1/2)

nb.cores

the number of cores to use to parallelize over bamFiles, i.e. at most how many child processes will be run simultaneously (not on Windows)

Value

list with one component per BAM file, each being a matrix with columns "nb.bases", "mapped.bases", "count.sum", "breadth", "depth" and "depth.map" (corresponding to the depth at positions with at least one mapped read)

Author(s)

Timothee Flutre (with the help of Martin Morgan)

See Also

freadBedtoolsCoverageHist


timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.