83f07ccc670df11816b9c0acffb3bb35b8a89e04
angie
  Fri Sep 18 16:22:38 2015 -0700
Use annoStreamDb with config to add kgXref.geneSymbol to knownGene columns instead of annoStreamDbKnownGene.

diff --git src/hg/lib/hAnno.c src/hg/lib/hAnno.c
index 8f1ba9e..8bbb8d5 100644
--- src/hg/lib/hAnno.c
+++ src/hg/lib/hAnno.c
@@ -8,31 +8,30 @@
 #include "factorSource.h"
 #include "grp.h"
 #include "hdb.h"
 #include "hubConnect.h"
 #include "hui.h"
 #include "jksql.h"
 #include "pgSnp.h"
 #include "trackHub.h"
 #include "vcf.h"
 #include "annoGratorQuery.h"
 #include "annoGratorGpVar.h"
 #include "annoStreamBigBed.h"
 #include "annoStreamBigWig.h"
 #include "annoStreamDb.h"
 #include "annoStreamDbFactorSource.h"
-#include "annoStreamDbKnownGene.h"
 #include "annoStreamTab.h"
 #include "annoStreamVcf.h"
 #include "annoStreamWig.h"
 #include "annoGrateWigDb.h"
 #include "annoFormatTab.h"
 #include "annoFormatVep.h"
 
 //#*** duplicated in hgVarAnnoGrator and annoGratorTester
 struct annoAssembly *hAnnoGetAssembly(char *db)
 /* Make annoAssembly for db. */
 {
 static struct annoAssembly *aa = NULL;
 if (aa == NULL)
     {
     if (trackHubDatabase(db))
@@ -199,37 +198,30 @@
     streamer = annoStreamBigBedNew(fileOrUrl, assembly, maxOutRows);
     }
 else if (startsWith("bigWig", tdb->type))
     {
     char *fileOrUrl = getBigDataFileName(dataDb, tdb, selTable, chrom);
     streamer = annoStreamBigWigNew(fileOrUrl, assembly); //#*** no maxOutRows support
     }
 else if (sameString("factorSource", tdb->type) &&
          dbTableMatchesAutoSql(dataDb, tdb->table, factorSourceAsObj()))
     {
     char *sourceTable = trackDbSetting(tdb, "sourceTable");
     char *inputsTable = trackDbSetting(tdb, "inputTrackTable");
     streamer = annoStreamDbFactorSourceNew(dataDb, tdb->track, sourceTable, inputsTable, assembly,
 					   maxOutRows);
     }
-else if (sameString("knownGene", tdb->track))
-    {
-    struct sqlConnection *conn = hAllocConn(dataDb);
-    if (sqlTableExists(conn, "knownGene") && sqlTableExists(conn, "kgXref"))
-        streamer = annoStreamDbKnownGeneNew(dataDb, assembly, maxOutRows);
-    hFreeConn(&conn);
-    }
 else if (trackHubDatabase(db))
     errAbort("Unrecognized type '%s' for hub track '%s'", tdb->type, tdb->track);
 if (streamer == NULL)
     {
     streamer = annoStreamDbNew(dataDb, dbTable, assembly, maxOutRows, config);
     }
 return streamer;
 }
 
 struct annoGrator *hAnnoGratorFromBigFileUrl(char *fileOrUrl, struct annoAssembly *assembly,
                                              int maxOutRows, enum annoGratorOverlap overlapRule)
 /* Determine what kind of big data file/url we have and make streamer & grator for it. */
 {
 struct annoStreamer *streamer = NULL;
 struct annoGrator *grator = NULL;
@@ -323,35 +315,30 @@
     asObj = pgSnpAsObj();
 else if (sameString("bam", tdb->type) || sameString("maf", tdb->type))
     warn("Sorry, %s is not yet supported", tdb->type);
 else if (startsWithWord("bed", tdb->type) && !strchr(tdb->type, '+'))
     {
     // BED with no + fields; parse bed field count out of type line.
     int bedFieldCount = 3;
     char typeCopy[PATH_LEN];
     safecpy(typeCopy, sizeof(typeCopy), tdb->type);
     char *words[8];
     int wordCount = chopLine(typeCopy, words);
     if (wordCount > 1)
         bedFieldCount = atoi(words[1]);
     asObj = asParseText(bedAsDef(bedFieldCount, bedFieldCount));
     }
-else if (sameString(tdb->track, "knownGene"))
-    {
-    if (hTableExists(db, "knownGene") && hTableExists(db, "kgXref"))
-        asObj = annoStreamDbKnownGeneAsObj();
-    }
 else if (sameString("factorSource", tdb->type) &&
          dbTableMatchesAutoSql(db, tdb->table, factorSourceAsObj()))
     {
     asObj = annoStreamDbFactorSourceAsObj();
     }
 return asObj;
 }
 
 struct asObject *hAnnoGetAutoSqlForTdb(char *db, char *chrom, struct trackDb *tdb)
 /* If possible, return the asObj that a streamer for this track would use, otherwise NULL. */
 {
 struct asObject *asObj = getAutoSqlForType(db, chrom, tdb);
 
 if (!asObj && !isHubTrack(tdb->track))
     {