Skip to content

Commit

Permalink
bg_from_sequence_dna will now return a probability distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
jhkorhonen committed Aug 9, 2016
1 parent ac1ae42 commit 0a18cbb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/moods_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ vector<double> bg_from_sequence_dna(const std::string &seq, const double ps)
counts[m[c]]++;
}

unsigned int count_all = counts[0] + counts[1] + counts[2] + counts[3];

for (unsigned int j = 0; j < alphabet_size; ++j){
bg[j] = (((double)counts[j] + ps)/ ((double)seq.size() + alphabet_size * ps));
bg[j] = (((double)counts[j] + ps)/ ((double)count_all + alphabet_size * ps));
}

return bg;
Expand Down

0 comments on commit 0a18cbb

Please sign in to comment.