Genotypes-class: Genotypes class objects

Genotypes-classR Documentation

Genotypes class objects

Description

The Genotypes class stores genotype definitions in a convenient format.

Usage

Genotypes(
    ref = NA_character_, het = NA_character_, alt = NA_character_,
    suffix = c(ref="REF", het="HET", alt="ALT"))

Arguments

ref

A character vector declaring the encoding of homozygote reference genotypes.

het

A character vector declaring the encoding of heterozygote genotypes.

alt

A character vector declaring the encoding of homozygote alternate genotypes.

suffix

Set the individual INFO key suffixes used to store the statistics of homozygote reference, heterozygote, and homozygote alternate genotypes, in this order. See Details section.

Details

Genotypes may be initialised as NA_character_ and updated from an imported VCF object using the autodetectGenotypes method. This may be useful if genotype encodings are not known beforehand.

For each suffix stored in the Genotypes object, TVTB may store data in the VCF object under the INFO keys defined as follows:

suffix

Statistics across all samples in the ExpandedVCF (e.g. "MAF").

phenotype_level_suffix

Statistics across samples associated with a given level of a given phenotype (e.g. "gender_male_MAF").

Users are recommended to avoid using those INFO keys for other purposes.

Value

A Genotypes object that contains genotype definitions.

Accessor methods

In the following code snippets x is a Genotypes object.

ref(x), ref(x) <- value

Gets or sets the vector that declares homozygote reference genotypes.

het(x), het(x) <- value

Gets or sets the vector that declares heterozygote genotypes.

alt(x), alt(x) <- value

Gets or sets the vector that declares homozygote alternate genotypes.

genos(x)

Gets a vector of concatenated homozygote reference, heterozygote, and homozygote alternate genotypes. See also ref, het, alt, and carrier accessors.

carrier(x)

Gets a vector of concatenated heterozygote and homozygote alternate genotypes. See also het and alt accessors.

suffix(x)

Gets a named character vector that declares individual suffixes used to store the data for each set of genotypes in the INFO field of the VCF object. Names of this vector are ref, het, and alt.

Author(s)

Kevin Rue-Albrecht

See Also

VCF, TVTBparam, and addCountGenos-methods.

Examples

# Constructors ----

genotypes <- Genotypes("0|0", c("0|1", "1|0"), "1|1")


# Accessors ----

## Concatenated homozygote reference, heterozygote, and alternate heterozygote
## genotypes stored in the Genotypes object returned by the genos() accessor.
genos(genotypes)

## Individual genotypes can be extracted with ref(), het(), alt() accessors.
ref(genotypes)
het(genotypes)
alt(genotypes)

## Their individual INFO key suffixes can be extracted with suffix() accessors
## and the relevant name
suffix(genotypes)
suffix(genotypes)["ref"]
suffix(genotypes)["het"]
suffix(genotypes)["alt"]

## Concatenated heterozygote, and alternate heterozygote genotypes are
## returned by the carrier() accessor.
carrier(genotypes)
names(carrier(genotypes))

kevinrue/TVTB documentation built on July 9, 2024, 11:42 p.m.