5ecc240ed4c5b14d77c5903eefbff0c57b5f2135
max
  Wed Mar 4 14:17:49 2026 -0800
fixes after code review, refs #37195

diff --git src/hg/utils/otto/clinvar/clinVarToBed src/hg/utils/otto/clinvar/clinVarToBed
index ab6780c158e..b113e75386f 100755
--- src/hg/utils/otto/clinvar/clinVarToBed
+++ src/hg/utils/otto/clinvar/clinVarToBed
@@ -706,34 +706,34 @@
     if maxDiff is None:
         maxDiff = 5 # this is what was in doUpdate.sh, I admit it doesn't make sense
     cmd = "sh ./clinvarSubLolly "+str(maxDiff)
     if isAlpha:
         cmd+= " --alpha"
     assert(os.system(cmd)==0)
 
 def makeVersionFile(versionFname, bigBedDir):
     # create the version.txt file
     clinvarVersion = open(versionFname).read()
     versionString = "ClinVar Release: %s, converted at UCSC on %s" % (clinvarVersion, date.today().strftime("%Y-%m-%d"))
     outFname = join(bigBedDir, "version.txt")
     with open(outFname, "w") as ofh:
         ofh.write(versionString)
 
-def copyFilesToArchive(tmpFnames):
+def copyFilesToArchive(tmpFnames, bigBedDir):
     " the 'archive' directory on hgdownload contains previous versions of a tracks, we create a copy there every months "
-    for db, trackName, tmpFname, finalFname in tmpFnames:
     yearMonDay = date.today().strftime("%Y-%m-%d")
+    for db, trackName, tmpFname, finalFname in tmpFnames:
         gbdbFname = "/gbdb/%s/bbi/clinvar/%s.bb" % (db, trackName)
         # put a copy into the archive
         outDir = "/usr/local/apache/htdocs-hgdownload/goldenPath/archive/%s/clinvar/%s" % (db, yearMonDay)
         if not isdir(outDir):
             os.mkdir(outDir)
         archiveFname = join(outDir, basename(gbdbFname))
         logging.info("Creating %s" % archiveFname)
         cmd = "cp %s %s" % (finalFname, archiveFname)
         mustRun(cmd)
 
         # copy the BED files to prevRun, so we can do a diff in the next run
         cmd = "cp bed/%s.%s.bed prevRun/" % (basename(trackName), db)
         mustRun(cmd)
 
     # add the version.txt files
@@ -1146,19 +1146,19 @@
 
 loadSubmissions(summFname)
 makeSubLolly(options.maxDiff, options.isAlpha)
 
 # If we land here, the sub lolly tables and bigBed files were successfully built.
 # Now do the rest.
 # We rename the temp files to the final file names at the very end which will make the track live
 for db, tableName, tmpFname, finalFname in tmpFnames:
     logging.debug("Renaming %s to %s" % (tmpFname, finalFname))
     os.rename(tmpFname, finalFname)
 
 makeVersionFile(versionFname, bigBedDir)
 
 if not options.isAlpha:
     # put a copy of the files into the archive
-    copyFilesToArchive()
+    copyFilesToArchive(tmpFnames, bigBedDir)
 
 print("ClinVar update end: OK")