6c3389d97b58ad04533a072efa1858dcadcf00e1 max Thu Jun 1 09:22:08 2017 -0700 allowing default gene and removing assembly if not known, refs #13634 diff --git src/hg/hgGeneGraph/hgGeneGraph src/hg/hgGeneGraph/hgGeneGraph index b1745b7..f153ff6 100755 --- src/hg/hgGeneGraph/hgGeneGraph +++ src/hg/hgGeneGraph/hgGeneGraph @@ -215,33 +215,34 @@ .tooltip.right { margin-left: 20px; } .tooltip.left { margin-left: -20px; } </style> """) def htmlHeader(): " print start of page " webStartGbNoBanner("", "Genome Browser Gene Interaction Graph") print('<body class="hgc cgi">') printMenuBar() - db = getCgiVar("db", "hg19") - printHgcHeader(db, "Protein Interactions Track", "Protein interactions and pathways from curated databases and text-mining", addGoButton=False, infoUrl=MANUALURL) - + db = getCgiVar("db") + printHgcHeader(db, "Protein Interactions Track", + "Protein interactions and pathways from curated databases and text-mining", + addGoButton=False, infoUrl=MANUALURL, infoMouseOver="Open help page") def mustBeClean(str): """ make sure a string contains only letters and digits """ if str==None: return str str = urllib.unquote(str) str = str.strip() for s in str: if s not in legalChars: errAbort("illegal character in CGI parameter") return str def getCgiVar(name, default=None, allowAnyChar=False, maxLen=30): @@ -931,31 +932,31 @@ def printDropdown(cgiArgName, selectedName, options, addStr=""): " 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 """Gene:""" + print """<b>Gene:</b>""" print '<input type="text" size="6" name="gene" value="%s" />' % targetGene print " " print '<input type="submit" name="1" value="OK">' print " " 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() @@ -967,37 +968,37 @@ #printCheckbox("text", "text" in filterTags, onChangeAttr) #print '<span style="background:%s;color:white" title="Show interactions automatically extracted from PubMed abstracts with text-mining software in grey." onclick="">Text-Mining</span>' % TEXTCOLOR print " " #if addNeighbors: #addNeighborLink = makeSelfLink("Show only %s links" % targetGene, {"onlyDirect":"1"}) #print("Only %s-interacting genes and only the most-mentioned interactions are shown. (%s)<br>" % (targetGene, noNeighborLink)) #else: #addNeighborLink = makeSelfLink("Show links between neighbors", {"onlyDirect":None}) #print("Only %s interactions are shown (%s)<br>" % (targetGene, addNeighborLink)) #print(addNeighborLink) hideIndirectStatus = (getCgiVar("hideIndirect")=="on") printCheckbox("hideIndirect", hideIndirectStatus, onChangeAttr) - print '<span style="">Hide non-%s interactions</span>' % targetGene + print '<span style="font-weight:bold">Hide non-%s interactions</span>' % targetGene print " " geneCount = getCgiVar("geneCount", DEFGENECOUNT) - print "Show top" + print "<b>Show top" print '<input name="geneCount" type="text" size="3" value="%s">' % geneCount - print "Genes on graph" + print "Genes on graph</b>" print " " printSelfHiddenVars({}, skipList=["supportLevel", "hideIndirect", "gene"]) print "</form>" print "</small>" def printDropDownMenu(label, entries, tooltip, selectedLabel=None): " output bootstrap dropdown menu of links " print print('<span class="dropdown">') if tooltip is not None: print('<button class="btn btn-default btn-sm dropdown-toggle dropdown-toggle-split" type="button" id="dropdownMenu1" data-toggle="dropdown" title="%s" aria-haspopup="true" aria-expanded="false">' % tooltip) else: print('<button class="btn btn-default btn-sm dropdown-toggle dropdown-toggle-split" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">') @@ -1908,34 +1909,35 @@ sqlQuery(conn, "CREATE TABLE ggFeedback (causeGene varchar(255), themeGene varchar(255), pmid varchar(255), " \ "comment varchar(10000), time TIMESTAMP, ip varchar(255), INDEX allIdx (causeGene, themeGene, pmid));") cur = conn.cursor() cur.execute("INSERT INTO ggFeedback VALUES (%s, %s, %s, NOW(), %s, %s)", (causeGene, themeGene, 0, comment, ip)) cur.close() conn.close() print ("Interaction successfully removed.<p>") lastGene = getCgiVar("lastGene") linkUrl = makeSelfUrl({"gene":None, "link":"%s:%s" % (causeGene, themeGene), "lastGene":lastGene}) print ('Return to the <a href="%s">Interaction page</a></p>' % linkUrl) def parseGraphArgs(): " get the arguments to build a graph from the CGI parameters " - gene = getCgiVar("gene").rstrip(":") - if gene==None: - print "missing CGI parameter 'gene' or 'link'" - exit(0) + gene = getCgiVar("gene") + if gene is None: + gene = "MTOR" + + gene = gene.rstrip(":") gene = gene.split()[0] gene = gene.upper() alg = getCgiVar("alg") if alg==None: alg= "neato" addNeighbors = (getCgiVar("hideIndirect")!="on") sortByCount = getCgiVar("sortByCount") geneCount = getCgiVar("geneCount", DEFGENECOUNT) if not geneCount.isdigit(): errAbort("geneCount must be a number") geneCount = int(geneCount) if geneCount > 200: