14d5ef6dec5cf726ae7e59384352ae1188b0ef6b chmalee Fri Aug 14 14:45:56 2020 -0700 Updating clinGenDosage build script after feedback from clingen diff --git src/hg/utils/otto/clinGen/processClinGenDosage.py src/hg/utils/otto/clinGen/processClinGenDosage.py index be84d97..fe22d0f 100755 --- src/hg/utils/otto/clinGen/processClinGenDosage.py +++ src/hg/utils/otto/clinGen/processClinGenDosage.py @@ -53,41 +53,37 @@ print("Only one of regionFile or geneFile can be stdin") sys.exit(1) return args def getColor(bed): """Return the shade of the item according to ClinGen rules. Red or blue for score 3, everything else gray.""" retColors = {"haplo": "128,128,128", "triplo": "128,128,128"} if bed["Haploinsufficiency Score"] == "3": retColors["haplo"] = "255,0,0" if bed["Triplosensitivity Score"] == "3": retColors["triplo"] = "0,0,255" return retColors def getMouseover(bed): """Return the mouseOver strings for this bed record.""" hapScore = bed["Haploinsufficiency Score"] - if not hapScore or hapScore == "Not yet evaluated": - hapScore = -1 tripScore = bed["Triplosensitivity Score"] - if not tripScore or tripScore == "Not yet evaluated": - tripScore = -1 ret = {"haplo": "", "triplo": ""} mouseOver = "Gene/ISCA ID: %s" % bed["name"] ret["triplo"] = mouseOver + ", Triplosensitivity: " - ret["triplo"] += "%s - %s" % (tripScore, scoreExplanation[int(tripScore)]) + ret["triplo"] += "%s - %s" % (tripScore, scoreExplanation[int(tripScore)] if tripScore and tripScore != "Not yet evaluated" else -1) ret["haplo"] = mouseOver + ", Haploinsufficiency: " - ret["haplo"] += "%s - %s" % (hapScore, scoreExplanation[int(hapScore)]) + ret["haplo"] += "%s - %s" % (hapScore, scoreExplanation[int(hapScore)] if hapScore and hapScore != "Not yet evaluated" else -1) return ret def parsePosition(posStr): """Turn a chr:start-stop string into bed chrom, chromStart, chromEnd""" try: colonDelim = posStr.split(":") chrom = colonDelim[0] dashDelim = colonDelim[1].split("-") start = int(dashDelim[0]) - 1 end = int(dashDelim[1]) except IndexError: sys.stderr.write("bad position string: %s\n" % posStr) sys.exit(1) return (chrom, start, end) @@ -189,33 +185,31 @@ triploBed += [bed[field] for field in triploFields] + [bed ["_mouseOver"]["triplo"]] print("\t".join(haploBed), file=haploFile) print("\t".join(triploBed), file=triploFile) haploFile.close() triploFile.close() def parseOmim(infh): with open(infh) as f: for line in f: omimId,phenotype = line.strip().split('\t') omimData[omimId] = phenotype def parseInFile(fname, fileType="gene"): if fname != "stdin": f = open(fname) - else: - f = sys.stdin - lineNumber = 0 + lineNumber = 1 for line in f: lineNumber += 1 bizarreRecord = False if line.startswith("#"): continue l = line.strip("\n").split("\t") key = l[0] # geneSymbol or ISCA id extra = l[1:] if key in inData: print("duplicate info for gene symbol: '%s'" % (geneSymbol)) sys.exit(1) else: temp = {} fileFields = [] if fileType == "gene":