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/lib/vcfUi.c src/hg/lib/vcfUi.c index d5f7e88..9caed6d 100644 --- src/hg/lib/vcfUi.c +++ src/hg/lib/vcfUi.c @@ -1,30 +1,28 @@ /* vcfUi - Variant Call Format user interface controls that are shared * between more than one CGI. */ #include "common.h" #include "cheapcgi.h" #include "errCatch.h" #include "hCommon.h" #include "hui.h" #include "jsHelper.h" #include "vcf.h" #include "vcfUi.h" -#if (defined USE_TABIX && defined KNETFILE_HOOKS) #include "knetUdc.h" #include "udc.h" -#endif//def USE_TABIX && KNETFILE_HOOKS INLINE char *nameOrDefault(char *thisName, char *defaultVal) /* If thisName is not a placeholder value, return it; otherwise return default. */ { if (isNotEmpty(thisName) && !sameString(thisName, ".")) return thisName; return defaultVal; } #define VCF_HAPLOSORT_DEFAULT_DESC "middle variant in viewing window" static void vcfCfgHaplotypeCenterHiddens(char *track, char *ctrName, char *ctrChrom, int ctrPos) /* Make hidden form inputs and button for setting the center variant for haplotype * clustering/sorting in hgTracks. */ { @@ -112,35 +110,33 @@ formName, track); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantPos', 0);", formName, track); dyStringPrintf(onClick, "document.%s.submit(); return false;", formName); cgiMakeButtonWithOnClick("submit", "Clear selection", NULL, onClick->string); printf(" (use " VCF_HAPLOSORT_DEFAULT_DESC ")</TD></TR>\n"); } 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"); char *table = tdb->table; char *dbTableName = trackDbSetting(tdb, "dbTableName"); struct sqlConnection *conn; if (isCustomTrack(tdb->track) && isNotEmpty(dbTableName)) { conn = hAllocConn(CUSTOM_TRASH); table = dbTableName; } else conn = hAllocConnTrack(db, tdb); char *fileOrUrl = NULL; char *chrom = cartOptionalString(cart, "c"); if (chrom != NULL) fileOrUrl = bbiNameFromSettingOrTableChrom(tdb, conn, table, chrom);