homozygote {genetics} | R Documentation |
Extract Features of Genotype objects
Description
homozygote
creates an vector of logicals that are true when the
alleles of the corresponding observation are the identical.
heterozygote
creates an vector of logicals that are true when the
alleles of the corresponding observation differ.
carrier
create a logical vector or matrix of logicals
indicating whether the specified alleles are present.
allele.count
returns the number of copies of the specified
alleles carried by each observation.
allele
extract the specified allele(s) as a character vector
or a 2 column matrix.
allele.names
extract the set of allele names.
Usage
homozygote(x, allele.name, ...)
heterozygote(x, allele.name, ...)
carrier(x, allele.name, ...)
## S3 method for class 'genotype'
carrier(x, allele.name=allele.names(x),
any=!missing(allele.name), na.rm=FALSE, ...)
allele.count(x, allele.name=allele.names(x),any=!missing(allele.name),
na.rm=FALSE)
allele(x, which=c(1,2) )
allele.names(x)
Arguments
x |
|
... |
optional parameters (ignored) |
allele.name |
character value or vector of allele names |
any |
logical value. When |
na.rm |
logical value indicating whether to remove missing
values. When true, any |
which |
selects which allele to return. For first allele use
|
Details
When the allele.name
argument is given, heterozygote and
homozygote return TRUE
if exactly one or both alleles,
respectively, match the specified allele.name.
Value
homozygote
and heterozygote
return a vector of
logicals.
carrier
returns a logical vector if only one allele is
specified, or if any
is TRUE
. Otherwise, it returns
matrix of logicals with one row for each element of allele
.
allele.count
returns a vector of counts if only one allele is
specified, or if any
is TRUE
. Otherwise, it returns
matrix of counts with one row for each element of allele
.
allele
returns a character vector when one allele is
specified. When 2 alleles are specified, it returns a 2 column
character matrix.
allele.names
returns a character vector containing the set of
allele names.
Author(s)
Gregory R. Warnes greg@warnes.net
See Also
genotype
,
HWE.test
,
summary.genotype
,
locus
gene
marker
Examples
example.data <- c("D/D","D/I","D/D","I/I","D/D","D/D","D/D","D/D","I/I","")
g1 <- genotype(example.data)
g1
heterozygote(g1)
homozygote(g1)
carrier(g1,"D")
carrier(g1,"D",na.rm=TRUE)
# get count of one allele
allele.count(g1,"D")
# get count of each allele
allele.count(g1) # equivalent to
allele.count(g1, c("D","I"), any=FALSE)
# get combined count for both alleles
allele.count(g1,c("I","D"))
# get second allele
allele(g1,2)
# get both alleles
allele(g1)