75892bebe2505e10302cb56e9e1050bd811351d9
hiram
  Tue Sep 27 09:03:45 2022 -0700
accomodate promoted hubs with db but no chromInfo refs #29819

diff --git src/hg/utils/automation/doRecipBest.pl src/hg/utils/automation/doRecipBest.pl
index 02bc4a2..4126d3f 100755
--- src/hg/utils/automation/doRecipBest.pl
+++ src/hg/utils/automation/doRecipBest.pl
@@ -31,31 +31,31 @@
     $opt_trackHub
     /;
 
 # Specify the steps supported with -continue / -stop:
 my $stepper = new HgStepManager(
     [ { name => 'recipBest',  func => \&doRecipBest },
       { name => 'download',   func => \&doDownload },
       { name => 'load',       func => \&loadRBest },
       { name => 'cleanup',    func => \&cleanUp },
     ]
 				);
 
 # Option defaults:
 my $dbHost = 'hgwdev';
 
-my ($dbExists, $qDbExists);
+my ($dbExists, $qDbExists, $tChromInfoExists, $qChromInfoExists);
 
 my $base = $0;
 $base =~ s/^(.*\/)?//;
 
 sub usage {
   # Usage / help / self-documentation:
   my ($status, $detailed) = @_;
   # Basic help (for incorrect usage):
   print STDERR "
 usage: $base tDb qDb
 options:
 ";
   print STDERR $stepper->getOptionHelp();
   print STDERR <<_EOF_
     -buildDir dir         Use dir instead of default
@@ -392,31 +392,31 @@
 "It loads the recip best chain tables into $tDb, adds gap/repeat stats to the recip best .net file,
 and loads the recip net table.";
   my $bossScript = new HgRemoteScript("$runDir/loadRBest.csh", $dbHost,
 				      $runDir, $whatItDoes);
   $bossScript->add(<<_EOF_
 # Load reciprocal best chains:
 _EOF_
   );
   if (! $opt_trackHub && $dbExists) {
     $bossScript->add(<<_EOF_
 cd $runDir
 hgLoadChain -tIndex $tDb chainRBest$QDb $tDb.$qDb.rbest.chain.gz
 _EOF_
     );
 
-    if ($qDbExists) {
+    if ($qDbExists && $qChromInfoExists) {
     $bossScript->add(<<_EOF_
 
 # Add gap/repeat stats to the net file using database tables:
 cd $runDir
 netClass -verbose=0 -noAr $tDb.$qDb.rbest.net.gz $tDb $qDb stdout \\
     | gzip -c > $tDb.$qDb.rbest.classed.net.gz
 
 # Load nets:
 netFilter -minGap=10 $tDb.$qDb.rbest.classed.net.gz \\
 | hgLoadNet -verbose=0 $tDb netRBest$QDb stdin
 _EOF_
       );
      }
 
     $bossScript->add(<<_EOF_
@@ -470,33 +470,42 @@
 # main
 
 #$opt_debug = 1;
 
 # Prevent "Suspended (tty input)" hanging:
 &HgAutomate::closeStdin();
 
 # Make sure we have valid options and correct number of args
 &checkOptions();
 &usage(1) if (scalar(@ARGV) != 2);
 ($tDb, $qDb) = @ARGV;
 
 # may be working on a 2bit file that does not have a database browser
 $dbExists = 0;
 $dbExists = 1 if (&HgAutomate::databaseExists($dbHost, $tDb));
+# db might exist, but it may not have chromInfo table (promoted hub)
+$tChromInfoExists = 0;
+if ($dbExists) {
+  $tChromInfoExists = 1 if (&HgAutomate::dbTableExists($dbHost, $tDb, "chromInfo"));
+}
 # may be working with a query that has no database
 $qDbExists = 0;
 $qDbExists = 1 if (&HgAutomate::databaseExists($dbHost, $qDb));
+$qChromInfoExists = 0;
+if ($qDbExists) {
+  $qChromInfoExists = 1 if (&HgAutomate::dbTableExists($dbHost, $qDb, "chromInfo"));
+}
 
 $QDb = ucfirst($qDb);
 
 $target2Bit = "$HgAutomate::clusterData/$tDb/$tDb.2bit";
 $query2Bit = "$HgAutomate::clusterData/$qDb/$qDb.2bit";
 $target2Bit = $opt_target2Bit if ($opt_target2Bit);
 $query2Bit = $opt_query2Bit if ($opt_query2Bit);
 $targetSizes = "$HgAutomate::clusterData/$tDb/chrom.sizes";
 $querySizes = "$HgAutomate::clusterData/$qDb/chrom.sizes";
 $targetSizes = $opt_targetSizes if ($opt_targetSizes);
 $querySizes = $opt_querySizes if ($opt_querySizes);
 
 $splitRef =  (`wc -l < $targetSizes` <= $HgAutomate::splitThreshold);
 
 # Establish what directory we will work in.