scan_genomic_contigs: scan genomic contigs in a BAM/CRAM file

View source: R/scan_genomic_contigs.R

scan_genomic_contigsR Documentation

scan genomic contigs in a BAM/CRAM file

Description

The default workflow for spiky is roughly as follows:

Usage

scan_genomic_contigs(
  bam,
  spike,
  param = NULL,
  bin = TRUE,
  binwidth = 300L,
  bins = NULL,
  standard = TRUE,
  genome = "hg38",
  ...
)

Arguments

bam

the BAM or CRAM filename, or a vector of them

spike

the spike-in reference database (e.g. data(spike))

param

a ScanBamParam object specifying which reads to count (NULL)

bin

Bin reads? (TRUE)

binwidth

width of the bins for chromosomal tiling (300)

bins

a pre-tiled GRanges for binning coverage (NULL)

standard

restrict non-spike contigs to "standard" chromosomes? (TRUE)

genome

Name of genome (default hg38)

...

additional arguments to pass to scanBamFlag()

Details

  1. Identify and quantify the spike-in contigs in an experiment.

  2. Fit a model for sequence-based abundance artifacts using the spike-ins.

  3. Quantify raw fragment abundance on genomic contigs, and adjust per step 2.

scan_genomic_contigs addresses the first half of step 3. The assumption is that anything which isn't a spike contig, is a genomic contig. This isn't necessarily true, so the user can also supply a ScanBamParam object for the param argument and restrict scanning to whatever contigs they wish, which also allows for non-default MAPQ, pairing, and quality filters.

If multiple BAM or CRAM filenames are provided, all indices will be checked before attempting to run through any of the files.

Value

     a CompressedGRangesList with bin- and spike-level coverage

See Also

    Rsamtools::ScanBamParam

Examples


library(Rsamtools)
data(spike, package="spiky")

fl <- system.file("extdata", "ex1.bam", package="Rsamtools",
                  mustWork=TRUE)
scan_genomic_contigs(fl, spike=spike,standard=FALSE) # will warn user about spike contigs

sb <- system.file("extdata", "example_chr21.bam", package="spiky",
                  mustWork=TRUE)
scan_genomic_contigs(sb, spike=spike) # will warn user about genomic contigs


trichelab/spiky documentation built on Sept. 17, 2022, 8:44 a.m.