Learn R Programming

gmapR (version 1.8.0)

bam_tally-methods: Per-position Alignment Summaries

Description

Given a set of alignments, for each position in the genome output counts for the reference allele and all alternate alleles. Often used as a precursor to detecting variants. Indels will be supported soon.

Usage

"bam_tally"(x, param, ...) "bam_tally"(x, param, ...) variantSummary(x, read_pos_breaks = NULL, high_base_quality = 0L, keep_ref_rows = FALSE, read_length = NA_integer_)

Arguments

x
a BamFile object or string path to a BAM file to read
param
The BamTallyParam object with parameters for the tally operation.
read_pos_breaks
The breaks, like those passed to cut for aggregating the per-read position counts. If NULL, no per-cycle counts are returned.
high_base_quality
The minimum mapping quality for a read to be counted as high quality.
keep_ref_rows
Whether to keep the rows describing only the reference calls, i.e., where ref and alt are the same. These are useful when one needs the reference counts even when there are no alts at that position.
read_length
The expected read length. If the read length is NA, the MDFNE (median distance from nearest end) statistic will NOT be calculated.
...
Arguments that override settings in param.

Value

The bam_tally function returns an opaque pointer to a C-level data structure with the class “TallyIIT”. Currently, the only operation applicable to this object is variantSummary.The variantSummary function returns a VRanges, with a range for each position that passed the filters. The depth columns correspond to the counts after quality filtering (except for indels, for which there is no quality filtering). The following elementMetadata columns are also present:
n.read.pos
The number of unique read positions for the alt allele.
n.read.pos.ref
The number of unique read positions for the ref allele.
raw.count
The number of reads with the alternate allele, NA for the reference allele row.
raw.count.ref
The number of reads with the reference allele.
raw.count.total
The total number of reads at that position, including reference and all alternates.
mean.quality
The mean base quality for the alt allele, truncated at high_base_quality.
mean.quality.ref
The mean base quality for the ref allele, truncated at high_base_quality.
count.plus
The number of positive strand reads for the alternate allele, NA for the reference allele row.
count.plus.ref
The number of positive strand reads for the reference allele.
count.minus
The number of negative strand reads for the alternate allele, NA for the reference allele row.
count.minus.ref
The number of negative strand reads for the reference allele.
read.pos.mean
Mean read position for the alt allele.
read.pos.mean.ref
Mean read position for the ref allele.
read.pos.var
Variance in the read positions for the alt allele.
read.pos.var.ref
Variance in the read positions for the ref allele.
mdfne
Median distance from nearest end for the alt allele.
mdfne.ref
Median distance from nearest end for the ref allele.
An additional column is present for each bin formed by the read_pos_breaks parameter, with the read count for that bin.

See Also

tallyVariants in the VariantTools package provides a high-level wrapper for this functionality.