70d4208efa11f262ba5591198214c9ccdc6b54ae angie Mon Aug 22 22:24:05 2011 -0700 Feature #3707 (VCF+tabix support in hgTables):Basic hgTables support for VCF, modeled after BAM code. Tested all fields, selected fields, bed output; filter, intersection, schema on 3 flavors of vcfTabix: ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20101123/interim_phase1_release/ALL.chr17.phase1.projectConsensus.genotypes.vcf.gz ftp://ftp-trace.ncbi.nlm.nih.gov/1000genomes/ftp/release/20100804/AFR.dindel.20100804.sites.vcf.gz ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/v4.0/ByChromosomeNoGeno/00-All.vcf.gz diff --git src/hg/hgTables/joining.c src/hg/hgTables/joining.c index 0c288cc..e794c4f 100644 --- src/hg/hgTables/joining.c +++ src/hg/hgTables/joining.c @@ -344,30 +344,40 @@ makeOrderedCommaFieldList(fieldList, dtfList, dy); slFreeList(&fieldList); hFreeConn(&conn); } static void makeBamOrderedCommaFieldList(struct joinerDtf *dtfList, struct dyString *dy) /* Make comma-separated field list in same order as fields are in * big bed. */ { struct slName *fieldList = bamGetFields(dtfList->table); makeOrderedCommaFieldList(fieldList, dtfList, dy); slFreeList(&fieldList); } +static void makeVcfOrderedCommaFieldList(struct joinerDtf *dtfList, + struct dyString *dy) +/* Make comma-separated field list in same order as fields are in + * big bed. */ +{ +struct slName *fieldList = vcfGetFields(dtfList->table); +makeOrderedCommaFieldList(fieldList, dtfList, dy); +slFreeList(&fieldList); +} + struct tableJoiner /* List of fields in a single table. */ { struct tableJoiner *next; /* Next in list. */ char *database; /* Database we're in. Not alloced here. */ char *table; /* Table we're in. Not alloced here. */ struct joinerDtf *fieldList; /* Fields. */ struct slRef *keysOut; /* Keys that connect to output. * Value is joinerPair. */ boolean loaded; /* If true is loaded. */ }; void tableJoinerFree(struct tableJoiner **pTf) /* Free up memory associated with tableJoiner. */ @@ -989,30 +999,32 @@ { struct joinerDtf *dtfList = NULL; struct joinerDtf *filterTables = NULL; boolean doJoin = joinRequired(primaryDb, primaryTable, fieldList, &dtfList, &filterTables); if (! doJoin) { struct sqlConnection *conn = hAllocConn(dtfList->database); struct dyString *dy = dyStringNew(0); if (isBigBed(database, dtfList->table, NULL, ctLookupName)) makeBigBedOrderedCommaFieldList(dtfList, dy); else if (isBamTable(dtfList->table)) makeBamOrderedCommaFieldList(dtfList, dy); + else if (isVcfTable(dtfList->table)) + makeVcfOrderedCommaFieldList(dtfList, dy); else if (isCustomTrack(dtfList->table)) makeCtOrderedCommaFieldList(dtfList, dy); else makeDbOrderedCommaFieldList(conn, dtfList->table, dtfList, dy); doTabOutTable(dtfList->database, dtfList->table, f, conn, dy->string); hFreeConn(&conn); } else { struct joiner *joiner = allJoiner; struct joinedTables *joined = joinedTablesCreate(joiner, primaryDb, primaryTable, dtfList, filterTables, 1000000, getRegions()); if (f == NULL) joinedTablesTabOut(joined); else