3668909bc45cf722a9b69e2dafbf5e161a6a87a6
angie
  Wed Dec 14 16:36:45 2016 -0800
annoStreamDb should not be hardcoded to find all.joiner in the current directory.  Now, if env var ALL_JOINER_FILE exists, it will be used instead.  vai.pl can now look for all.joiner in hgVai's parent directory (.../cgi-bin) and use ALL_JOINER_FILE if there is no ./all.joiner.  refs #12216 note-28

diff --git src/hg/lib/annoStreamDb.c src/hg/lib/annoStreamDb.c
index efba308..5dc7ffe 100644
--- src/hg/lib/annoStreamDb.c
+++ src/hg/lib/annoStreamDb.c
@@ -266,40 +266,50 @@
     }
 return hasLeftJoin;
 }
 
 // libify?
 static struct joinerDtf *joinerDtfCloneList(struct joinerDtf *listIn)
 /* Return a list with cloned items of listIn. */
 {
 struct joinerDtf *listOut = NULL, *item;
 for (item = listIn;  item != NULL;  item = item->next)
     slAddHead(&listOut, joinerDtfClone(item));
 slReverse(&listOut);
 return listOut;
 }
 
+static char *joinerFilePath()
+/* Return the location of all.joiner - default is ./all.joiner but a different file
+ * can be substituted using environment variable ALL_JOINER_FILE */
+{
+char *joinerFile = getenv("ALL_JOINER_FILE");
+if (isEmpty(joinerFile))
+    joinerFile = JOINER_FILE;
+return joinerFile;
+}
+
 static void asdInitBaselineQuery(struct annoStreamDb *self)
 /* Build a dy SQL query with no position constraints (select ... from ...)
  * possibly including joins and filters if specified (where ...). */
 {
 if (self->relatedDtfList)
     {
     struct joinerDtf *outputFieldList = slCat(joinerDtfCloneList(self->mainTableDtfList),
                                               joinerDtfCloneList(self->relatedDtfList));
     if (self->joiner == NULL)
-        self->joiner = joinerRead(JOINER_FILE);
+        self->joiner = joinerRead(joinerFilePath());
     int expectedRows = sqlRowCount(self->conn, self->table);
     self->joinMixer = joinMixerNew(self->joiner, self->db, self->table, outputFieldList,
                                    expectedRows, self->naForMissing);
     self->sqlRowSize = slCount(self->joinMixer->sqlFieldList);
     self->bigRowSize = self->joinMixer->bigRowSize;
     joinerDtfFreeList(&outputFieldList);
     }
 else
     {
     self->sqlRowSize = slCount(self->mainTableDtfList);
     self->bigRowSize = self->sqlRowSize;
     }
 }
 
 static void asdUpdateBaselineQuery(struct annoStreamDb *self)