7bf5a5c3241a66ba15f9763638a04d072f4b9b76 jnavarr5 Fri Apr 24 12:22:11 2026 -0700 Moving the 'if args.force' condition to the begining of the function since the md5sum checks are not needed if we are going to run the update manually. Addressing feedback from code review, refs #37417 diff --git src/hg/utils/otto/genCC/doGenCC.py src/hg/utils/otto/genCC/doGenCC.py index 501a6c28cec..bcedda22fd2 100644 --- src/hg/utils/otto/genCC/doGenCC.py +++ src/hg/utils/otto/genCC/doGenCC.py @@ -275,40 +275,40 @@ chromEnd = geneDic['txEnd'] # Validate coordinates before writing if int(chromStart) > int(chromEnd): skippedCoords+=1 print("Skipping hg19 record with inverted coordinates: "+geneSymbol+" "+chrom+":"+chromStart+"-"+chromEnd) continue outputHg19File.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % (chrom,chromStart,chromEnd, "\t".join(line[3:6]),chromStart,chromEnd,"\t".join(line[8:]))) print("hg19 genCC bed file completed. Total number of failed entries: "+str(n)) if skippedCoords > 0: print("Warning: "+str(skippedCoords)+" hg19 entries skipped due to inverted coordinates") def checkIfUpdateIsNeeded(): bash("wget -q 'https://thegencc.org/download/action/submissions-export-tsv?format=new' -O /hive/data/outside/otto/genCC/newSubmission.tsv") + if args.force: + # Previous file matches current file, but update didn't go through + # because of itemCounts check. + return(True) newMd5sum = bash("md5sum /hive/data/outside/otto/genCC/newSubmission.tsv") newMd5sum = newMd5sum.split(" ")[0] oldMd5sum = bash("md5sum /hive/data/outside/otto/genCC/prevSubmission.tsv") oldMd5sum = oldMd5sum.split(" ")[0] if oldMd5sum != newMd5sum: return(True) - elif args.force: - # Previous file matches current file, but update didn't go through - # because of itemCounts check. - return(True) else: return(False) def checkItemCounts(oldBb, newBb): """Compare item counts between old and new bigBed files. Exit if difference > 10%.""" oldItemCount = bash('bigBedInfo '+oldBb+' | grep "itemCount"') oldItemCount = int(oldItemCount.rstrip().split("itemCount: ")[1].replace(",","")) newItemCount = bash('bigBedInfo '+newBb+' | grep "itemCount"') newItemCount = int(newItemCount.rstrip().split("itemCount: ")[1].replace(",","")) if abs(newItemCount - oldItemCount) > 0.1 * max(newItemCount, oldItemCount): msg = "WARNING:\nItem count difference >10% for "+newBb+":\nold="+str(oldItemCount)+" new="+str(newItemCount) print(msg) if args.force: print("(continuing due to QA approval)") else: