Ejemplo n.º 1
0
struct annoStreamer *streamerFromInfo(struct streamerInfo *info)
/* Figure out which constructor to call, call it and return the results. */
{
struct annoStreamer *streamer = NULL;
if (info->type == arWig)
    streamer = annoStreamWigDbNew(info->sqlDb, info->tableFileUrl, info->assembly, BIGNUM);
else if (info->sqlDb != NULL)
    streamer = annoStreamDbNew(info->sqlDb, info->tableFileUrl, info->assembly, info->asObj,
			       BIGNUM);
else if (info->asObj && asObjectsMatch(info->asObj, vcfAsObj()))
    {
    //#*** this is kludgey, should test for .tbi file:
    boolean looksLikeTabix = endsWith(info->tableFileUrl, ".gz");
    streamer = annoStreamVcfNew(info->tableFileUrl, looksLikeTabix, info->assembly, BIGNUM);
    }
else if (endsWith(info->tableFileUrl, ".bb"))
    {
    streamer = annoStreamBigBedNew(info->tableFileUrl, info->assembly, BIGNUM);
    }
else
    {
    streamer = annoStreamTabNew(info->tableFileUrl, info->assembly, info->asObj);
    }
return streamer;
}
struct annoStreamer *annoStreamWigDbNew(char *db, char *table, struct annoAssembly *aa,
					int maxOutput)
/* Create an annoStreamer (subclass) object from a wiggle database table. */
{
struct annoStreamWig *self = NULL;
AllocVar(self);
self->wigStr = annoStreamDbNew(db, table, aa, asParseText(wiggleAsText), maxOutput);
struct annoStreamer *streamer = &(self->streamer);
annoStreamerInit(streamer, aa, asParseText(annoRowWigAsText), self->wigStr->name);
streamer->rowType = arWigVec;
streamer->setRegion = aswSetRegion;
streamer->nextRow = aswNextRow;
streamer->close = aswClose;
return (struct annoStreamer *)self;
}