8149f2d63d04238813b626ab194b45eeaa91e32f
hiram
  Tue Sep 29 15:20:22 2026 -0700
fixup swap directory recognition refs #34360

diff --git src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.pl src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.pl
index a9f2007db1e..1f341d88914 100755
--- src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.pl
+++ src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.pl
@@ -51,30 +51,35 @@
 
 # doMiniMap2.pl names buildDir/trackData/miniMap2.$QDb where $QDb is
 # ucfirst() of the actual query db/accession.  Reconstruct the actual
 # db name/accession (otherDb) by undoing that ucfirst, except for a
 # GenArk accession (already starts with the uppercase 'GC', ucfirst is
 # a no-op there).
 sub queryDbFromQDb($) {
   my ($qDb) = @_;
   return $qDb if ($qDb =~ m/^GC/);
   return lcfirst($qDb);
 }
 
 open (DL, "ls -d $buildDir/trackData/miniMap2.*|") or die "can not list $buildDir/trackData/miniMap2.*";
 while (my $mm2Dir = <DL>) {
   chomp $mm2Dir;
+  # a -swap run's default swapDir is itself named 'miniMap2.<otherDb>.swap',
+  # which also matches this glob alongside its own dateless symlink
+  # 'miniMap2.<otherDb>' -- skip that real *.swap work directory so this
+  # query genome is only processed once, via its dateless symlink.
+  next if ($mm2Dir =~ m/\.swap$/);
   my $Qdb = basename($mm2Dir);
   $Qdb =~ s/miniMap2.//;
   my $queryDb = &queryDbFromQDb($Qdb);
   $queryPrio{$queryDb} = 100;
   my $fbTxt = `ls $buildDir/trackData/miniMap2.${Qdb}/fb.*.chain${Qdb}Link.txt 2> /dev/null`;
   chomp $fbTxt;
   if (-s "${fbTxt}") {
     my $prio = `cut -d' ' -f5 $fbTxt | tr -d '()%'`;
     chomp $prio;
     $queryPrio{$queryDb} = sprintf("%.3f", 100 - $prio);
   }
 }
 close (DL);
 
 foreach my $qDb ( sort {$queryPrio{$a} <=> $queryPrio{$b}} keys %queryPrio) {