Ejemplo n.º 1
0
Archivo: seqOut.c Proyecto: bowhan/kent
void doGenomicDna(struct sqlConnection *conn)
/* Get genomic sequence (UI has already told us how). */
{
struct region *region, *regionList = getRegions();
struct hTableInfo *hti = getHti(database, curTable, conn);
int fieldCount;
textOpen();
int resultCount = 0;
for (region = regionList; region != NULL; region = region->next)
    {
    struct lm *lm = lmInit(64*1024);
    struct bed *bedList = cookedBedList(conn, curTable, region, lm, &fieldCount);
    if (bedList != NULL)
    	resultCount += hgSeqBed(database, hti, bedList);
    lmCleanup(&lm);
    }
if (!resultCount)
    hPrintf(NO_RESULTS);
}
int hgSeqItemsInRange(char *db, char *table, char *chrom, int chromStart,
                      int chromEnd, char *sqlConstraints)
/* Print out dna sequence of all items (that match sqlConstraints, if nonNULL)
   in the given range in table.  Return number of items. */
{
    struct hTableInfo *hti;
    struct bed *bedList;
    char rootName[256];
    char parsedChrom[32];
    int itemCount;

    hParseTableName(db, table, rootName, parsedChrom);
    hti = hFindTableInfo(db, chrom, rootName);
    if (hti == NULL)
        webAbort("Error", "Could not find table info for table %s (%s)",
                 rootName, table);
    bedList = hGetBedRange(db, table, chrom, chromStart, chromEnd,
                           sqlConstraints);

    itemCount = hgSeqBed(db, hti, bedList);
    bedFreeList(&bedList);
    return itemCount;
}