dcc09e71de2cb1f61a19f0526e0595ceb8277bb3
hiram
  Fri Feb 25 10:43:00 2022 -0800
adding cell background coloring for the IUCN column and tri-state indication on the hideAll buttons refs #28930

diff --git src/hg/gar/garTable.pl src/hg/gar/garTable.pl
index 3592cfa..627318a 100755
--- src/hg/gar/garTable.pl
+++ src/hg/gar/garTable.pl
@@ -159,30 +159,33 @@
 # Giraffa camelopardalis antiquorum -> Giraffa camelopardalis
 # Giraffa camelopardalis rothschildi -> Giraffa camelopardalis
 
 printf STDERR "### reading iucnToNcbiEquivalent.txt\n";
 open (FH, "<../iucnToNcbiEquivalent.txt") or die "can not read iucnToNcbiEquivalent.txt";
 while (my $line = <FH>) {
   chomp $line;
   my ($ncbiName, $iucnName) = split('\t', $line);
   $ncbiToIucnNames{$ncbiName} = $iucnName;
 }
 close (FH);
 
 my $criticalColor = "#ff0000";
 my $endangeredColor = "#dd6600";
 my $vulnerableColor = "#663300";
+$criticalColor = "#ee3333";
+$endangeredColor = "#333388";
+$vulnerableColor = "#88aaaa";
 my %statusColors = (
   "CR" => $criticalColor,
   "EN" => $endangeredColor,
   "VU" => $vulnerableColor,
 );
 
 my %iucnCR;	# key is scientific name, value is 1 == Critically Endangered
 my %iucnEN;	# key is scientific name, value is 1 == Endangered
 my %iucnVU;	# key is scientific name, value is 1 == Vulnerable
 
 my %iucnSciNames;	# key is scientific name, value is IUCN code CR EN VU
 
 my $iucnSpeciesCount = 0;
 my $iucnCount = 0;
 printf STDERR "### reading iucn/IUCN.CR.txt\n";
@@ -786,42 +789,42 @@
 printf "<col id='sciName' span='1' class=colGSciName>\n";
 printf "<col id='asmId' span='1' class=colGAsmId>\n";
 printf "<col id='asmSize' span='1' class=colGAsmSize>\n";
 printf "<col id='seqCount' span='1' class=colGAsmSeqCount>\n";
 printf "<col id='scafN50' span='1' class=colGScafN50>\n";
 printf "<col id='ctgN50' span='1' class=colGContigN50>\n";
 printf "<col id='IUCN' span='1' class=colGIUCN>\n";
 printf "<col id='taxId' span='1' class=colGTaxId>\n";
 printf "<col id='asmDate' span='1' class=colGAsmDate>\n";
 printf "<col id='submitter' span='1' class=colGSubmitter>\n";
 printf "<col id='clade' span='1' class=colGClade>\n";
 printf "</colgroup>\n";
 
 printf "<thead>\n";
 printf "<tr>\n";
-printf "  <th class='colComName'><div class='tooltip'>common name<span class='tooltiptext'>Links to an existing assembly browser, Button opens an assembly request form.</span></div></th>\n";
-printf "  <th class='colSciName'><div class='tooltip'>scientific name (count)<span class='tooltiptext'>Links to Google image search. Count shows the number of assemblies available for this orgnism.</span></div></th>\n";
-printf "  <th class='colAsmId'><div class='tooltip'>NCBI assembly<span class='tooltiptext'>Links to NCBI resource record.</span></div></th>\n";
-printf "  <th class='colAsmSize'><div class='tooltip'>assembly<br>size<span class='tooltiptext'>Number of nucleotides in the assembly.</span></div></th>\n";
-printf "  <th class='colAsmSeqCount'><div class='tooltip'>sequence<br>count<span class='tooltiptext'>The number of sequences in this assembly.</span></div></th>\n";
-printf "  <th class='colScafN50'><div class='tooltip'>scaffold N50<br>length (L50)<span class='tooltiptext'><a href='https://en.wikipedia.org/wiki/N50,_L50,_and_related_statistics' target=_blank>N50 (L50)</a> length.</span></div> </th>\n";
-printf "  <th class='colContigN50'><div class='tooltip'>contig N50<br>length (L50)<span class='tooltiptext'><a href='https://en.wikipedia.org/wiki/N50,_L50,_and_related_statistics' target=_blank>N50 (L50)</a> length.</span></div></th>\n";
-printf "  <th class='colIUCN'><div class='tooltip'>IUCN<span class='tooltiptext'>Links to <a href='https://www.iucnredlist.org/' target=_blank>IUCN Red List</a> of Threatened Species (version 2021-3) <span style='color:%s;'>CR - Critical</span> / <span style='color:%s;'>EN - Endangered</span> / <span style='color:%s;'>VU - Vulnerable</span></span></div></th>\n", $statusColors{"CR"}, $statusColors{"EN"}, $statusColors{"VU"};
-printf "  <th class='colTaxId'><div class='tooltip'>NCBI taxID<span class='tooltiptext'>Links to <a href='https://www.ncbi.nlm.nih.gov/taxonomy' target='_blank'>NCBI Taxonomy</a> database.</span></div></th>\n";
-printf "  <th class='colAsmDate'><div class='tooltip'>assembly<br>date<span class='tooltiptext'>Date submitted to <a href='https://www.ncbi.nlm.nih.gov/assembly' target=_blank>NCBI assembly</a> database.</span></div></th>\n";
-printf "  <th class='colSubmitter sorttable_alpha'><div class='tooltip'>Assembly submitter<span class='tooltiptextright'>Person or group who submitted to <<a href='https://www.ncbi.nlm.nih.gov/assembly' target=_blank>NCBI Assembly</a> database.</span></div></th>\n";
-printf "  <th class='colClade'><div class='tooltip'>clade<span class='tooltiptextright'>Clade of this organism.  Note: the <em>invertebrate</em> clade is a catch all category that includes organisims not typically classified as <em>invertebrate</em></span></div></th>\n";
+printf "  <th class='colComName'><div class='tooltip'>common name<span onclick='event.stopPropagation()' class='tooltiptext'>Links to an existing assembly browser, Button opens an assembly request form.</span></div></th>\n";
+printf "  <th class='colSciName'><div class='tooltip'>scientific name (count)<span onclick='event.stopPropagation()' class='tooltiptext'>Links to Google image search. Count shows the number of assemblies available for this orgnism.</span></div></th>\n";
+printf "  <th class='colAsmId'><div class='tooltip'>NCBI assembly<span onclick='event.stopPropagation()' class='tooltiptext'>Links to NCBI resource record.</span></div></th>\n";
+printf "  <th class='colAsmSize'><div class='tooltip'>assembly<br>size<span onclick='event.stopPropagation()' class='tooltiptext'>Number of nucleotides in the assembly.</span></div></th>\n";
+printf "  <th class='colAsmSeqCount'><div class='tooltip'>sequence<br>count<span onclick='event.stopPropagation()' class='tooltiptext'>The number of sequences in this assembly.</span></div></th>\n";
+printf "  <th class='colScafN50'><div class='tooltip'>scaffold N50<br>length (L50)<span onclick='event.stopPropagation()' class='tooltiptext'><a href='https://en.wikipedia.org/wiki/N50,_L50,_and_related_statistics' target=_blank>N50 (L50)</a> length.</span></div> </th>\n";
+printf "  <th class='colContigN50'><div class='tooltip'>contig N50<br>length (L50)<span onclick='event.stopPropagation()' class='tooltiptext'><a href='https://en.wikipedia.org/wiki/N50,_L50,_and_related_statistics' target=_blank>N50 (L50)</a> length.</span></div></th>\n";
+printf "  <th class='colIUCN'><div class='tooltip'>IUCN<span onclick='event.stopPropagation()' class='tooltiptext'>Links to <a href='https://www.iucnredlist.org/' target=_blank>IUCN Red List</a> of Threatened Species (version 2021-3) <span style='color:%s;'>CR - Critical</span> / <span style='color:%s;'>EN - Endangered</span> / <span style='color:%s;'>VU - Vulnerable</span></span></div></th>\n", $statusColors{"CR"}, $statusColors{"EN"}, $statusColors{"VU"};
+printf "  <th class='colTaxId'><div class='tooltip'>NCBI taxID<span onclick='event.stopPropagation()' class='tooltiptext'>Links to <a href='https://www.ncbi.nlm.nih.gov/taxonomy' target='_blank'>NCBI Taxonomy</a> database.</span></div></th>\n";
+printf "  <th class='colAsmDate'><div class='tooltip'>assembly<br>date<span onclick='event.stopPropagation()' class='tooltiptext'>Date submitted to <a href='https://www.ncbi.nlm.nih.gov/assembly' target=_blank>NCBI assembly</a> database.</span></div></th>\n";
+printf "  <th class='colSubmitter sorttable_alpha'><div class='tooltip'>Assembly submitter<span onclick='event.stopPropagation()' class='tooltiptextright'>Person or group who submitted to <a href='https://www.ncbi.nlm.nih.gov/assembly' target=_blank>NCBI Assembly</a> database.</span></div></th>\n";
+printf "  <th class='colClade'><div class='tooltip'>clade<span onclick='event.stopPropagation()' class='tooltiptextright'>Clade of this organism.  Note: the <em>invertebrate</em> clade is a catch all category that includes organisims not typically classified as <em>invertebrate</em></span></div></th>\n";
 printf "</tr>\n";
 printf "</thead><tbody>\n";
 
 my %equivalentNamesUsed;	# key is NCBI sciName, value is IUCN sciName
 my $pageSectionCount = 0;
 
 my %checkDupAsmId;	# key is asmId, value is count of times seen
 
 my %cladeSciNameCounts;	# key is clade, value is number of different
 			# scientific names
 
 my %gcfGcaCounts;	# key is GCF or GCA, value is count of each
 my $asmCountInTable = 0;	# counting the rows output
 my %statusCounts;	# key is status: CR EN VU, value is count
 my $totalAssemblySize = 0;	# sum of all assembly sizes
@@ -1017,34 +1020,37 @@
 ### can override CSS settings here
 ###    $rowClass = " class='gar' style='display: none;'";
 
   ############# obsolete first column, a running count, and establish row color ###
   if ( 0 == 1 ) {
     if (length($statusColor)) {
        printf "<tr%s style='color:%s;'><th style='text-align:right;'>%d</th>", $rowClass, $statusColor, $asmCountInTable;
     } else {
        printf "<tr%s><th style='text-align:right;'>%d</th>", $rowClass, $asmCountInTable;
     }
   }
   # experiment with hiding all rows over 500 count to see if that helps
   # chrom browser initial loading performance
   # try out the table with out any count, just get the row started
   if (length($statusColor)) {
+     my $statusClass = sprintf(" style='color:%s;", $statusColor);
+     # let's see what nostatus looks like
+     $statusClass = "";
      if ($asmCountInTable > 500) {
-       printf "<tr%s style='color:%s; display:none;'>", $rowClass, $statusColor;
+       printf "<tr%s%s display:none;'>", $rowClass, $statusClass;
      } else {
-       printf "<tr%s style='color:%s;'>", $rowClass, $statusColor;
+       printf "<tr%s%s'>", $rowClass, $statusClass;
      }
   } else {
      if ($asmCountInTable > 500) {
        printf "<tr%s style='display:none;'>", $rowClass;
      } else {
        printf "<tr%s>", $rowClass;
      }
   }
   ############# first column, common name link to browser or request button ##
   if (defined($comName{$asmId})) {
      printf "<th onmouseout='gar.col1TipOff(event)' onmouseover='gar.col1Tip(event)' style='text-align:left;'><a href='%s' target=_blank>%s</a></th>", $browserUrl, $commonName;
   } else {
      if (length($ucscDb)) {
        printf "<th onmouseout='gar.col1TipOff(event)' onmouseover='gar.col1Tip(event)' style='text-align:left;'><a href='%s' target=_blank>%s</a></th>", $browserUrl, $commonName;
      } else {
@@ -1092,33 +1098,33 @@
   } else {
     printf "<td style='display:none;'>&nbsp;</td>";
     printf PC "\t%s", "n/a";	# output to clade.tableData.txt
   }
 
   ############# sixth, seventh columns, N50 for scaffold, contig ##############
   if ($n50ScaffoldSize > 0 ) {
     n50Cell($n50ScaffoldSize, $n50ScaffoldCount, \*PC);
   } else {	# substitute assembly N50 when no scaffold N50 available
     n50Cell($n50Size, $n50Count, \*PC);
   }
   n50Cell($n50ContigSize, $n50ContigCount, \*PC);
 
   ############# eighth column,  IUCN status and link ################
   if (length($iucnLink) > 0) {
-    printf "<td style='display:none;'><a href='%s' target=_blank>%s</a></td>", $iucnLink, $iucnStatus;
+    printf "<td class='iucn%s' style='display:none;'><a href='%s' target=_blank>%s</a></td>", $iucnStatus, $iucnLink, $iucnStatus;
   } else {
-    printf "<td style='display:none;'>%s</td>", $iucnStatus;
+    printf "<td class='iucnNone' style='display:none;'>%s</td>", $iucnStatus;
   }
   printf PC "\t%s", $iucnStatus;	# output to clade.tableData.txt
 
   ############# ninth column,  taxId and link to NCBI ################
   if (defined($asmTaxId{$asmId})) {
     my $taxUrl = "https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=$asmTaxId{$asmId}";
     printf "<td style='display:none; text-align:right;'><a href='%s' target=_blank>%s</a></td>", $taxUrl, $asmTaxId{$asmId};
     printf PC "\t%s", $asmTaxId{$asmId};	# output to clade.tableData.txt
   } else {
     printf "<td style='display:none;'>n/a</td>";
     printf PC "\t%s", "n/a";	# output to clade.tableData.txt
   }
 
   ############# tenth column,  assembly date ################
   if (defined($asmDate{$asmId})) {