830 - MarkovModel::CountErrors()

From Genome Analysis Wiki
Revision as of 14:57, 25 September 2013 by Goncalo (talk | contribs) (Created page with "<source lang="cpp"> double MarkovModel::CountErrors(float * vector, char ** haplotypes, int position, char observed, double e, double freq) { if (observed == 0) re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
double MarkovModel::CountErrors(float * vector, char ** haplotypes, int position, char observed, double e, double freq)
   {
   if (observed == 0)
      return e;

   double match = 0;
   double mismatch = 0;

   for (int i = 0; i < states; i++)
      if (haplotypes[i][position] == observed)
         match += vector[i];
      else
         mismatch += vector[i];

   mismatch = (match + mismatch) * e * freq;
   match *= 1.0 - e;

   return mismatch / (mismatch + match);
   }