bf1d058d73bdb153279eb4e530d1257d2ccc5675
angie
  Mon Jun 23 10:43:04 2014 -0700
Added ENCODE Regulatory summary tracks for clustered DNase and TFBS,with support for filtering based on BED5 score and factor/cellType/treatment.
refs #11461

diff --git src/hg/hgVai/libifyMe.c src/hg/hgVai/libifyMe.c
index 4d6a6af..7f5b3b1 100644
--- src/hg/hgVai/libifyMe.c
+++ src/hg/hgVai/libifyMe.c
@@ -4,30 +4,31 @@
  * See README in this or parent directory for licensing information. */
 #include "common.h"
 #include "cheapcgi.h"
 #include "customTrack.h"
 #include "grp.h"
 #include "hdb.h"
 #include "hgFind.h"
 #include "hubConnect.h"
 #include "hui.h"
 #include "trackHub.h"
 #include "wikiTrack.h"
 #include "annoGratorQuery.h"
 #include "annoGratorGpVar.h"
 #include "annoStreamBigBed.h"
 #include "annoStreamDb.h"
+#include "annoStreamDbFactorSource.h"
 #include "annoStreamTab.h"
 #include "annoStreamVcf.h"
 #include "annoStreamWig.h"
 #include "annoGrateWigDb.h"
 #include "annoFormatTab.h"
 #include "annoFormatVep.h"
 #include "pgSnp.h"
 #include "vcf.h"
 
 #include "libifyMe.h"
 
 static boolean searchPosition(char *range, struct cart *cart, char *cartVar)
 /* Try and fill in region via call to hgFind. Return FALSE
  * if it can't find a single position. */
 {
@@ -385,30 +386,37 @@
     }
 else if (sameString("vcf", tdb->type))
     {
     char *fileOrUrl = getBigDataFileName(dataDb, tdb, dbTable, chrom);
     streamer = annoStreamVcfNew(fileOrUrl, FALSE, assembly, maxOutRows);
     }
 else if (sameString("bam", tdb->type))
     {
     warn("Sorry, BAM is not yet supported");
     }
 else if (startsWith("bigBed", tdb->type))
     {
     char *fileOrUrl = getBigDataFileName(db, tdb, selTable, chrom);
     streamer = annoStreamBigBedNew(fileOrUrl, assembly, maxOutRows);
     }
+else if (sameString("factorSource", tdb->type))
+    {
+    char *sourceTable = trackDbSetting(tdb, "sourceTable");
+    char *inputsTable = trackDbSetting(tdb, "inputTrackTable");
+    streamer = annoStreamDbFactorSourceNew(db, tdb->track, sourceTable, inputsTable, assembly,
+					   maxOutRows);
+    }
 else
     {
     struct sqlConnection *conn = hAllocConn(dataDb);
     char maybeSplitTable[1024];
     if (sqlTableExists(conn, dbTable))
 	safecpy(maybeSplitTable, sizeof(maybeSplitTable), dbTable);
     else
 	safef(maybeSplitTable, sizeof(maybeSplitTable), "%s_%s", chrom, dbTable);
     hFreeConn(&conn);
     struct asObject *asObj = getAutoSqlForTable(db, dataDb, maybeSplitTable, tdb);
     streamer = annoStreamDbNew(dataDb, maybeSplitTable, assembly, asObj, maxOutRows);
     }
 return streamer;
 }