ad18889898ae327c9c2787fea48ca371527dd41f braney Fri Apr 8 13:36:37 2022 -0700 support vcfTabix schema display on track hubs diff --git src/hg/hgTables/vcf.c src/hg/hgTables/vcf.c index 7a136e3..4320053 100644 --- src/hg/hgTables/vcf.c +++ src/hg/hgTables/vcf.c @@ -2,30 +2,31 @@ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "hgTables.h" #include "asFilter.h" #include "hubConnect.h" #include "asParse.h" #include "hgBam.h" #include "linefile.h" #include "localmem.h" #include "obscure.h" #include "vcf.h" #include "web.h" +#include "trackHub.h" #define VCFDATALINE_NUM_COLS 10 boolean isVcfTable(char *table, boolean *retIsTabix) /* Return TRUE if table corresponds to a VCF file. * If retIsTabix is non-NULL, set *retIsTabix to TRUE if this is vcfTabix (not just vcf). */ { boolean isVcfTabix = FALSE, isVcf = FALSE; struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table); if (tdb) { isVcfTabix = startsWithWord("vcfTabix", tdb->type) || startsWithWord("vcfPhasedTrio", tdb->type); isVcf = startsWithWord("vcf", tdb->type); } else @@ -456,31 +457,33 @@ if (i+1 >= count) { slNameFreeList(&(sl->next)); break; } } freez(&fileName); return idList; } #define VCF_MAX_SCHEMA_COLS 20 void showSchemaVcf(char *table, struct trackDb *tdb, boolean isTabix) /* Show schema on vcf. */ { -struct sqlConnection *conn = hAllocConn(database); +struct sqlConnection *conn = NULL; +if (!trackHubDatabase(database)) + conn = hAllocConn(database); char *fileName = vcfMustFindFileName(conn, table, hDefaultChrom(database), isTabix); struct asObject *as = vcfAsObj(); hPrintf("<B>Database:</B> %s", database); hPrintf(" <B>Primary Table:</B> %s<br>", table); hPrintf("<B>VCF File:</B> %s", fileName); hPrintf("<BR>\n"); hPrintf("<B>Format description:</B> %s<BR>", as->comment); hPrintf("See the <A HREF=\"%s\" target=_blank>Variant Call Format specification</A> for more details<BR>\n", "http://www.1000genomes.org/wiki/analysis/vcf4.0"); /* Put up table that describes fields. */ hTableStart(); hPrintf("<TR><TH>field</TH>"); hPrintf("<TH>description</TH> ");