Learn R Programming

genetics (version 1.3.8.1.3)

expectedGenotypes: Construct expected genotypes/haplotypes according to known allele variants

Description

expectedGenotypes constructs expected genotypes according to known allele variants, which can be quite tedious with large number of allele variants. It can handle different level of ploidy.

Usage

expectedGenotypes(x, alleles=allele.names(x), ploidy=2, sort=TRUE,
                  haplotype=FALSE)
expectedHaplotypes(x, alleles=allele.names(x), ploidy=2, sort=TRUE,
                   haplotype=TRUE)

Arguments

x

genotype or haplotype

alleles

character, vector of allele names

ploidy

numeric, number of chromosome sets i.e. 2 for human autosomal genes

sort

logical, sort genotypes according to order of alleles in alleles argument

haplotype

logical, construct haplotypes i.e. ordered genotype

Value

A character vector with genotype names as "alele1/alele2" for diploid example. Length of output is \((n*(n+1))/2\) for genotype (unordered genotype) and \(n*n\) for haplotype (ordered genotype) for \(n\) allele variants.

Details

expectedHaplotypes() just calls expectedGenotypes() with argument haplotype=TRUE.

See Also

allele.names, genotype

Examples

Run this code
# NOT RUN {
  ## On genotype
  prp <- c("ARQ/ARQ", "ARQ/ARQ", "ARR/ARQ", "AHQ/ARQ", "ARQ/ARQ")
  alleles <- c("ARR", "AHQ", "ARH", "ARQ", "VRR", "VRQ")
  expectedGenotypes(as.genotype(prp))
  expectedGenotypes(as.genotype(prp, alleles=alleles))
  expectedGenotypes(as.genotype(prp, alleles=alleles, reorder="yes"))

  ## Only allele names
  expectedGenotypes(alleles=alleles)
  expectedGenotypes(alleles=alleles, ploidy=4)

  ## Haplotype
  expectedHaplotypes(alleles=alleles)
  expectedHaplotypes(alleles=alleles, ploidy=4)[1:20]
# }

Run the code above in your browser using DataLab