6149c6794aa3b64b8d2cecd3f3a948bfa7d0a5d8 max Wed Mar 11 03:42:42 2020 -0700 adapting clinvar colors for refs #25118, and tiny mouseover fix diff --git src/hg/utils/otto/clinvar/clinVarToBed src/hg/utils/otto/clinvar/clinVarToBed index 97866d6..eb1580c 100755 --- src/hg/utils/otto/clinvar/clinVarToBed +++ src/hg/utils/otto/clinvar/clinVarToBed @@ -306,30 +306,33 @@ if "noassertion" in revStatus or revStatus=="-": starCount = 0 if starCount == None: print(("Illegal review status: %s" % revStatus)) assert(False) emptyStarCount = 4-starCount htmlList = ["★"]*starCount htmlList.extend( ["☆"]*emptyStarCount ) htmlStr = "".join(htmlList) htmlStr += " <small>based on: %s</small>" % reviewStatus + if starCount==1: + asciiDesc = "%d star" % starCount + else: asciiDesc = "%d stars" % starCount return htmlStr, asciiDesc, starCount def downloadFromNcbi(skipDownload): " download files from NCBI and return triple of filenames " today = date.today().isoformat() outSuffix = "%s." % today url = "https://ftp.ncbi.nlm.nih.gov/pub/clinvar/tab_delimited/variant_summary.txt.gz" outFname = "archive/variant_summary.%s.txt.gz" % today filename = outFname # get the new variant allele file varUrl = "https://ftp.ncbi.nlm.nih.gov/pub/clinvar/tab_delimited/variation_allele.txt.gz" varFname = join(dirname(filename), "variation_allele.%s.txt.gz" % today) @@ -464,52 +467,49 @@ thickStart = start thickEnd = end itemRgb = "0" blockCount = "1" blockSizes = str(int(end)-int(start)) blockStarts = "0" # used until Oct 2017 # if dbVarAcc.startswith("nsv") or "copy number" in allType: # now using just size on genome, see #20268 if (int(end)-int(start))>100: isCnv = True else: isCnv = False + pathoCode = clinSignToPathoCode(clinSign) + if isCnv: if "gain" in allType or "duplication" in allType: itemRgb = "0,0,255" if "deletion" in allType or "loss" in allType: itemRgb = "255,0,0" else: - isPat, isBen = False, False - if "pathogenic" in clinSign.lower(): - isPat = True - if "benign" in clinSign.lower(): - isBen = True - - if (isPat==True and isBen==True) or (isPat==False and isBen==False): - itemRgb = "128,128,128" - elif isPat==True: + if pathoCode in ["PG", "LP"]: # pathogenic or likely pathogenic itemRgb = "210,0,0" - elif isBen==True: + elif pathoCode in ["BN", "LB"]: # benign or likely benign itemRgb = "0,210,0" + elif pathoCode in ["CF"]: # conflicting + itemRgb = "137,121,212" # light-blue + elif pathoCode in ["OT", "UC"]: # uncertain or other + itemRgb = "128,128,128" # grey else: assert(False)# should never happen - pathoCode = clinSignToPathoCode(clinSign) varLen = int(end)-int(start) geneStr = geneSymbol if geneId.isdigit() and geneId!="-1": geneStr = geneId+"|"+geneSymbol if len(geneStr)>250: geneStr = "not shown, too many genes" if name=="": name = "No display name was provided by ClinVar for this variant" shortName = "NoName" if len(name)>90: name = name[:90]+"..." name = varId+"|"+name