Esempio n. 1
0
boolean isBigBed(char *database, char *table, struct trackDb *parent,
	struct customTrack *(*ctLookupName)(char *table))
/* Local test to see if something is big bed.  Handles hub tracks unlike hIsBigBed. */
{
struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table);
if (tdb)
    return tdbIsBigBed(tdb);
else
    return hIsBigBed(database, table, parent, ctLookupName);
}
void tabOutSelectedFields(
    char *primaryDb,		/* The primary database. */
    char *primaryTable, 		/* The primary table. */
    FILE *f,			/* file for output, null for stdout */
    struct slName *fieldList)	/* List of db.table.field */
/* Do tab-separated output on selected fields, which may
 * or may not include multiple tables. */
{
    struct joinerDtf *dtfList = NULL;
    struct joinerDtf *filterTables = NULL;
    boolean doJoin = joinRequired(primaryDb, primaryTable,
                                  fieldList, &dtfList, &filterTables);

    if (! doJoin)
    {
        struct sqlConnection *conn = hAllocConn(dtfList->database);
        struct dyString *dy = dyStringNew(0);

        if (hIsBigBed(database, dtfList->table, NULL, ctLookupName))
            makeBigBedOrderedCommaFieldList(dtfList, dy);
        else if (isCustomTrack(dtfList->table))
            makeCtOrderedCommaFieldList(dtfList, dy);
        else
            makeDbOrderedCommaFieldList(conn, dtfList->table, dtfList, dy);
        doTabOutTable(dtfList->database, dtfList->table, f, conn, dy->string);
        hFreeConn(&conn);
    }
    else
    {
        struct joiner *joiner = allJoiner;
        struct joinedTables *joined = joinedTablesCreate(joiner,
                                      primaryDb, primaryTable, dtfList, filterTables, 1000000, getRegions());
        if (f == NULL)
            joinedTablesTabOut(joined);
        else
            joinedTablesTabOutFile(joined, f);
        joinedTablesFree(&joined);
    }
    joinerDtfFreeList(&dtfList);
    joinerDtfFreeList(&filterTables);
}