491395482b817cfe82cbdef4dd7f8ee0723c1a4a
angie
  Wed Mar 23 21:01:49 2011 -0700
Feature #2822, #2823 (VCF customFactory + track handler):Added a new track type, vcfTabix, with handlers in hgTracks and hgc
and a customFactory.  It is a new bigDataUrl type of track; the
remote VCF file must be compressed and indexed by tabix, so like
BAM a separate index file is required.  If the VCF file has
genotypes, then each sample's two haplotypes are graphed in a
line, with one line per sample.  Otherwise, alleles and counts
(if available) are drawn using Belinda's pgSnp methods.
The source code has to be compiled with USE_TABIX=1 (which is
automatically set for us by common.mk when it finds the local
installation) in order for the CGIs to recognize the track type.

diff --git src/hg/hgTracks/bamTrack.c src/hg/hgTracks/bamTrack.c
index 6b47344..5d3a3ae 100644
--- src/hg/hgTracks/bamTrack.c
+++ src/hg/hgTracks/bamTrack.c
@@ -751,30 +751,32 @@
 /* Draw linked features items. */
 {
 linkedFeaturesDraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width,
         font, color, vis);
 
 if(tg->customInt)
     doMapBoxPerRow(tg, seqStart, seqEnd, hvg, xOff, yOff, width,
             font, color, vis);
 }
 
 void bamMethods(struct track *track)
 /* Methods for BAM alignment files. */
 {
 #if (defined USE_BAM && defined KNETFILE_HOOKS)
 knetUdcInstall();
+if (udcCacheTimeout() < 300)
+    udcSetCacheTimeout(300);
 #endif//def USE_BAM && KNETFILE_HOOKS
 
 track->canPack = TRUE;
 boolean compositeLevel = isNameAtCompositeLevel(track->tdb, BAM_PAIR_ENDS_BY_NAME);
 boolean isPaired = cartUsualBooleanClosestToHome(cart, track->tdb, compositeLevel,
 			 BAM_PAIR_ENDS_BY_NAME,
 			 (trackDbSettingClosestToHome(track->tdb, BAM_PAIR_ENDS_BY_NAME) != NULL));
 char *tdbShowNames = trackDbSetting(track->tdb, BAM_SHOW_NAMES);
 boolean showNames = cartUsualBooleanClosestToHome(cart, track->tdb, compositeLevel,
 						  BAM_SHOW_NAMES, !sameOk(tdbShowNames, "off"));
 char *colorMode = cartOrTdbString(cart, track->tdb, BAM_COLOR_MODE, BAM_COLOR_MODE_DEFAULT);
 char *userTag = cartOrTdbString(cart, track->tdb, BAM_COLOR_TAG, BAM_COLOR_TAG_DEFAULT);
 if (sameString(colorMode, BAM_COLOR_MODE_TAG) && userTag != NULL)
     {
     if (! (isalpha(userTag[0]) && isalnum(userTag[1]) && userTag[2] == '\0'))
@@ -942,54 +944,29 @@
 
 void drawUseBamWarning(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg,
                  int xOff, int yOff, int width, MgFont *font, Color color,
                  enum trackVisibility vis)
 /* Draw a message saying that the code needs to be built with USE_BAM=1. */
 {
 char message[512];
 safef(message, sizeof(message),
       "Get samtools(.sourceforge.net) and recompile kent/src with USE_BAM=1");
 Color yellow = hvGfxFindRgb(hvg, &undefinedYellowColor);
 hvGfxBox(hvg, xOff, yOff, width, tg->heightPer, yellow);
 hvGfxTextCentered(hvg, xOff, yOff, width, tg->heightPer, MG_BLACK, font, message);
 }
 
 void bamMethods(struct track *track)
-/* Methods for BAM alignment files. */
+/* Methods for BAM alignment files, in absence of USE_BAM (samtools lib). */
 {
-linkedFeaturesMethods(track);
-track->loadItems = dontLoadItems;
+messageLineMethods(track);
 track->drawItems = drawUseBamWarning;
-// Following few lines taken from hgTracks.c getTrackList, because this is called earlier
-// but needs to know track vis from tdb+cart:
-char *s = cartOptionalString(cart, track->track);
-if (cgiOptionalString("hideTracks"))
-    {
-    s = cgiOptionalString(track->track);
-    if (s != NULL && (hTvFromString(s) != track->tdb->visibility))
-	{
-	cartSetString(cart, track->track, s);
-	}
-    }
-// end stuff copied from hgTracks.c
-enum trackVisibility trackVis = track->tdb->visibility;
-if (s != NULL)
-    trackVis = hTvFromString(s);
-if (trackVis != tvHide)
-    {
-    track->visibility = tvDense;
-    track->limitedVis = tvDense;
-    track->limitedVisSet = TRUE;
-    }
-track->nextItemButtonable = track->nextExonButtonable = FALSE;
-track->nextPrevItem = NULL;
-track->nextPrevExon = NULL;
 }
 
 void bamWigMethods(struct track *track, struct trackDb *tdb, 
 	int wordCount, char *words[])
 /* Same stub when compiled without USE_BAM. */
 {
 bamMethods(track);
 }
 
 #endif /* no USE_BAM */