830 - Haplotyper::ImputeGenotypes() (internal)

From Genome Analysis Wiki
Revision as of 14:28, 2 October 2013 by Goncalo (talk | contribs) (Created page with "void Haplotyper::ImputeGenotypes(float * matrix1, float * matrix2, int marker) { posterior[0][marker] = posterior[1][marker] = posterior[2][marker] = 0.0; for (int i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

void Haplotyper::ImputeGenotypes(float * matrix1, float * matrix2, int marker)

  {
  posterior[0][marker] = posterior[1][marker] = posterior[2][marker] = 0.0;
  for (int i = 0; i < states; i++, matrix1++, matrix2++)
     {
     if (haplotypes[i][marker])
        for (int j = 0; j < i; j++, matrix1++, matrix2++)
           posterior[haplotypes[j][marker] + 1][marker] += *matrix1 * *matrix2 * 0.5;
        else
     for (int j = 0; j < i; j++, matrix1++, matrix2++)
        posterior[haplotypes[j][marker]][marker] += *matrix1 * *matrix2 * 0.5;
     posterior[haplotypes[i][marker] * 2][marker] += *matrix1 * *matrix2;
     }
  }