Learn R Programming

SeqVarTools (version 1.10.0)

refFrac: Reference allele fraction

Description

Calculate fraction of reference allele reads

Usage

"refFrac"(gdsobj, use.names=TRUE) "refFracOverHets"(gdsobj, FUN=mean, use.names=TRUE) "refFracPlot"(gdsobj, variant.id, highlight=NULL, ...)

Arguments

gdsobj
A SeqVarGDSClass object with VCF data.
FUN
The function to apply over heterozygote calls (mean or median).
use.names
A logical indicating whether to assign variant or samples IDs as names of the output vector.
variant.id
A vector of variant.ids to plot.
highlight
A list of sample.ids to highlight with sequential integers on each plot
...
Additional arguments passed to plot.

Value

refFrac returns a sample by variant array of the reference allele fraction, defined as ref_depth / total_depth.refFracOverHets returns the mean (or other function, e.g. median) of reference allele depth (per variant) over all samples called as heterozygotes.

Details

The variable "annotation/format/AD" (allelic depth) is required to compute the reference allele fraction.

refFracPlot generates plots of total unfiltered depth (sum over "AD" for all alleles) versus reference allele fraction. Points are color-coded by called genotype: teal = reference homozygote, orange = heterozygote including the reference allele, fuschia = heterozygote with two alternate alleles, purple = alternate homozygote, black = missing. Darker colors indicate a higher density of points. Vertical black line is at 0.5, vertical orange line is the median reference allele fraction for ref/alt heterozygotes. Values significantly different from 0.5 (after applying a Bonferroni correction) are plotted with triangles.

See Also

SeqVarGDSClass, applyMethod

Examples

Run this code
gdsfile <- system.file("extdata", "hapmap_exome_chr22.gds", package="SeqVarTools")
gds <- seqOpen(gdsfile)
RF <- refFrac(gds)
dim(RF)
samples <- seqGetData(gds, "sample.id")
refFracPlot(gds, variant.id=5:6, 
            highlight=list(samples[2:3], samples[4:5]))
seqClose(gds)

Run the code above in your browser using DataLab