830 - Haplotyper::ScoreLeftConditional() (smart, complicated)
From Genome Analysis Wiki
Revision as of 14:31, 2 October 2013 by Goncalo (talk | contribs) (Goncalo moved page 830 - Haplotyper::ScoreLeftConditional smart() to 830 - Haplotyper::ScoreLeftConditional() (smart, complicated): Consistency.)
// This version of the ScoreLeftConditional() function deals with sites
// where no genotypes are observed a little more efficiently.
//
void Haplotyper::ScoreLeftConditional()
{
ResetMemoryPool();
GetMemoryBlock(0);
SetupPrior(leftMatrices[0]);
ConditionOnData(leftMatrices[0], 0, current_genotypes[0]);
double theta = 0.0;
float *from = leftMatrices[0];
for (int i = 1; i < markers; i++)
{
// Cumulative recombination fraction allows us to skip uninformative positions
theta = theta + thetas[i - 1] - theta * thetas[i - 1];
// Skip over uninformative positions to save time
if (current_genotypes[i] != GENOTYPE_MISSING || i == markers - 1)
{
GetMemoryBlock(i);
Transpose(from, leftMatrices[i], theta);
ConditionOnData(leftMatrices[i], i, current_genotypes[i]);
theta = 0;
from = leftMatrices[i];
}
}
}