6f726d2bcdb4fca993c06cf2181dce97b061702d kate Thu Feb 22 08:59:49 2018 -0800 Add support for custom tracks and hub tracks. refs #17512 diff --git src/hg/hgTables/custom.c src/hg/hgTables/custom.c index fcd7cec..cfea1fa 100644 --- src/hg/hgTables/custom.c +++ src/hg/hgTables/custom.c @@ -83,30 +83,32 @@ int fieldCount = 3; if (ct == NULL) return(NULL); AllocVar(hti); hti->rootName = cloneString(ct->tdb->table); hti->isPos = TRUE; hti->isSplit = FALSE; hti->hasBin = FALSE; hti->type = cloneString(ct->tdb->type); if (sameString("pgSnp", hti->type)) fieldCount = 4; /* only 4 bed-like */ else if (sameString("barChart", hti->type)) fieldCount = 6; /* only 6 bed-like */ +else if (sameString("interact", hti->type)) + fieldCount = 5; /* only 5 bed-like */ else if (sameString("bedDetail", hti->type)) fieldCount = ct->fieldCount - 2; /* bed part 4-12 */ else fieldCount = ct->fieldCount; if (fieldCount >= 3) { strncpy(hti->chromField, "chrom", 32); strncpy(hti->startField, "chromStart", 32); strncpy(hti->endField, "chromEnd", 32); } if (fieldCount >= 4) { strncpy(hti->nameField, "name", 32); } if (fieldCount >= 5) @@ -480,43 +482,46 @@ { struct customTrack *ct = ctLookupName(name); struct bedFilter *bf = NULL; struct bed *bedList = NULL; struct hash *idHash = NULL; struct region *region; int fieldCount; if (ct == NULL) errAbort("Can't find custom track %s", name); char *type = ct->dbTrackType; if (type != NULL && (startsWithWord("makeItems", type) || sameWord("bedDetail", type) || sameWord("barChart", type) || + sameWord("interact", type) || sameWord("pgSnp", type))) { struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH); bedList = dbGetFilteredBedsOnRegions(conn, CUSTOM_TRASH, db, ct->dbTableName, name, regionList, lm, retFieldCount); hFreeConn(&conn); fieldCount = 9; if (sameWord("bedDetail", type)) fieldCount = *retFieldCount; else if (sameWord("pgSnp", type)) fieldCount = 4; else if (sameWord("barChart", type)) fieldCount = 6; + else if (sameWord("interact", type)) + fieldCount = 5; } else if (ct->wiggle) { struct bed *wigBedList = NULL, *bed; /* Grab filtered beds for each region. */ for (region = regionList; region != NULL; region = region->next) { wigBedList = getWiggleAsBed(NULL, name, region, NULL, NULL, lm, NULL); for (bed = wigBedList; bed != NULL; bed = bed->next) { struct bed *copy = lmCloneBed(bed, lm); slAddHead(&bedList, copy); } /*bedFree(&wigBedList); do not free local memory*/ @@ -582,30 +587,31 @@ } if (count == 0) explainWhyNoResults(f); } void doTabOutCustomTracks(char *db, char *table, struct sqlConnection *conn, char *fields, FILE *f) /* Print out selected fields from custom track. If fields * is NULL, then print out all fields. */ { struct customTrack *ct = ctLookupName(table); char *type = ct->tdb->type; if (startsWithWord("makeItems", type) || sameWord("bedDetail", type) || sameWord("barChart", type) || + sameWord("interact", type) || sameWord("pgSnp", type)) { struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH); doTabOutDb(CUSTOM_TRASH, db, ct->dbTableName, table, f, conn, fields); hFreeConn(&conn); } else doTabOutBedLike(ct, table, conn, fields, f); } void removeNamedCustom(struct customTrack **pList, char *name) /* Remove named custom track from list if it's on there. */ { struct customTrack *newList = NULL, *ct, *next;