5472f71152a9d892fc7d7081fad7e7c797d3258a max Fri Jun 27 07:28:30 2025 -0700 requiring valid user cookie to use hgGeneGraph, refs #35391 diff --git src/hg/hgGeneGraph/hgGeneGraph src/hg/hgGeneGraph/hgGeneGraph index b90474abd9f..f7a1ad401c0 100755 --- src/hg/hgGeneGraph/hgGeneGraph +++ src/hg/hgGeneGraph/hgGeneGraph @@ -81,30 +81,33 @@ # Cutoff on minResCount: # maximum number of pairs a study can have to be considered "low-throughput" # only interactions with at least one low-throughput study are colord in dark # In essence, this gets rid of curated papers that describe huge complexes LTCUTOFF=10 # color for edges with only text-mining data ("text") TEXTCOLOR="#BBBBBB" # color for edges with low-throughput data (=pwy or (ppi and LTCUTOFF)) LTCOLOR="#000099" # color for edges with high-throughput data (=ppi) HTCOLOR="#8080CC" # transparency for the gene graph edges TRANSPARENCY="C0" +# do not show more than X snippets +MAXSNIPPETS=100 + # url of the user's manual MANUALURL="../goldenPath/help/hgGeneGraph.html" # database where the tables are stored GGDB="hgFixed" # ==== 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"), @@ -1650,31 +1653,31 @@ #centralDb = cfgOption("central.db") #blackList = set() #rows = sqlQuery(conn, "SELECT causeGene, themeGene, pmid from %s.ggFeedback" % centralDb) #for row in rows: #blackList.add( (row.causeGene, row.themeGene, str(row.pmid)) ) #return blackList def queryEventText(conn, gene1, gene2): " return rows from the ggEventText table " gene1, gene2 = sorted([gene1, gene2]) q = "SELECT ggEventText.*, "\ "ggDoc.authors, ggDoc.title, ggDoc.journal, ggDoc.year, ggDoc.context, ggDoc.resCount " \ "FROM ggLinkEvent, ggEventText " \ "JOIN ggDoc ON (ggDoc.docId=ggEventText.docId) " \ "WHERE gene1='%s' and gene2='%s' AND ggEventText.eventId=ggLinkEvent.eventId " \ - "ORDER BY ggDoc.docId" % (gene1,gene2) + "ORDER BY ggDoc.docId REVERSE LIMIT %d" % (gene1,gene2,MAXSNIPPETS) rows = sqlQuery(conn, q) return rows def htmlInteraction(gene1, gene2): " return html: two genes separated by an arrow from g1 to g2, with links to hgGeneGraph " return '%s → %s' % (gene1, gene1, gene2, gene2) def prettyDocLinks(conn, pmids): " given a list of pmids, return a list of nice links to articles on our own site " quoteList = ['"%s"' % pmid for pmid in pmids] idStr = "(%s)" % (",".join(quoteList)) # XX remove distinct if not needed anymore query = "SELECT authors, title, journal, year, docId, resCount FROM ggDoc WHERE docId IN %s" % idStr rows = sqlQuery(conn, query) @@ -1702,30 +1705,33 @@ text = "%s %s, %s %s" % (fAu, suffix, row.journal, row.year) mouseOver = None title = row.title if title!="": mouseOver = title.replace('"', "") return docLink(row.docId, text=text, mouseOver=mouseOver)+note def showSnipsLink(conn, gene1, gene2): " show snippets for a gene pair " rows = queryEventText(conn, gene1, gene2) if len(rows)!=0: print('