8c99a44e8855b4d78a741f91c02abc603c7ca7ca hiram Fri May 24 14:29:24 2024 -0700 the version check stuff does not actually work diff --git src/hg/utils/automation/refSeqOnGenBank.py src/hg/utils/automation/refSeqOnGenBank.py index 890e329..115b233 100755 --- src/hg/utils/automation/refSeqOnGenBank.py +++ src/hg/utils/automation/refSeqOnGenBank.py @@ -34,57 +34,52 @@ def buildPath(asmId): gcX = asmId[0:3] d0 = asmId[4:7] d1 = asmId[7:10] d2 = asmId[10:13] tP = "/hive/data/genomes/asmHubs/allBuild/" + "/".join([gcX,d0,d1,d2,asmId]) buildPath, stdErr = subProcess(["realpath", tP]) if not os.path.isdir(buildPath): print(f"ERROR: can not find build directory {tP}") sys.exit(-1) return buildPath ############################################################################# -# Check if the Python version is at least 3.6 (due to use of f-strings here) -if sys.version_info < (3, 6): - print("This script requires Python 3.6 or higher.") - sys.exit(1) - hostEnv, stdErr = subProcess(["uname", "-n"]) ### to use all the special stuff when hgwdev /usr/bin/python3 is used ### this allows it to find the icecream module if re.match(r'hgwdev*', hostEnv): sys.path.append("/cluster/software/lib/python3.6/site-packages") ### icecream is a convenient debug printout system using the ic() function from icecream import install install() ### ic(someArg) will print out the name of the argument and its contents ### for any type of object ic(sys.argv) +ic(sys.version_info) # Check if the correct number of command line arguments is provided if len(sys.argv) != 3: print("Usage: refSeqOnGenBank.py <refSeqAsmId> <genBankAsmId>") print("will add the RefSeq gene track to the GenBank assembly") print("when the refSeq genes exist on that refSeq assembly") print(" e.g.:\nrefSeqOnGenBank.py GCF_029281585.2_NHGRI_mGorGor1-v2.0_pri \\\n\tGCA_029281585.2_NHGRI_mGorGor1-v2.0_pri") sys.exit(-1) -def main(): refSeqAsmId = sys.argv[1] genBankAsmId = sys.argv[2] if not refSeqAsmId.startswith("GCF_"): print(f"ERROR: refSeqAsmId does not start with GCF_: {refSeqAsmId}") sys.exit(-1) if not genBankAsmId.startswith("GCA_"): print(f"ERROR: genBankAsmId does not start with GCA_: {genBankAsmId}") sys.exit(-1) # obtain the directories where the assembly build exists rBuildPath = buildPath(refSeqAsmId) ic(rBuildPath) gBuildPath = buildPath(genBankAsmId) @@ -167,21 +162,15 @@ > do.log 2>&1 cd {gBuildPath} ./doTrackDb.bash """ doCmd.write(f"{outStr}") print(f"running:\n{runSh}") os.chmod(runSh, 0o775) stdOut, stdErr = subProcess([runSh]) print(f"output from run.sh:\n{stdOut}\n{stdErr}") sys.exit(0) - -### this construct prevents main() from being parsed and syntax checked -### before the version_info < 3.6 safety check - -if __name__ == "__main__": - main()