e1ace7526b7d16654717065227a2d1e6f3fe4654 hiram Tue Mar 26 20:12:20 2019 -0700 adding testing for hubApi refs #18869 diff --git src/hg/hubApi/list.c src/hg/hubApi/list.c index acbb12f..8b0358d 100644 --- src/hg/hubApi/list.c +++ src/hg/hubApi/list.c @@ -135,30 +135,31 @@ jsonWriteObjectEnd(jw); fputs(jw->dy->string,stdout); hDisconnectCentral(&conn); } static void chromInfoJsonOutput(FILE *f, char *db) /* for given db, if there is a track, list the chromosomes in that track, * for no track, simply list the chromosomes in the sequence */ { char *table = cgiOptionalString("track"); struct sqlConnection *conn = hAllocConn(db); /* in trackDb language: track == table */ if (table) { + /* XXX TBD - expand this to a hub to get chromosomes from hub big* file */ if (! sqlTableExists(conn, table)) apiErrAbort("can not find specified 'track=%s' for endpoint: /list/chromosomes?db=%s&track=%s", table, db, table); if (sqlColumnExists(conn, table, "chrom")) { char *dataTime = sqlTableUpdate(conn, table); time_t dataTimeStamp = sqlDateToUnixTime(dataTime); replaceChar(dataTime, ' ', 'T'); /* ISO 8601 */ struct jsonWrite *jw = apiStartOutput(); jsonWriteString(jw, "genome", db); jsonWriteString(jw, "track", table); jsonWriteString(jw, "dataTime", dataTime); jsonWriteNumber(jw, "dataTimeStamp", (long long)dataTimeStamp); freeMem(dataTime); struct slPair *list = NULL; char query[2048]; @@ -175,30 +176,31 @@ slReverse(&list); jsonWriteNumber(jw, "chromCount", (long long)slCount(list)); jsonWriteObjectStart(jw, "chromosomes"); struct slPair *el = list; for ( ; el != NULL; el = el->next ) jsonWriteNumber(jw, el->name, (long long)ptToInt(el->val)); jsonWriteObjectEnd(jw); /* chromosomes */ jsonWriteObjectEnd(jw); /* top level */ fputs(jw->dy->string,stdout); } else apiErrAbort("track '%s' is not a position track, request table without chrom specification, genome: '%s'", table, db); } else { + /* XXX TBD - expand this to a hub to get chromosomes from hub 2bit file */ char *dataTime = sqlTableUpdate(conn, "chromInfo"); time_t dataTimeStamp = sqlDateToUnixTime(dataTime); replaceChar(dataTime, ' ', 'T'); /* ISO 8601 */ struct chromInfo *ciList = createChromInfoList(NULL, db); struct chromInfo *el = ciList; struct jsonWrite *jw = apiStartOutput(); jsonWriteString(jw, "genome", db); jsonWriteString(jw, "dataTime", dataTime); jsonWriteNumber(jw, "dataTimeStamp", (long long)dataTimeStamp); freeMem(dataTime); jsonWriteNumber(jw, "chromCount", (long long)slCount(ciList)); jsonWriteObjectStart(jw, "chromosomes"); for ( ; el != NULL; el = el->next ) { jsonWriteNumber(jw, el->chrom, (long long)el->size);