4727e0251c76f69905d0748adab43484166d6870
angie
  Fri Mar 14 16:42:14 2014 -0700
In code review, Max pointed out that it's non-standard to conditionallyinclude header files in the middle of a .c file.  While looking at it,
I realized that there were a lot of unnecessary #ifdef's for KNETFILE_HOOKS
in general, all because there was not yet an #else implementation of
knetUdcInstall, which can be a no-op if KNETFILE_HOOKS is not used.
So I yanked out a lot of unnecessary old stuff, and tested basic bam and
vcf track operations with a few settings:

USE_SAMTABIX   USE_BAM   USE_TABIX   KNETFILE_HOOKS
1     (these tree are all implied by USE_SAMTABIX)
0        1          0       0
0        1          0       1
0        0          1       1
USE_TABIX without KNETFILE_HOOKS doesn't work because the tabix lib
wants to download .tbi files into the current working directory,
cgi-bin, and we don't allow that (and shouldn't!).  If we were going
to support that, we could add a change-dir solution as in bamFile.c,
but I don't think we need to support it now that there's samtabix.

refs #6235, refs #12850

diff --git src/hg/hgTracks/vcfTrack.c src/hg/hgTracks/vcfTrack.c
index fedb8ad..9621108 100644
--- src/hg/hgTracks/vcfTrack.c
+++ src/hg/hgTracks/vcfTrack.c
@@ -1,29 +1,32 @@
 /* vcfTrack -- handlers for Variant Call Format data. */
 
 #include "common.h"
 #include "bigWarn.h"
 #include "dystring.h"
 #include "errCatch.h"
 #include "hacTree.h"
 #include "hdb.h"
 #include "hgColors.h"
 #include "hgTracks.h"
 #include "pgSnp.h"
 #include "trashDir.h"
 #include "vcf.h"
 #include "vcfUi.h"
+#include "knetUdc.h"
+#include "udc.h"
+
 
 static boolean getMinQual(struct trackDb *tdb, double *retMinQual)
 /* Return TRUE and set retMinQual if cart contains minimum QUAL filter */
 {
 if (cartUsualBooleanClosestToHome(cart, tdb, FALSE,
 				  VCF_APPLY_MIN_QUAL_VAR, VCF_DEFAULT_APPLY_MIN_QUAL))
     {
     if (retMinQual != NULL)
 	*retMinQual = cartUsualDoubleClosestToHome(cart, tdb, FALSE, VCF_MIN_QUAL_VAR,
 						   VCF_DEFAULT_MIN_QUAL);
     return TRUE;
     }
 return FALSE;
 }
 
@@ -1120,35 +1123,30 @@
 }
 
 static void indelTweakMapItem(struct track *tg, struct hvGfx *hvg, void *item,
         char *itemName, char *mapItemName, int start, int end, int x, int y, int width, int height)
 /* Pass the original vcf chromStart to pgSnpMapItem, so if we have trimmed an identical
  * first base from item's alleles and start, we will still pass the correct start to hgc. */
 {
 struct pgSnpVcfStartEnd *psvs = item;
 pgSnpMapItem(tg, hvg, item, itemName, mapItemName, psvs->vcfStart, psvs->vcfEnd,
 	     x, y, width, height);
 }
 
 
 #ifdef USE_TABIX
 
-#ifdef KNETFILE_HOOKS
-#include "knetUdc.h"
-#include "udc.h"
-#endif//def KNETFILE_HOOKS
-
 static void vcfTabixLoadItems(struct track *tg)
 /* Load items in window from VCF file using its tabix index file. */
 {
 char *fileOrUrl = NULL;
 /* Figure out url or file name. */
 if (tg->parallelLoading)
     {
     /* do not use mysql during parallel-fetch load */
     fileOrUrl = trackDbSetting(tg->tdb, "bigDataUrl");
     }
 else
     {
     struct sqlConnection *conn = hAllocConnTrack(database, tg->tdb);
     fileOrUrl = bbiNameFromSettingOrTableChrom(tg->tdb, conn, tg->table, chromName);
     hFreeConn(&conn);
@@ -1181,33 +1179,31 @@
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError || vcff == NULL)
     {
     if (isNotEmpty(errCatch->message->string))
 	tg->networkErrMsg = cloneString(errCatch->message->string);
     tg->drawItems = bigDrawWarning;
     tg->totalHeight = bigWarnTotalHeight;
     }
 errCatchFree(&errCatch);
 }
 
 void vcfTabixMethods(struct track *track)
 /* Methods for VCF + tabix files. */
 {
-#ifdef KNETFILE_HOOKS
 knetUdcInstall();
-#endif
 pgSnpMethods(track);
 track->mapItem = indelTweakMapItem;
 // Disinherit next/prev flag and methods since we don't support next/prev:
 track->nextExonButtonable = FALSE;
 track->nextPrevExon = NULL;
 track->nextPrevItem = NULL;
 track->loadItems = vcfTabixLoadItems;
 track->canPack = TRUE;
 }
 
 #else // no USE_TABIX:
 
 // If code was not built with USE_TABIX=1, but there are vcfTabix tracks, display a message
 // in place of the tracks (instead of annoying "No track handler" warning messages).