830 - MarkovModel::Condition(): Difference between revisions
From Genome Analysis Wiki
Jump to navigationJump to search
Created page with "<source lang="cpp"> void MarkovModel::Condition(float * vector, char ** haplotypes, int position, char observed, double e, double freq) { if ..." |
No edit summary |
||
| Line 5: | Line 5: | ||
if (observed == 0) return; | if (observed == 0) return; | ||
double pmatch = (1. - e) + e * freq | double pmatch = (1. - e) + e * freq; | ||
double prandom = e * freq | double prandom = e * freq; | ||
for (int i = 0; i < states; i++) | for (int i = 0; i < states; i++) | ||
Latest revision as of 14:40, 25 September 2013
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;
double prandom = e * freq;
for (int i = 0; i < states; i++)
if (haplotypes[i][position] == observed)
vector[i] *= pmatch;
else
vector[i] *= prandom;
}