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

diff --git src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.sh src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.sh
index 38fdfef76a3..ac8816e7f36 100755
--- src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.sh
+++ src/hg/utils/automation/asmHubMiniMap2ChainNetTrackDb.sh
@@ -18,32 +18,39 @@
    GC*)
      accessionId=`echo "$asmId" | awk -F"_" '{printf "%s_%s", $1, $2}'`
      ;;
 esac
 
 export scriptDir="$HOME/kent/src/hg/utils/automation"
 
 mkdir -p $buildDir/bbi
 
 export chainNetPriority=1
 
 printf "# asmHubMiniMap2ChainNetTrackDb.sh $asmId $buildDir\n" 1>&2
 
 for D in ${buildDir}/trackData/miniMap2.*
 do
-  targetDb=$accessionId
   mm2Dir=`basename "${D}"`
+  # 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.
+  case "${mm2Dir}" in
+    *.swap) continue ;;
+  esac
+  targetDb=$accessionId
   # doMiniMap2.pl names this directory 'miniMap2.$QDb' where $QDb is
   # ucfirst() of the query db/accession; OtherDb below reproduces the
   # exact case used in the chain*.bb file names, otherDb reconstructs
   # the actual lowercase-first db name/accession for table lookups.
   OtherDb=`echo $mm2Dir | sed -e 's/miniMap2.//;'`
   dbPrefix2=`printf '%s' "$OtherDb" | cut -c1-2`
   if [ "${dbPrefix2}" = "GC" ]; then
     otherDb="${OtherDb}"
   else
     firstChar=`printf '%s' "$OtherDb" | cut -c1`
     restChars=`printf '%s' "$OtherDb" | cut -c2-`
     lowerFirst=`printf '%s' "$firstChar" | tr 'A-Z' 'a-z'`
     otherDb="${lowerFirst}${restChars}"
   fi
   asmReport=`ls -d $buildDir/download/*assembly_report.txt 2> /dev/null`