e56876e545b21501152e96f655141eb3b229cf0c
hiram
Fri Feb 25 16:19:26 2022 -0800
add in bioSample and bioProject columns and control of IUCN display refs #28930
diff --git src/hg/js/gar.js src/hg/js/gar.js
index e670fe7..20ec45b 100644
--- src/hg/js/gar.js
+++ src/hg/js/gar.js
@@ -121,86 +121,96 @@
});
}
}, // discoverColumnsCheckboxes: function()
/* column names:
+
+
+
*/
// given a category and a counts Map, increment the count for that category
incrementCount: function(category, counts) {
if (counts.get(category)) {
counts.set(category, counts.get(category) + 1);
} else {
counts.set(category, 1);
}
},
// given a category and a counts Map, and some flags
- countVisHidden: function(category, counts, gca, gcf, canBeReq, ucscDb) {
+ countVisHidden: function(category, counts, gca, gcf, canBeReq, ucscDb, hasIucn) {
gar.incrementCount(category, counts);
if (gca) { gar.incrementCount('gca', counts); }
if (gcf) { gar.incrementCount('gcf', counts); }
+ if (hasIucn) { gar.incrementCount('iucn', counts); }
if (canBeReq) {
gar.incrementCount('gar', counts);
} else {
gar.incrementCount('gak', counts);
}
},
// foreach table, for each row in the table, count visible rows
countVisibleRows: function(et) {
// var t0 = gar.millis();
var comNameRow = gar.columnNames.get('comName');
var asmIdRow = gar.columnNames.get('asmId');
+ var iucnRow = gar.columnNames.get('IUCN');
var cladeRow = gar.columnNames.get('clade');
var visRows = 0;
var totalRows = 0;
// key is category name, value is count visible
var categoryVisible = new Map();
// key is category name, value is count hidden
var categoryHidden = new Map();
var i = 0;
for (i = 0; i < gar.cladeTableList.length; i++) {
for (var j = 0; j < gar.cladeTableList[i].rows.length; j++) {
var rowId = gar.cladeTableList[i].rows[j];
var tagN = rowId.parentNode.tagName.toLowerCase();
// ignore thead and tfoot rows
if (tagN === "thead" || tagN === "tfoot") { continue; }
++totalRows;
var thisClade = rowId.cells[cladeRow].innerHTML;
var asmId = rowId.cells[asmIdRow].innerHTML;
var isGCA = asmId.includes("GCA");
var isGCF = asmId.includes("GCF");
var comName = rowId.cells[comNameRow].innerHTML;
var canBeRequested = comName.includes("button");
var ucscDb = comName.includes("cgi-bin/hgTracks");
+ var iucnStatus = rowId.cells[iucnRow].innerHTML;
+ var hasIucn = false;
+ if (iucnStatus) {
+ hasIucn = ! iucnStatus.includes(" ");
+ }
if ( rowId.style.display !== "none") {
- gar.countVisHidden(thisClade, categoryVisible, isGCA, isGCF, canBeRequested, ucscDb);
+ gar.countVisHidden(thisClade, categoryVisible, isGCA, isGCF, canBeRequested, ucscDb, hasIucn);
++visRows;
} else {
- gar.countVisHidden(thisClade, categoryHidden, isGCA, isGCF, canBeRequested, ucscDb);
+ gar.countVisHidden(thisClade, categoryHidden, isGCA, isGCF, canBeRequested, ucscDb, hasIucn);
}
}
}
var notVis = totalRows - visRows;
/* fixup the hideAll checkbox status, if there are any rows visible,
* those hideAll checkboxes should indicate off so they are
* thereby ready to do the function of 'hideAll'. Or if all rows
* are not visible, they should be on to indicate 'hideAll' is in effect
*/
/* reset the checked status on all the other show/hide check boxes */
gar.checkBoxNames.forEach(function(checkBox, name) {
// add the counts (visible/hidden) to the checkBox label text
var visibleCount = 0;
if (categoryVisible.get(name)) {
checkBox.checked = true;