416e9300eb4281e887e5671c379509194bf1a7f2
kent
Tue Jan 18 23:29:43 2011 -0800
Fixed bug with bigBed in table browser.
diff --git src/hg/hgTables/bigBed.c src/hg/hgTables/bigBed.c
index 11b1d75..bc0ec09 100644
--- src/hg/hgTables/bigBed.c
+++ src/hg/hgTables/bigBed.c
@@ -60,67 +60,61 @@
struct asObject *bigBedAsForTable(char *table, struct sqlConnection *conn)
/* Get asObject associated with bigBed table. */
{
char *fileName = bigBedFileName(table, conn);
struct bbiFile *bbi = bigBedFileOpen(fileName);
struct asObject *as = bigBedAsOrDefault(bbi);
bbiFileClose(&bbi);
freeMem(fileName);
return as;
}
struct hTableInfo *bigBedToHti(char *table, struct sqlConnection *conn)
/* Get fields of bigBed into hti structure. */
{
/* Get columns in asObject format. */
-uglyf("ok 5.1.1.1
\n");
char *fileName = bigBedFileName(table, conn);
-uglyf("ok 5.1.1.2 fileName=%s
\n", fileName);
struct bbiFile *bbi = bigBedFileOpen(fileName);
-uglyf("ok 5.1.1.3
\n");
struct asObject *as = bigBedAsOrDefault(bbi);
-uglyf("ok 5.1.1.4
\n");
/* Allocate hTableInfo structure and fill in info about bed fields. */
struct hash *colHash = asColumnHash(as);
struct hTableInfo *hti;
AllocVar(hti);
hti->rootName = cloneString(table);
hti->isPos= TRUE;
fillField(colHash, "chrom", hti->chromField);
fillField(colHash, "chromStart", hti->startField);
fillField(colHash, "chromEnd", hti->endField);
fillField(colHash, "name", hti->nameField);
fillField(colHash, "score", hti->scoreField);
fillField(colHash, "strand", hti->strandField);
fillField(colHash, "thickStart", hti->cdsStartField);
fillField(colHash, "thickEnd", hti->cdsEndField);
fillField(colHash, "blockCount", hti->countField);
fillField(colHash, "chromStarts", hti->startsField);
fillField(colHash, "blockSizes", hti->endsSizesField);
hti->hasCDS = (bbi->definedFieldCount >= 8);
hti->hasBlocks = (bbi->definedFieldCount >= 12);
char type[256];
safef(type, sizeof(type), "bed %d %c", bbi->definedFieldCount,
(bbi->definedFieldCount == bbi->fieldCount ? '.' : '+'));
hti->type = cloneString(type);
-uglyf("ok 5.1.1.5
\n");
freeMem(fileName);
hashFree(&colHash);
bbiFileClose(&bbi);
-uglyf("ok 5.1.1.6
\n");
return hti;
}
struct slName *asColNames(struct asObject *as)
/* Get list of column names. */
{
struct slName *list = NULL, *el;
struct asColumn *col;
for (col = as->columnList; col != NULL; col = col->next)
{
el = slNameNew(col->name);
slAddHead(&list, el);
}
slReverse(&list);
return list;