060ada2535fca719656219c1214a3e1c16490693 tdreszer Wed Nov 9 16:06:41 2011 -0800 Moved as code in hgTables down to lib and access it from hgc and hgTrackUi. This is to remove 'extraFields' support as per Jim's request in redmine 5883 and 5582 diff --git src/lib/bigBed.c src/lib/bigBed.c index 5ca82b1..5875373 100644 --- src/lib/bigBed.c +++ src/lib/bigBed.c @@ -211,21 +211,43 @@ udcSeek(f, bbi->asOffset); return udcReadStringAndZero(f); } struct asObject *bigBedAs(struct bbiFile *bbi) /* Get autoSql object definition if any associated with file. */ { if (bbi->asOffset == 0) return NULL; char *asText = bigBedAutoSqlText(bbi); struct asObject *as = asParseText(asText); freeMem(asText); return as; } +struct asObject *bigBedAsOrDefault(struct bbiFile *bbi) +// Get asObject associated with bigBed - if none exists in file make it up from field counts. +{ +struct asObject *as = bigBedAs(bbi); +if (as == NULL) + as = asParseText(bedAsDef(bbi->definedFieldCount, bbi->fieldCount)); +return as; +} + +struct asObject *bigBedFileAsObjOrDefault(char *fileName) +// Get asObject associated with bigBed file, or the default. +{ +struct bbiFile *bbi = bigBedFileOpen(fileName); +if (bbi) + { + struct asObject *as = bigBedAsOrDefault(bbi); + bbiFileClose(&bbi); + return as; + } +return NULL; +} + bits64 bigBedItemCount(struct bbiFile *bbi) /* Return total items in file. */ { udcSeek(bbi->udc, bbi->unzoomedDataOffset); return udcReadBits64(bbi->udc, bbi->isSwapped); }