f3e2a9eb74858d409ad94350c64496a09561e26f
kent
Thu Jan 13 21:32:06 2011 -0800
Starting to work on getting bigBeds from data hubs to work with table browser. Still a ways to go though.
diff --git src/hg/hgTables/bigBed.c src/hg/hgTables/bigBed.c
index bc0ec09..11b1d75 100644
--- src/hg/hgTables/bigBed.c
+++ src/hg/hgTables/bigBed.c
@@ -60,61 +60,67 @@
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;