6072cb04b34e57ebdef620512124c4d8722b79df
angie
  Fri Jan 13 11:09:48 2017 -0800
hAnnoGetAssembly assumed that db.2bit would be found in hDbDbNibPath(db) but for old nib/ assemblies it is one level up in /gbdb/db/.  Similar to hdb's hNibForChrom, test file existence and look in ../ as a backup.  fixes #18445

diff --git src/hg/lib/hAnno.c src/hg/lib/hAnno.c
index 63c6b76..faccabd 100644
--- src/hg/lib/hAnno.c
+++ src/hg/lib/hAnno.c
@@ -37,30 +37,36 @@
     {
     if (trackHubDatabase(db))
         {
         struct trackHubGenome *thg = trackHubGetGenome(db);
         char *url = thg->twoBitPath;
         aa = annoAssemblyNew(db, url);
         }
     else
         {
         char *nibOrTwoBitDir = hDbDbNibPath(db);
         if (nibOrTwoBitDir == NULL)
             errAbort("Can't find .2bit for db '%s'", db);
         char twoBitPath[HDB_MAX_PATH_STRING];
         safef(twoBitPath, sizeof(twoBitPath), "%s/%s.2bit", nibOrTwoBitDir, db);
         char *path = hReplaceGbdb(twoBitPath);
+        if (!fileExists(path))
+            {
+            // if 2bit file isn't in nibOrTwoBitDir, try up one directory
+            safef(twoBitPath, sizeof(twoBitPath), "%s/../%s.2bit", nibOrTwoBitDir, db);
+            path = hReplaceGbdb(twoBitPath);
+            }
         aa = annoAssemblyNew(db, path);
         freeMem(path);
         }
     }
 return aa;
 }
 
 static boolean columnsMatch(struct asObject *asObj, struct sqlFieldInfo *fieldList)
 /* Return TRUE if asObj's column names match the given SQL fields. */
 {
 if (asObj == NULL)
     return FALSE;
 struct sqlFieldInfo *firstRealField = fieldList;
 if (sameString("bin", fieldList->field) && differentString("bin", asObj->columnList->name))
     firstRealField = fieldList->next;