65cc3900649623b8366ab05d9b285e528f8f2959
hiram
  Tue Mar 8 11:58:53 2022 -0800
now using a new initial column for the view/request function and correctly counting hasIucn columns refs #28930

diff --git src/hg/gar/garTable.pl src/hg/gar/garTable.pl
index 4e73849..3e1b4c6 100755
--- src/hg/gar/garTable.pl
+++ src/hg/gar/garTable.pl
@@ -787,49 +787,51 @@
 printf "<div style='text-align: center;'><!-- this will cause the next div to center -->\n";
 printf "  <div style='display: inline-block'>\n\n";
 
 printf "<h2 style='display: none;' id='counterDisplay'>%s total assemblies : use the selection menus to select subsets</h2>\n\n", commify($totalAssemblies);
 
 ##############################################################################
 ##  begin single table output, start the table and the header
 ##
 ## table starts out as display: hide and will be reset to 'table' after
 ## page load.  Saves a lot of time for Chrome browsers, however the page
 ## is still not usable until much time later.
 ##############################################################################
 printf "<table style='display: hide;' class='sortable borderOne cladeTable' id='dataTable'>\n";
 
 printf "<colgroup id='colDefinitions'>\n";
+printf "<col id='viewReq' span='1' class=colGViewReq>\n";
 printf "<col id='comName' span='1' class=colGComName>\n";
 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='bioSample' span='1' class=colGBioSample>\n";
 printf "<col id='bioProject' span='1' class=colGBioProject>\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 onclick='event.stopPropagation()' class='tooltiptext'>Links to an existing assembly browser, Button opens an assembly request form.</span></div></th>\n";
+printf "  <th class='colViewReq'><div class='tooltip'>view/request<span onclick='event.stopPropagation()' class='tooltiptext'><em>'view'</em> opens the genome browser on an existing assembly, or the <em>'request'</em> button opens an assembly build request form.</span></div></th>\n";
+printf "  <th class='colComName'><div class='tooltip'>common name<span onclick='event.stopPropagation()' class='tooltiptext'>common name</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='colBioSample sorttable_alpha'><div class='tooltip'>BioSample<span onclick='event.stopPropagation()' class='tooltiptext'>BioSample ID at <a href='https://www.ncbi.nlm.nih.gov/biosample' target=_blank>NCBI</a>.</span></div></th>\n";
 printf "  <th class='colBioProject sorttable_alpha'><div class='tooltip'>BioProject<span onclick='event.stopPropagation()' class='tooltiptext'>BioProject ID at <a href='https://www.ncbi.nlm.nih.gov/bioproject' target=_blank>NCBI</a>.</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.</span></div></th>\n";
 printf "</tr>\n";
 printf "</thead><tbody>\n";
@@ -1032,65 +1034,65 @@
     if (defined($rrGcaGcfList{$asmId})) {
       $rowClass = " class='ucscDb $gcaGcfClass $clade'"; # present in UCSC db
     } else {
       $rowClass = " class='gak $gcaGcfClass $clade'"; # present in GenArk
     }
   } else { # can be requested
     if (defined($rrGcaGcfList{$asmId})) {
       $rowClass = " class='ucscDb $gcaGcfClass $clade'"; # present in UCSC db
     } else {
       $rowClass = " class='gar $gcaGcfClass $clade'"; # available for request
     }
   }
 ### 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%s display:none;'>", $rowClass, $statusClass;
+       printf "<tr%s%s style='display:none;'>", $rowClass, $statusClass;
      } else {
        printf "<tr%s%s'>", $rowClass, $statusClass;
      }
   } else {
      if ($asmCountInTable > 500) {
        printf "<tr%s style='display:none;'>", $rowClass;
      } else {
        printf "<tr%s>", $rowClass;
      }
   }
+  ############# trying out a first column that is just the button or link
+
   ############# 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;
+     printf "<th style='text-align:center;'><a href='%s' target=_blank>view</a></th>", $browserUrl;
+     printf PC "\tview";	# output to clade.tableData.tsv
+     printf "<th style='text-align:left;'>%s</th>", $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;
+       printf "<th style='text-align:center;'><a href='%s' target=_blank>view</a></th>", $browserUrl;
+       printf PC "\tview";	# output to clade.tableData.tsv
+       printf "<th style='text-align:left;'>%s</th>", $commonName;
      } else {
-       printf "<th onmouseout='gar.col1TipOff(event)' onmouseover='gar.col1Tip(event)' style='text-align:left;'><button type='button' onclick='gar.openModal(this)' name='%s'>%s</button></th>", $asmId, $commonName;
+       printf "<th style='text-align:center;'><button type='button' onclick='gar.openModal(this)' name='%s'>request</button></th>", $asmId;
+       printf PC "\trequest";	# output to clade.tableData.tsv
+       printf "<th style='text-align:left;'>%s</th>", $commonName;
      }
   }
   printf PC "\t%s", $commonName;	# output to clade.tableData.tsv
 
   ############# second column, scientific name and google image search #########
   if (defined($sciNames{$asmId})) {
     my $noSpace = $sciNames{$asmId};
     $noSpace =~ s/ /+/g;
     my $imgSearchUrl="https://images.google.com/images?q=$noSpace&um=1&hl=en&safe=active&nfpr=1&tbs=il:cl";
     if ($assembliesAvailable > 1) {
       printf "<td><a href='%s' target=_blank>%s</a>&nbsp;(%s)</td>", $imgSearchUrl, $sciNames{$asmId}, commify($assembliesAvailable);
     } else {
       printf "<td><a href='%s' target=_blank>%s</a></td>", $imgSearchUrl, $sciNames{$asmId};
     }
     printf PC "\t%s", $sciNames{$asmId};	# output to clade.tableData.txt