cf32bd93dfcf0e307c889aaef4e5b1845bbd5a98
max
  Tue Jul 11 17:55:00 2017 -0700
Adding support for GBIB-style remote /gbdb files to hgGeneGraph. refs #19745

diff --git src/hg/hgGeneGraph/hgGeneGraph src/hg/hgGeneGraph/hgGeneGraph
index 8f76d44..78d6e3e 100755
--- src/hg/hgGeneGraph/hgGeneGraph
+++ src/hg/hgGeneGraph/hgGeneGraph
@@ -28,31 +28,32 @@
 # ggLinkEvent (details about link), ggEventDb (details about links from databases), 
 # ggEventText (details about links from text mining), ggDoc (details about documents for ggEventText)
 # ggGeneName (symbols), ggGeneClass (HPRD/Panther class)
 
 # these are default python modules on python 2.7, no errors expected here
 import sys, cgi, os, string, urllib, operator, hashlib
 from sys import exit
 from collections import defaultdict, namedtuple
 from os.path import *
 
 # import the UCSC-specific library
 sys.path.append(join(dirname(__file__), "pyLib"))
 try:
     from hgLib import cgiArgs, cgiSetup, cgiString, printContentType, printMenuBar, \
             sqlConnect, sqlQuery, errAbort, cfgOption, runCmd, cgiGetAll, printHgcHeader, \
-            printHgcSection, webStartGbNoBanner, htmlPageEnd, hConnectCentral, sqlTableExists
+            printHgcSection, webStartGbNoBanner, htmlPageEnd, hConnectCentral, sqlTableExists, \
+            readSmallFile
 except:
     print("Content-type: text/html\n")
     print("Cannot find the directory cgi-bin/pyLib in Apache. This is an installation error.")
     print("All all parts of cgi-bin installed? Did you do 'make' in kent/src/hg/pyLib?")
 
 import MySQLdb
 
 # not using feedback button for now. Fan would have liked it, but not sure how we can write
 # to any form of database.
 
 # the list of allowed chars in cgi args: digits, letters and dashes
 legalChars = set(string.digits)
 legalChars.update(set(string.letters))
 legalChars.update("_-./: ")
 
@@ -1089,42 +1090,41 @@
             #$('.smallDropDownMenu').hide();
         #});
 
     #});
     #'''
     #print '</script>'
 
     print '</div> <!-- right part of menu -->'
 
     print "</small>"
     print '</div> <!-- whole menu -->'
     #print '</div>'
 
 def openGeneAnnotFile(dataName):
     " return name and lines in gbdb tab sep file "
-    gbdbDir = cfgOption("gbdbLoc1", "/gbdb")
     annotData = None
     for annotTuple in geneAnnotFiles:
         if dataName==annotTuple[0]:
             annotData = annotTuple
             break
     if annotData==None:
         errAbort("Could not find annotations with name %s" % dataName)
 
     _, annotFname, annotName, annotLongName = annotData
-    inPath = join(gbdbDir, "hgFixed", "geneGraph", annotFname)
-    ifh = open(inPath)
+    inPath = join("/gbdb", "hgFixed", "geneGraph", annotFname)
+    ifh = readSmallFile(inPath)
     return annotName, ifh
 
 def getGeneAnnots():
     """ depending on the CGI arg 'geneAnnot', parse a file with
     key-whitespace-value and return a dict. Alternative format is
     (key, value, greyscaleBin) where greyscaleBin is 0-9
     """
     annotName = getCgiVar("geneAnnot")
     if annotName==None or annotName=="none":
         return None, {}
     geneAnnot = {}
     annotName, ifh = openGeneAnnotFile(annotName)
     for line in ifh:
         line = line.rstrip("\n")
         if "\t" in line: