Skip to content

Commit

Permalink
Merge pull request #723 from nextstrain/no_X_count_AA
Browse files Browse the repository at this point in the history
Don't Count X for AA Diversity Chart
  • Loading branch information
jameshadfield committed May 18, 2019
2 parents 2a042d9 + 4b03183 commit 73b69b4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/util/entropy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const calcMutationCounts = (nodes, visibility, geneMap, isAA) => {
for (const prot in n.aa_muts) { // eslint-disable-line
n.aa_muts[prot].forEach((m) => {
const pos = parseInt(m.slice(1, m.length - 1), 10);
sparse[prot][pos] ? sparse[prot][pos]++ : sparse[prot][pos] = 1;
const A = m.slice(0, 1);
const B = m.slice(-1);
if (A !== 'X' && B !== 'X') {
sparse[prot][pos] ? sparse[prot][pos]++ : sparse[prot][pos] = 1;
}
});
}
}
Expand Down Expand Up @@ -92,9 +96,9 @@ const calcEntropy = (nodes, visibility, geneMap, isAA) => {
const A = m.slice(0, 1);
const B = m.slice(m.length - 1, m.length);
// console.log("mut @ ", pos, ":", A, " -> ", B)
if (isAA){
if (A === "X" || A === "-" || B === "X" || B === "-") return;
}else{
if (isAA) {
if (A === "X" || B === "X") return;
} else {
if (A === "N" || A === "-" || B === "N" || B === "-") return;
}
if (!anc_state[prot][pos]) {
Expand Down

0 comments on commit 73b69b4

Please sign in to comment.