098b0567c51ecc6e2098f17d8fbcf9dcf4f830ca
angie
  Tue Nov 13 12:25:19 2012 -0800
Problem: when we have a BAM or VCF track with per-chromosome files,and then view a chromosome for which there is no file (e.g. a random
or hap), hgTracks was hitting an early errAbort that is more appropriate
for a single-big-file track that is missing its filename. Fix: allow
bbiNameFromTableChrom to return NULL if there is a seqName column and
there simply isn't a file for that seqName.

diff --git src/hg/lib/vcfUi.c src/hg/lib/vcfUi.c
index f9fa729..b202065 100644
--- src/hg/lib/vcfUi.c
+++ src/hg/lib/vcfUi.c
@@ -119,32 +119,39 @@
     puts("</TABLE>");
     }
 }
 
 //TODO: share this code w/hgTracks, hgc in hg/lib/vcfFile.c
 static struct vcfFile *vcfHopefullyOpenHeader(struct cart *cart, struct trackDb *tdb)
 /* Defend against network errors and return the vcfFile object with header data, or NULL. */
 {
 #if (defined USE_TABIX && defined KNETFILE_HOOKS)
 knetUdcInstall();
 if (udcCacheTimeout() < 300)
     udcSetCacheTimeout(300);
 #endif//def USE_TABIX && KNETFILE_HOOKS
 char *db = cartString(cart, "db");
 struct sqlConnection *conn = hAllocConnTrack(db, tdb);
-char *fileOrUrl = bbiNameFromSettingOrTableChrom(tdb, conn, tdb->table, hDefaultChrom(db));
+char *fileOrUrl = NULL;
+char *chrom = cartOptionalString(cart, "c");
+if (chrom != NULL)
+    fileOrUrl = bbiNameFromSettingOrTableChrom(tdb, conn, tdb->table, chrom);
+if (fileOrUrl == NULL)
+    fileOrUrl = bbiNameFromSettingOrTableChrom(tdb, conn, tdb->table, hDefaultChrom(db));
 hFreeConn(&conn);
+if (fileOrUrl == NULL)
+    return NULL;
 int vcfMaxErr = 100;
 struct vcfFile *vcff = NULL;
 /* protect against temporary network error */
 struct errCatch *errCatch = errCatchNew();
 if (errCatchStart(errCatch))
     {
     vcff = vcfTabixFileMayOpen(fileOrUrl, NULL, 0, 0, vcfMaxErr, -1);
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError)
     {
     if (isNotEmpty(errCatch->message->string))
 	warn("unable to open %s: %s", fileOrUrl, errCatch->message->string);
     }
 errCatchFree(&errCatch);