3bbad1670f2e44ca41d06c657b8f8636abfce4fb hiram Wed Mar 27 14:47:11 2019 -0700 provide list chrom function for hubs refs #18869 diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c index d3b4bbb..399c9e8 100644 --- src/hg/hubApi/getData.c +++ src/hg/hubApi/getData.c @@ -75,50 +75,30 @@ char **row = NULL; unsigned itemCount = 0; while (itemCount < maxItemsOutput && (row = sqlNextRow(sr)) != NULL) { jsonWriteObjectStart(jw, NULL); int i = 0; for (i = 0; i < columnCount; ++i) jsonWriteString(jw, columnNames[i], row[i]); jsonWriteObjectEnd(jw); ++itemCount; } sqlFreeResult(&sr); jsonWriteListEnd(jw); } -static struct bbiFile *bigFileOpen(char *trackType, char *bigDataUrl) -{ -struct bbiFile *bbi = NULL; -struct errCatch *errCatch = errCatchNew(); -if (errCatchStart(errCatch)) - { -if (startsWith("bigBed", trackType)) - bbi = bigBedFileOpen(bigDataUrl); -else if (startsWith("bigWig", trackType)) - bbi = bigWigFileOpen(bigDataUrl); - } -errCatchEnd(errCatch); -if (errCatch->gotError) - { - apiErrAbort("error opening bigFile URL: '%s', '%s'", bigDataUrl, errCatch->message->string); - } -errCatchFree(&errCatch); -return bbi; -} - /* from hgTables.h */ struct sqlFieldType /* List field names and types */ { struct sqlFieldType *next; char *name; /* Name of field. */ char *type; /* Type of field (MySQL notion) */ }; /* from hgTables.c */ static struct sqlFieldType *sqlFieldTypeNew(char *name, char *type) /* Create a new sqlFieldType */ { struct sqlFieldType *ft; AllocVar(ft); @@ -205,52 +185,30 @@ struct bbiChromInfo *chromList = NULL; // struct bbiSummaryElement sum = bbiTotalSummary(bwf); if (isEmpty(chrom)) { chromList = bbiChromList(bwf); struct bbiChromInfo *bci; for (bci = chromList; bci; bci = bci->next) { wigDataOutput(jw, bwf, bci->name, 0, bci->size); } } else wigDataOutput(jw, bwf, chrom, start, end); } -static struct trackDb *findTrackDb(char *track, struct trackDb *tdb) -/* search tdb structure for specific track, recursion on subtracks */ -{ -struct trackDb *trackFound = NULL; - -for (trackFound = tdb; trackFound; trackFound = trackFound->next) - { - if (trackFound->subtracks) - { - struct trackDb *subTrack = findTrackDb(track, trackFound->subtracks); - if (subTrack) - { - if (sameOk(subTrack->track, track)) - trackFound = subTrack; - } - } - if (sameOk(trackFound->track, track)) - break; - } -return trackFound; -} - static void getHubTrackData(char *hubUrl) /* return data from a hub track, optionally just one chrom data, * optionally just one section of that chrom data */ { char *genome = cgiOptionalString("genome"); char *track = cgiOptionalString("track"); char *chrom = cgiOptionalString("chrom"); char *start = cgiOptionalString("start"); char *end = cgiOptionalString("end"); if (isEmpty(genome)) apiErrAbort("missing genome= for endpoint '/getdata/track' given hubUrl='%s'", hubUrl); if (isEmpty(track)) apiErrAbort("missing track= for endpoint '/getdata/track' given hubUrl='%s'", hubUrl);