8f07ea1e9137dc164688def8459f6784879ebbeb
max
  Sun Jun 4 08:09:48 2017 -0700
fixes for openbel dataset in hgGeneGraph, refs #13634

diff --git src/hg/hgGeneGraph/hgGeneGraph src/hg/hgGeneGraph/hgGeneGraph
index c463d06..94ae679 100755
--- src/hg/hgGeneGraph/hgGeneGraph
+++ src/hg/hgGeneGraph/hgGeneGraph
@@ -89,31 +89,31 @@
 
 # ==== GLOBALS =====
 
 # CGI parameters as a FieldStorage object
 # args = None
 
 # external DB information
 dbData = {
 "kegg" : ("KEGG", "http://www.kegg.jp/kegg-bin/show_pathway?%s"),
 "wikipathways" : ("WikiPathways", "http://www.wikipathways.org/index.php/Pathway:%s"),
 "iref" : ("Iref", "http://wodaklab.org/iRefWeb/interaction/show/%s"),
 #"pid" : ("NCI Pathway Database", "http://pid.nci.nih.gov/search/InteractionPage?atomid=%s"),
 #PID server is down, linking to NDex now, adapted the IDs, see ggPidToTables
 "pid" : ("NCI Pathway Database", "http://www.ndexbio.org/#/search?searchType=All&searchString=labels%%253A%s"),
 "biocarta" : ("BioCarta", "https://cgap.nci.nih.gov/Pathways/BioCarta/%s"),
-"belLarge" : ("OpenBEL Large Corpus", "http://www.ndexbio.org/#/newNetwork/%s"),
+"belLarge" : ("OpenBEL", "http://www.ndexbio.org/#/newNetwork/%s"),
 "reactome" : ("Reactome", "http://www.reactome.org/content/detail/%s"),
 "go" : ("Gene Ontology Complexes", "http://www.ebi.ac.uk/QuickGO/GTerm?id=%s#info=2"),
 "fastforward" : ("FastForward", "http://fastforward.sys-bio.net/popup.php?name_target=%s"),
 "argdb" : ("ARGDB", "http://argdb.fudan.edu.cn/geneshow_id.php?gene_id=%s"),
 "corum" : ("MIPS CORUM", "http://mips.helmholtz-muenchen.de/genre/proj/corum/complexdetails.html?id=%s"),
 "string" : ("STRING", "http://string-db.org/newstring_cgi/show_network_section.pl?multiple_input_items=%s&multi_input=1&multiple_input_type=multi_identifier&limit=0&input_page_type=multiple_identifiers&have_user_input=2&species_text=Homo%%20sapiens&input_query_species=auto_detect&flash=15&required_score=400")
 }
 
 # mime types to send in http header for other downloads
 mimeTypes = {
 "svg" : "image/svg+xml",
 "pdf" : "application/pdf",
 "json" : "application/json",
 "sif" : "application/octet-stream"
 }
@@ -701,32 +701,30 @@
         d["URL"] = url
         if g==targetGene:
             if g not in geneAnnots:
                 d["penwidth"] = "1"
                 d["fontcolor"] = "black"
                 d["fillcolor"] = "yellow"
                 d["color"] = "blue"
             else:
                 d["penwidth"] = "3"
                 d["color"] = "yellow"
 
         ofh.write('"%s" %s;\n' % (g, dictToDot(d)))
 
     # write the links between genes
     for gene1, gene2, score, docCount, dbs, tags, minResCount, snippet in links:
-        dbs = [x.upper() for x in dbs if x!='']
-
         addStr = ""
 
         # based on http://www.w3schools.com/tags/ref_colorpicker.asp?colorhex=F0F8FF
         color = None
         if "pwy" in tags or ("ppi" in tags and minResCount<=LTCUTOFF):
             color = LTCOLOR+TRANSPARENCY #"#000099A0"
         elif "ppi" in tags:
             color = HTCOLOR+TRANSPARENCY # "#8080CCA0"
 
         if color:
             addStr = 'color="%s";' % color
 
         if gene2==gene1:
             addStr += 'len="5"; '
         thick = pmidCountToThick(score)
@@ -736,39 +734,42 @@
         elif "fwd" in tags:
             arrDir = "forward"
         elif "rev" in tags:
             arrDir = "back"
         else:
             arrDir = "none"
 
         if "text" in tags:
             style = "solid"
         else:
             style = "dashed"
             thick = 1
 
         tooltipLines = ["<b>%s-%s</b> " % (gene1, gene2)]
         tooltipLines.append("<ul>")
+
+        dbs = [x.upper().replace("BELLARGE","OpenBEL") for x in dbs if x!='']
         if len(dbs)==0:
             tooltipLines.append("<li>No curated information")
         else:
             suffix = ""
             if len(dbs)>3:
                 suffix = "..."
             tooltipLines.append("<li>Databases: %s%s" % (", ".join(dbs[:3]), suffix))
 
         if docCount==0:
+            if minResCount!=0:
                 tooltipLines.append("<li>%d interactions were curated from source document" % minResCount)
             tooltipLines.append("<li>No text-mining data")
             thick = minResToThick(minResCount)
         else:
             tooltipLines.append("<li>Text-mining: %d abstracts" % docCount)
         if linkSnips.get( (gene1, gene2), None):
             snip = linkSnips[(gene1, gene2)].replace(" , ", ", ")
             tooltipLines.append(" e.g. <i>"+snip+"</i>")
 
         tooltipLines.append("</ul>")
         tooltipLines.append("&nbsp;<small>Click link to show details</small>")
             
         tooltip = "".join(tooltipLines)
 
         url = makeSelfUrl({"gene" : None, "lastGene":targetGene, "link":gene2+":"+gene1})
@@ -918,31 +919,31 @@
     " print a html dropdown <select> box. "
     print("<select name='%s'%s>" % (cgiArgName, addStr))
     for name, label in options:
         addStr = ""
         if name==selectedName:
             addStr = " selected"
 
         print('<option value="%s"%s>%s</option>' % (name, addStr, label))
     print("</select>")
 
 def printFilterMenu(targetGene, addNeighbors):
     # form to filter by type
     print "<small>"
     print '<form name="filterForm" action="%s" method="GET">' % makeSelfUrl({}, True)
     print """<b>Gene:</b>""" 
-    print '<input type="text" size="6" name="gene" value="%s" />' % targetGene
+    print '<input type="text" size="10" name="gene" value="%s" />' % targetGene
     print "&nbsp;"
     print '<input type="submit" name="1" value="OK">'
     print "&nbsp;&nbsp;&nbsp;"
 
 
     supportLevel = getCgiVar("supportLevel", "text")
     if supportLevel not in ["text", "pwy", "ppi"]:
         errAbort("Illegal value for the supportLevel argument. Can only be text,pwy or ppi.")
 
     onChangeAttr = '''onchange="document.forms['filterForm'].submit();"'''
 
     printDropdown("supportLevel", supportLevel, [("text", "Show all interactions, even only text-mining support"), ("ppi", "Show only interactions with some database support"), ("pwy", "Show only interactions with pathway database support")], addStr=onChangeAttr )
 
     #filterTags = getFilterStatus()
     #printCheckbox("pwy", "pwy" in filterTags, onChangeAttr)
@@ -1473,30 +1474,31 @@
 
 
         url = dbUrlPat % sourceId
 
         print "<li>"
         if sourceDesc=="":
             if isPpi:
                 sourceDesc = "Interaction"
             else:
                 sourceDesc = "Reaction"
 
         print '%s <a href="%s" target="_BLANK">%s</a>: ' % (dbName, url, sourceDesc)
 
         print entToDesc(causeType, causeName, causeGenes)
 
+        desc = ""
         if themeGenes!="":
             if isPpi:
                 print "&#8212;" # unicode long dash
             else:
                 print "&#8594;" # Unicode Arrow
 
             desc = entToDesc(themeType, themeName, themeGenes)
             print desc
 
         if relType!="" or relSubtype!="":
             if relType!="" and relSubtype!="":
                 print "(%s/%s)" % (relType, relSubtype)
             elif relType!="":
                 print "(%s)" % (relType)
             elif relSubtype!="":