refFrac {SeqVarTools} | R Documentation

## Reference allele fraction

### Description

Calculate fraction of reference allele reads

### Usage

    ## S4 method for signature 'SeqVarGDSClass'
    refFrac(gdsobj, use.names=TRUE, parallel=FALSE)
    ## S4 method for signature 'SeqVarGDSClass'
    refFracOverHets(gdsobj, FUN=mean, use.names=TRUE, parallel=FALSE)
    ## S4 method for signature 'SeqVarGDSClass'
    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.
`parallel` | Logical, numeric, or other value to control parallel processing; see `seqParallel` for details.
`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`.

### 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.

### 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.

### Author(s)

Stephanie Gogarten

### See Also

`SeqVarGDSClass`, `applyMethod`

### Examples

    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)

[Package SeqVarTools version 1.28.1 Index]