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

From Genome Analysis Wiki
Jump to navigationJump to search
(Created page with "<source code="cpp"> void Haplotyper::ConditionOnData(float * matrix, int marker, char genotype) { // We treat missing genotypes as uninformative about the mosaic's //...")
 
 
Line 1: Line 1:
<source code="cpp">
+
<source lang="cpp">
 
void Haplotyper::ConditionOnData(float * matrix, int marker, char genotype)
 
void Haplotyper::ConditionOnData(float * matrix, int marker, char genotype)
 
   {
 
   {

Latest revision as of 14:58, 13 September 2013

void Haplotyper::ConditionOnData(float * matrix, int marker, char genotype)
   {
   // We treat missing genotypes as uninformative about the mosaic's
   // underlying state. If we were to allow for deletions and the like,
   // that may no longer be true.
   if (genotype == GENOTYPE_MISSING)
      return;

   for (int i = 0; i < states; i++)
      {
      double factors[2];

      factors[0] = Penetrance(marker, haplotypes[i][marker], genotype);
      factors[1] = Penetrance(marker, haplotypes[i][marker] + 1, genotype);

      for (int j = 0; j <= i; j++, matrix++)
         *matrix *= factors[haplotypes[j][marker]];
      }
   }