Difference between revisions of "830 - Haplotyper::ImputeGenotypes()"

From Genome Analysis Wiki
Jump to navigationJump to search
(Created page with "</source lang="cpp"> void Haplotyper::ImputeGenotypes() { RewindMemoryPool(); // Process the last position RetrieveMemoryBlock(markers - 1); ImputeGenotypes(le...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
</source lang="cpp">
+
<source lang="cpp">
 
void Haplotyper::ImputeGenotypes()
 
void Haplotyper::ImputeGenotypes()
 
   {
 
   {
Line 20: Line 20:
 
       Transpose(from, to, thetas[i]);
 
       Transpose(from, to, thetas[i]);
  
       // Find nearest informative marker
+
       RetrieveMemoryBlock(i);
      double theta = 0.0;
 
      int left = i;
 
  
       while (left > 0 && genotypes[states / 2][left] == GENOTYPE_MISSING)
+
       ImputeGenotypes(leftMatrices[i], to, i);
        {
 
        // Cumulative recombination fraction to nearest marker
 
        theta = theta + thetas[left - 1] - theta * thetas[left - 1];
 
        left--;
 
        }
 
 
 
      RetrieveMemoryBlock(left);
 
      float * leftMatrix = leftMatrices[left];
 
 
 
      if (left != i)
 
        {
 
        Transpose(leftMatrix, from, theta);
 
        leftMatrix = from;
 
        }
 
 
 
      ImputeGenotypes(leftMatrix, to, i);
 
 
       ConditionOnData(to, i, genotypes[states / 2][i]);
 
       ConditionOnData(to, i, genotypes[states / 2][i]);
  

Latest revision as of 14:19, 2 October 2013

void Haplotyper::ImputeGenotypes()
   {
   RewindMemoryPool();

   // Process the last position
   RetrieveMemoryBlock(markers - 1);
   ImputeGenotypes(leftMatrices[markers - 1], markers - 1);

   SetupPrior(rightMatrices[0]);
   ConditionOnData(rightMatrices[0], 0, current_genotypes[0]);

   float *temp;
   float *from = rightMatrices[0];
   float *to = rightMatrices[1];

   for (int i = markers - 2; i >= 0; i--)
      {
      // Move things along
      Transpose(from, to, thetas[i]);

      RetrieveMemoryBlock(i);

      ImputeGenotypes(leftMatrices[i], to, i);
      ConditionOnData(to, i, genotypes[states / 2][i]);

      temp = from;
      from = to;
      to = temp;
      }
   }