0ed3d3d300a94b6d8c94e98aa70ebad0294aa27e
max
  Fri Sep 18 09:44:12 2026 -0700
uniprot otto: a missing tab/version.txt should mean parse, not crash

#Preview2 week - bugs introduced now will need a build patch to fix
updateUniprot opened tab/version.txt without checking it was there, so the run died
with FileNotFoundError. The file is absent on a first run into an empty tab
directory, and removing it is the natural way to force a reparse when the UniProt
release has not changed but the set of taxa has, which is exactly the case when
moving from the dbDb plan of 109 taxa to a GenArk plan of 664.

Treat a missing file as "nothing parsed yet" and parse.

refs #38300

diff --git src/hg/utils/otto/uniprot/doUniprot src/hg/utils/otto/uniprot/doUniprot
index c9007777c2c..a47eff5e64e 100755
--- src/hg/utils/otto/uniprot/doUniprot
+++ src/hg/utils/otto/uniprot/doUniprot
@@ -2491,31 +2491,35 @@
     tabDir = options.tabDir
     mapDir = options.mapDir
     bigBedDir = options.bigBedDir
     faDir = options.faDir
     doTrembl = not options.skipTrembl
 
     if not options.skipParse:
         checkParserDeps()
 
     if not options.skipDownload and not options.skipParse and not options.onlyDbs:
         # download NCBI -> refseq tables
         downloadAndSplitNcbi(taxIdDbs)
         downloadUniprot(uprotDir)
 
     downVersion = readRelStringUniprot(uprotDir)
-    tabVersion = open(join(tabDir, "version.txt")).read()
+    # No version file means nothing has been parsed into this directory yet, so parse.
+    # Do not assume it is there: it is absent on a first run, and removing it is the way to
+    # force a reparse when the release has not changed but the taxon list has.
+    versionFname = join(tabDir, "version.txt")
+    tabVersion = open(versionFname).read() if isfile(versionFname) else None
 
     doParse = True
     if downVersion==tabVersion:
         logging.info("Not converting to tab again, found same version is in tab directory")
         doParse = False
 
     if options.skipParse:
         logging.info("Not converting to tab, was switched off by option")
         doParse = False
 
     if doParse:
         logging.info("downloaded version is %s, parsed version is %s" % (downVersion, tabVersion))
         logging.info("Converting uniprot from %s to %s, using maps in %s" % (uprotDir, tabDir, mapDir))
         # parsing the UniProt XML files
         logging.info("Converting uniprot XML from %s to tab-sep in %s, this can take 2-3 days!! Specify -p to skip this." % (uprotDir, tabDir))