Learn R Programming

SeqVarTools (version 1.10.0)

titv: Transition/Transversion Ratio

Description

Calculate transition/transversion ratio overall or by sample

Usage

"titv"(gdsobj, by.sample=FALSE, use.names=FALSE)

Arguments

gdsobj
A SeqVarGDSClass object with VCF data.
by.sample
A logical indicating whether TiTv should be calculated by sample or overall for the entire GDS object.
use.names
A logical indicating whether to assign sample IDs as names of the output vector (if by.sample=TRUE).

Value

A single value for TiTv if by.sample=FALSE. If by.sample=TRUE, a numeric vector containing TiTv for each sample.

Details

If by.sample=FALSE (the default), titv calulates the transition/transversion ratio (TiTv) over all samples.

If by.sample=TRUE, titv calculates TiTv over all variant genotypes (heterozygous or homozygous non-reference) for each sample.

See Also

SeqVarGDSClass, applyMethod, isVariant

Examples

Run this code
gds <- seqOpen(seqExampleFileName("gds"))
titv(gds)
titv(gds, by.sample=TRUE)

## apply to a subset of variants
library(GenomicRanges)
chrom <- seqGetData(gds, "chromosome")
pos22 <- seqGetData(gds, "position")[chrom == 22]
ranges <- GRanges(seqnames="22", IRanges(min(pos22), max(pos22)))
applyMethod(gds, titv, ranges)

seqClose(gds)

Run the code above in your browser using DataLab