Difference between revisions of "830 - MarkovModel::CountErrors()"

From Genome Analysis Wiki
Jump to navigationJump to search
(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...")
 
(No difference)

Latest revision as of 14:57, 25 September 2013

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);
   }