Learn R Programming

selfingTree (version 0.2)

buildSelfingTree: Builds the probability tree

Description

This function builds the probability tree for recurrent selfing.

Usage

buildSelfingTree(genF,generation,gam1,gam2)

Arguments

genF
A function that generates a sub-tree of all possible genotypes given a parental genotype, either genSubtree.2M or genSubtree.3M.
generation
Integer giving the selfing generation to which the tree will be build. Values can range from 2 to 7, e.g., the F2 generation build by default and the highest possible generation is currently the F7.
gam1,gam2
Three (three marker genotypes) or two (two marker genotypes) character string with the configuration of gametes one and two of the parental F1 genotype.

Value

  • A recursive data type in the form of a nested list. Each element is a list with three elements. Element [[1]] holds the genotype configuration as "gam1-gam2" (e.g., "ABA-BAB"), element [[2]] the symbolic formula representing the probability of observing this genotype given the parental genotype and element [[3]] is again a list containing the sub-tree rooted at this genotype.

Examples

Run this code
## F2 and F3 genotypes
F.2M <- buildSelfingTree(genSubtree.2M,3,"AA","BB")

## F2 and F3 genotypes
F.3M <- buildSelfingTree(genSubtree.3M,3,"AAA","BBB")

Run the code above in your browser using DataLab