03babf928b4b69bce4c86dcf5d0abab9a435e336 max Mon May 15 13:08:09 2017 -0700 fixing strange error when showing only 0 or 1 gene in hgGeneGraph, refs #18626 diff --git src/hg/hgGeneGraph/hgGeneGraph src/hg/hgGeneGraph/hgGeneGraph index 8b39204..6164183 100755 --- src/hg/hgGeneGraph/hgGeneGraph +++ src/hg/hgGeneGraph/hgGeneGraph @@ -509,30 +509,33 @@ # no filtering return links # filter links filtLinks = {} for pair, pairData in links.iteritems(): docCount, dbList, tagSet = pairData[:3] if len(showTags.intersection(tagSet))!=0: filtLinks[pair] = pairData return filtLinks def buildGraph(conn, gene, geneCount, minSupp, addNeighbors): """ get (gene,gene) links from database and annotate with weights and tags only get links with minSupp articles for each link """ + if geneCount <= 1: + errAbort("Sorry, you have to show at least two genes.") + links = queryLinks(conn, gene=gene) if len(links)==0: errAbort("Sorry, the gene %s is not a valid gene symbol or is not present in any gene interaction database." % cgi.escape(gene)) links = filterLinks(links) lowLinks = defaultdict(set) graphLinks, lowLinks = splitHighLowLinks(links, gene, minSupp, lowLinks, geneCount) if addNeighbors: # create the links between all other genes, be less stringent about these otherGenes = set() for genes, pmids in graphLinks.iteritems(): otherGenes.update(genes)