ee9a6c5c63eba2d963a5d7581185b1004fffe964 angie Mon Apr 15 14:06:10 2013 -0700 Added indentifying name to annoStreamer for output header info and better error messages. refs #6152 diff --git src/lib/annoStreamBigBed.c src/lib/annoStreamBigBed.c index 651ce85..1b8814f 100644 --- src/lib/annoStreamBigBed.c +++ src/lib/annoStreamBigBed.c @@ -38,31 +38,32 @@ streamer->regionStart, streamer->regionEnd, self->maxItems, self->intervalQueryLm); self->nextInterval = self->intervalList; } static char **nextRowUnfiltered(struct annoStreamBigBed *self) /* Convert the next available interval into a row of words, or return NULL. */ { struct annoStreamer *streamer = &(self->streamer); if (self->nextInterval == NULL) return NULL; int fieldCount = bigBedIntervalToRow(self->nextInterval, streamer->chrom, self->startBuf, self->endBuf, self->row, streamer->numCols+1); if (fieldCount != streamer->numCols) - errAbort("annoStreamBigBed: expected %d columns, got %d", streamer->numCols, fieldCount); + errAbort("annoStreamBigBed %s: expected %d columns, got %d", + streamer->name, streamer->numCols, fieldCount); self->nextInterval = self->nextInterval->next; return self->row; } static struct annoRow *asbbNextRow(struct annoStreamer *vSelf, struct lm *lm) /* Return a single annoRow, or NULL if there are no more items. */ { struct annoStreamBigBed *self = (struct annoStreamBigBed *)vSelf; if (self->intervalList == NULL) asbbDoQuery(self); char **row = nextRowUnfiltered(self); if (row == NULL) return NULL; // Skip past any left-join failures until we get a right-join failure, a passing row, or EOF. boolean rightFail = FALSE; @@ -93,27 +94,27 @@ freeMem(self->startBuf); freeMem(self->endBuf); annoStreamerFree(pVSelf); } struct annoStreamer *annoStreamBigBedNew(char *fileOrUrl, struct annoAssembly *aa, int maxItems) /* Create an annoStreamer (subclass) object from a file or URL; if * maxItems is 0, all items from a query will be returned, otherwise * each query is limited to maxItems. */ { struct bbiFile *bbi = bigBedFileOpen(fileOrUrl); struct asObject *asObj = bigBedAsOrDefault(bbi); struct annoStreamBigBed *self = NULL; AllocVar(self); struct annoStreamer *streamer = &(self->streamer); -annoStreamerInit(streamer, aa, asObj); +annoStreamerInit(streamer, aa, asObj, fileOrUrl); streamer->rowType = arWords; streamer->setRegion = asbbSetRegion; streamer->nextRow = asbbNextRow; streamer->close = asbbClose; self->bbi = bbi; self->maxItems = maxItems; AllocArray(self->row, streamer->numCols + 1); self->startBuf = needMem(32); self->endBuf = needMem(32); return (struct annoStreamer *)self; }