bam.cov.tile: Get coverage as GRanges from BAM on genome tiles across...

View source: R/bamUtils.R

bam.cov.tileR Documentation

Get coverage as GRanges from BAM on genome tiles across seqlengths of genome

Description

Quick way to get tiled coverage via piping to samtools (e.g. ~10 CPU-hours for 100bp tiles, 5e8 read pairs)

Gets coverage for window size "window" [bp], pulling "chunksize" records at a time and incrementing bin corresponding to midpoint or overlaps of corresponding (proper pair) fragment (uses TLEN and POS for positive strand reads that are part of a proper pair)

Usage

bam.cov.tile(
  bam.file,
  window = 100,
  chunksize = 1e+05,
  min.mapq = 30,
  reference = NULL,
  verbose = TRUE,
  max.tlen = 10000,
  st.flag = "-f 0x02 -F 0x10",
  fragments = TRUE,
  do.gc = FALSE,
  midpoint = TRUE,
  bai = NULL
)

Arguments

bam.file

string Input BAM file

window

integer Window size (in bp) (default = 1e2)

chunksize

integer Size of window (default = 1e5)

min.mapq

integer Minimim map quality reads to consider for counts (default = 30)

reference

path to reference FASTA recommended if CRAM file is provided [NULL]

verbose

boolean Flag to increase vebosity (default = TRUE)

max.tlen

integer Maximum paired-read insert size to consider (default = 1e4)

st.flag

string Samtools flag to filter reads on (default = '-f 0x02 -F 0x10')

fragments

boolean flag (default = FALSE) detremining whether to compute fragment (i.e. proper pair footprint aka insert) density or read density

do.gc

boolean Flag to execute garbage collection via 'gc()' (default = FALSE)

midpoint

boolean Flag if TRUE will only use the fragment midpoint, if FALSE will count all bins that overlap the fragment (default = TRUE)

Value

GRanges of "window" bp tiles across seqlengths of bam.file with meta data field $counts specifying fragment counts centered (default = TRUE) in the given bin.

Author(s)

Marcin Imielinski


mskilab/bamUtils documentation built on Sept. 28, 2022, 3:45 p.m.