Skip to content

Commit

Permalink
More appropriate way of doing the same thing
Browse files Browse the repository at this point in the history
  • Loading branch information
Oddant1 committed May 20, 2024
1 parent fd8dce3 commit 5b16834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,12 @@ <h3>Plot Controls</h3>

// start the counter at 1 to ignore the header row
for (var i = 1; row = table.rows[i]; i++) {
let sampleFrequency = row.cells[1].innerText;
sampleFrequency = strToInt(sampleFrequency);
// The value in table is formatted as a string for display to the user,
// but the value in sampleFrequencies is formatted as an int for data
// manipulation, so we use the ID we are on in table to get the frequency
// fro sampleFrequencies.
const sampleID = sampleFrequencies[row.cells[0].innerText];
const sampleFrequency = sampleFrequencies[sampleID];

if (sampleFrequency < samplingDepth) {
row.className = "danger";
Expand Down
6 changes: 0 additions & 6 deletions q2_feature_table/_summarize/summarize_assets/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,3 @@ function sortIDs(a, b, data) {

return diff;
}


// Parse a string that may contain commas into a base 10 integer
function strToInt(val) {
return parseInt(val.replaceAll(",", ""), 10);
}

0 comments on commit 5b16834

Please sign in to comment.