b5a43eda6548e6d32d9fa32abd96848decd53472 kate Wed Apr 19 07:43:10 2017 -0700 Cleanup FIXME and TODO comments. refs #18736 diff --git src/hg/hgc/barChartClick.c src/hg/hgc/barChartClick.c index 0465037..113727f 100644 --- src/hg/hgc/barChartClick.c +++ src/hg/hgc/barChartClick.c @@ -68,38 +68,32 @@ /* Retrieve barChart BED item from track table */ { struct barChartBed *barChart = NULL; struct sqlConnection *conn = hAllocConn(database); char **row; char query[512]; struct sqlResult *sr; if (sqlTableExists(conn, table)) { sqlSafef(query, sizeof query, "SELECT * FROM %s WHERE name='%s'" "AND chrom='%s' AND chromStart=%d AND chromEnd=%d", table, item, chrom, start, end); sr = sqlGetResult(conn, query); row = sqlNextRow(sr); - // TODO: Fix or retire - /* - boolean hasOffsets = sqlColumnExists(conn, table, BARCHART_OFFSET_COLUMN); - */ - if (row != NULL) { - // TODO: Fix or retire barChart = barChartBedLoadOptionalOffsets(row, FALSE); } sqlFreeResult(&sr); } hFreeConn(&conn); return barChart; } static struct barChartBed *getBarChart(char *item, char *chrom, int start, int end, struct trackDb *tdb) /* Retrieve barChart BED item from track */ { struct barChartBed *barChart = NULL; char *file = trackDbSetting(tdb, "bigDataUrl"); if (file != NULL) @@ -129,59 +123,57 @@ lineFileClose(&lf); // Open matrix file url = trackDbSetting(tdb, "barChartDataUrl"); struct udcFile *f = udcFileOpen(url, NULL); // Get header line with sample ids char *header = udcReadLine(f); int wordCt = sampleCt+1; // initial field is label or empty char **samples; AllocArray(samples, wordCt); chopByWhite(header, samples, wordCt); // Get data values // Format: id, category, extras -// TODO: check data types for offset & len bits64 offset = (bits64)bed->_dataOffset; bits64 size = (bits64)bed->_dataLen; udcSeek(f, offset); bits64 seek = udcTell(f); if (udcTell(f) != offset) warn("UDC seek mismatch: expecting %Lx, got %Lx. ", offset, seek); char *buf = needMem(size); bits64 count = udcRead(f, buf, size); if (count != size) warn("UDC read mismatch: expecting %Ld bytes, got %Ld. ", size, count); char **vals; AllocArray(vals, wordCt); chopByWhite(buf, vals, wordCt); udcFileClose(&f); // Construct list of sample data with category struct barChartItemData *sampleVals = NULL, *data = NULL; int i; for (i=1; itrack, sample); else if (hashLookup(categoryHash, categ)) { AllocVar(data); - // TODO: try w/o clone data->sample = cloneString(sample); data->category = cloneString(categ); data->value = sqlDouble(vals[i]); slAddHead(&sampleVals, data); } } return sampleVals; } static struct sqlConnection *getConnectionAndTable(struct trackDb *tdb, char *suffix, char **retTable) /* Look for in database or hgFixed and set up connection */ { char table[256]; assert(retTable); @@ -193,31 +185,30 @@ hFreeConn(&conn); conn = hAllocConn("hgFixed"); if (!sqlTableExists(conn, table)) { hFreeConn(&conn); return NULL; } } return conn; } static struct barChartItemData *getSampleValsFromTable(struct trackDb *tdb, struct hash *categoryHash, struct barChartBed *bed) /* Get data values for this item (locus) from all samples */ -// TODO: Consider retiring table-based version. Use files instead, like hub version { char *table = NULL; struct sqlConnection *conn = getConnectionAndTable(tdb, "Data", &table); struct barChartData *val, *vals = barChartDataLoadForLocus(conn, table, bed->name); hFreeConn(&conn); // Get category for samples conn = getConnectionAndTable(tdb, "Sample", &table); char query[512]; sqlSafef(query, sizeof(query), "SELECT * FROM %s", table); struct barChartSample *sample, *samples = barChartSampleLoadByQuery(conn, query); hFreeConn(&conn); struct hash *sampleHash = hashNew(0); for (sample = samples; sample != NULL; sample = sample->next)