febcba57979e8638ada173f0d26eba18cd51b3a8
hiram
  Tue Jul 30 13:29:27 2024 -0700
can be used for a UCSC database assembly with special arguments refs #34149

diff --git src/hg/utils/automation/asmHubChainNetComposite.pl src/hg/utils/automation/asmHubChainNetComposite.pl
index 8342028..ec69330 100755
--- src/hg/utils/automation/asmHubChainNetComposite.pl
+++ src/hg/utils/automation/asmHubChainNetComposite.pl
@@ -2,30 +2,32 @@
 
 use strict;
 use warnings;
 use FindBin qw($Bin);
 use lib "$Bin";
 use AsmHub;
 use HgAutomate;
 use File::Basename;
 
 my $argc = scalar(@ARGV);
 
 if ($argc != 3) {
   printf STDERR "usage: asmHubChainNet.pl asmId ncbiAsmId asmId.names.tab > asmId.chainNet.html\n";
   printf STDERR "where asmId is the assembly identifier,\n";
   printf STDERR "and   asmId.names.tab is naming file for this assembly,\n";
+  printf STDERR "for UCSC database assemblies, use the third argument asmId.names.tab\n";
+  printf STDERR "   as the Scientific_name for the organism.\n";
   exit 255;
 }
 
 # specific to UCSC environment
 my $dbHost = "hgwdev";
 
 my $asmId = shift;
 my $ncbiAsmId = shift;
 my $namesFile = shift;
 
 my $queryId = "";
 
 my $targetBuildDir = "";
 if ($asmId =~ m/^GC/) {
   my $gcX = substr($asmId,0,3);
@@ -90,35 +92,43 @@
   } else {
     $rbStats{$qAsmId} = "n/a";
   }
   $fbTxt = `ls ${targetBuildDir}/trackData/lastz.${accession}/fb.*chainLiftOver${Accession}Link.txt 2> /dev/null`;
   chomp $fbTxt;
   if ( -s "${fbTxt}" ) {
     my $fBits = `cut -d' ' -f5 $fbTxt | tr -d '()%'`;
     chomp $fBits;
     $loStats{$qAsmId} = $fBits;
   } else {
     $loStats{$qAsmId} = "n/a";
   }
 }
 close (TD);
 
-my $ncbiAssemblyId = `grep -v "^#" $namesFile | cut -f10`;
+my $ncbiAssemblyId = $ncbiAsmId;
+
+if ( -s "${namesFile}" ) {
+  $ncbiAssemblyId = `grep -v "^#" $namesFile | cut -f10`;
   chomp $ncbiAssemblyId;
+}
 
+my $sciName = ${namesFile};
+
+if ( -s "${namesFile}" ) {
   my $sciName = `grep -v "^#" $namesFile | cut -f5`;
   chomp $sciName;
+}
 
 my ($tGenome, $tDate, $tSource) = &HgAutomate::getAssemblyInfo($dbHost, $asmId);
 
 
 print <<_EOF_
 <h2>Description</h2>
 <p>
 This track shows regions of this <em>target</em> genome ($tGenome - $tDate - $tSource) that has alignment
 to other <em>query</em> genomes (&quot;chain&quot; subtracks) or in synteny (&quot;net&quot; subtracks).
 The alignable parts are shown with thick blocks that look like exons.
 Non-alignable parts between these are shown like introns.
 </p>
 
 <p>
 Other <em>query</em> genome assemblies aligning to this <em>target</em> genome assembly: