830 - MarkovModel::Condition()

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

   double pmatch = (1. - e) + e * freq + backgroundError;
   double prandom = e * freq + backgroundError;

   for (int i = 0; i < states; i++)
      if (haplotypes[i][position] == observed)
         vector[i] *= pmatch;
      else
         vector[i] *= prandom;
   }