Learn R Programming

gmapR (version 1.14.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, keep_ref_rows = FALSE, read_length = NA_integer_, high_nm_score = 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.
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.
high_nm_score
The value at which an NM value is considered high.
...
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.total
The total number of reads at that position, including reference and all alternates.
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.
count.del.plus
The plus strand deletion count over the position.
count.del.minus
The minus strand deletion count over the position.
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.
count.high.nm
The number of alt reads with an NM value at or above the high_nm_score cutoff.
count.high.nm.ref
The number of ref reads with an NM value at or above the high_nm_score cutoff.
If codon counting was enabled, there will be a column giving the codon strand: codon.strand.If the xs parameter was TRUE, there will be four additional columns giving the counts by aligner-determined strand: count.xs.plus, count.xs.plus.ref, count.xs.minus, and count.xs.minus.ref.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.