Mantra.cpp

From Genome Analysis Wiki
Jump to navigationJump to search

Mantra.cpp provides useful functions handling inheritance vectors. A call to Mantra::Prepare() will first list all the meioses in a pedigree (which constitute an inheritance vector) and then list, among those, the key meioses that must be changed to traverse the space of all possible inheritance vectors.

Background

The meiosis that connect each individual to his (or her) parents can take two possible states, each denoting whether the grandmaternal or grandpaternal allele was transmitted. Listing all meiosis in a pedigree (there are possible meiosis) and then iterating over all possible outcomes for each meiosis (there are possible outcomes) completely specifies all the possible allele sharing patterns in a pedigree.

Details

To interpret the contents of an instance of the Mantra class, first assign each individual in the pedigree a unique integer id i. In Merlin, this identifier is always the value stored in Person::traverse. Further, assign each of the alleles carried by that individual unique integer id 2i and 2i + 1.

The descent of alleles through the pedigree is summarized in Mantra::vector and Mantra::state. For example, consider individual i = 5. This individual will carry two alleles and information about these will be stored in entries 2i = 10 and 2i + 1 = 11. For example, if Mantra::vector[10] = 7 and Mantra::vector[11] = 5 that would imply that these two alleles were copied from alleles '5' and '7' in the pedigree (the second allele in individuals 2 and 3 respectively). If Mantra::state[10] = 1 and Mantra::state[11] = 3, that would imply that the individual carries founder alleles 1 and 3.

Listing All Inheritance Vectors

The first 2f entries in Mantra::vector[] correspond to the founder alleles in the pedigree. The remaining entries correspond to meiosis that, ultimately, connect each individual (directly or indirectly). To list all possible inheritance vectors, one could iterate through entries in Mantra::vector with index greater than 2f + 1 and consider each of two possible states for each of these. In practice, many of these inheritance vectors would be equivalent because they would imply exactly the same pattern of allele sharing between individuals in the pedigree.

As an example, consider a pedigree with two siblings and two parents. The initial contents of Mantra::vector and Mantra::state might be:

     Mantra::vector[] = { 0, 1, 2, 3, 0, 2, 0, 2 }
     Mantra::state[]  = { 0, 1, 2, 3, 0, 2, 0, 2 }