afb5dbee2256da1db93064340dcf4508aee3955f
hiram
  Fri Oct 31 14:26:41 2025 -0700
needs to have a db argument and write out a version.txt file

diff --git src/hg/utils/automation/doLongdust.pl src/hg/utils/automation/doLongdust.pl
index d6867af7c61..2119932a750 100755
--- src/hg/utils/automation/doLongdust.pl
+++ src/hg/utils/automation/doLongdust.pl
@@ -33,31 +33,31 @@
 my $longDust = "/cluster/bin/x86_64/longdust";
 
 # Option defaults:
 my $bigClusterHub = 'hgwdev';
 my $defaultWorkhorse = 'least loaded';
 my $dbHost = 'hgwdev';
 my $unmaskedSeq = "";
 
 my $base = $0;
 $base =~ s/^(.*\/)?//;
 
 sub usage {
   # Usage / help / self-documentation:
   my ($status, $detailed) = @_;
   # Basic help (for incorrect usage):
-  print STDERR "usage: $base path/to/unmasked.2bit
+  print STDERR "usage: $base db path/to/unmasked.2bit
 options:
 ";
   print STDERR $stepper->getOptionHelp();
   print STDERR <<_EOF_
     -buildDir dir         Use dir instead of default
                           $HgAutomate::clusterData/\$db/$HgAutomate::trackBuild/longdust.\$date
                           (necessary when continuing at a later date).
 _EOF_
   ;
   print STDERR HgAutomate::getCommonOptionHelp('dbHost' => $dbHost,
 					'workhorse' => $defaultWorkhorse);
   print STDERR "
 Automates Heng Li's 'longdust' process for the given unmasked.2bit sequence.
 Steps:
     setup:   Prepares partitioned sequence listings from the given unmasked.2bit
@@ -115,30 +115,38 @@
   my $bossScript = newBash HgRemoteScript("$runDir/setup.bash", $workhorse,
 				      $runDir, $whatItDoes);
 
   my $tmpDir = HgAutomate::tmpDir();
   $bossScript->add(<<_EOF_
 rm -fr unmasked.2bit listFiles
 ln -s "$unmaskedSeq" unmasked.2bit
 
 twoBitInfo unmasked.2bit stdout | sort -k2nr > chrom.sizes
 
 export seqMax=`head -1 chrom.sizes | awk '{printf "%d", \$2+1}'`
 
 partitionSequence.pl -lstDir listFiles \$seqMax 0 \\
   unmasked.2bit chrom.sizes 10000
 ls -S listFiles/*.lst > part.list
+printf "#####################################################\n" > version.txt
+printf "# longdust version: %s\n" "`$longDust -v`" >> version.txt
+printf "#####################################################\n" >> version.txt
+printf "# running longdust with no options: all defaults\n" >> version.txt
+printf "#####################################################\n" >> version.txt
+printf "# %s\n" "$longDust" >> version.txt
+$longDust >> version.txt 2>&1 || true
+printf "#####################################################\n" >> version.txt
 _EOF_
   );
   $bossScript->execute() if (! $opt_debug);
 } # doSetup
 
 #########################################################################
 # * step: cluster [bigClusterHub]
 sub doCluster {
   my $paraHub = $bigClusterHub;
   my $runDir = "$buildDir";
   if ( ! $opt_debug && -s "$runDir/run.time") {
      printf STDERR "# cluster step already complete\n";
      return;
   }
   my $partList = "part.list";	# from doSetup
@@ -238,34 +246,34 @@
   $bossScript->add(<<_EOF_
 rm -fr tmp result
 _EOF_
   );
   $bossScript->execute() if (! $opt_debug);
 } # doCleanup
 
 #########################################################################
 # main
 
 # Prevent "Suspended (tty input)" hanging:
 HgAutomate::closeStdin();
 
 # Make sure we have valid options and exactly 1 argument:
 checkOptions();
-usage(1) if (scalar(@ARGV) != 1);
+usage(1) if (scalar(@ARGV) != 2);
 my $secondsStart = `date "+%s"`;
 chomp $secondsStart;
-($unmaskedSeq) = @ARGV;
+($db, $unmaskedSeq) = @ARGV;
 
 # Force debug and verbose until this is looking pretty solid:
 #$opt_debug = 1;
 $opt_verbose = 3 if ($opt_verbose < 3);
 
 # Establish what directory we will work in.
 my $date = `date +%Y-%m-%d`;
 chomp $date;
 $buildDir = $opt_buildDir ? $opt_buildDir :
   "$HgAutomate::clusterData/$db/$HgAutomate::trackBuild/longdust.$date";
 
 # Do everything.
 $stepper->execute();
 
 # Tell the user anything they should know.