struct genoGraph *getDbGraphs(struct sqlConnection *conn) /* Get graphs defined in database. Also use the composite settings if */ /* it's a subGraph. */ { struct genoGraph *list = NULL, *gg; struct sqlConnection *conn2 = hAllocConn(database); struct sqlResult *sr; char **row; /* Get initial information from metaChromGraph table */ if (sqlTableExists(conn, "metaChromGraph")) { sr = sqlGetResult(conn, "select name,binaryFile from metaChromGraph where binaryFile!='composite'"); while ((row = sqlNextRow(sr)) != NULL) { char *table = row[0], *binaryFile = row[1]; AllocVar(gg); gg->name = gg->shortLabel = gg->longLabel = cloneString(table); gg->binFileName = cloneString(binaryFile); slAddHead(&list, gg); } sqlFreeResult(&sr); } slReverse(&list); /* Where possible fill in additional info from trackDb. */ for (gg = list; gg != NULL; gg = gg->next) { struct trackDb *tdb = hTrackDbForTrack(database, gg->name); struct trackDb *compTdb = hCompositeTrackDbForSubtrack(database, tdb); gg->isSubGraph = (compTdb != NULL) ? TRUE : FALSE; gg->isComposite = FALSE; if (tdb != NULL) { struct chromGraphSettings *cgs = NULL; if (compTdb == NULL) cgs = chromGraphSettingsGet(gg->name, conn2, tdb, cart); else cgs = chromGraphSettingsGet(compTdb->table, conn2, compTdb, cart); gg->shortLabel = tdb->shortLabel; gg->longLabel = tdb->longLabel; gg->settings = cgs; } else { /* If we're here then there's an entry in metaChromGraph but not trackDb */ gg->settings = chromGraphSettingsGet(gg->name, NULL, NULL, NULL); } } hFreeConn(&conn2); slReverse(&list); return list; }
void chromGraphMethodsCt(struct track *tg) /* Fill in chromGraph methods for custom track. */ { tg->drawItems = cgDrawItemsCt; chromGraphMethodsCommon(tg); tg->customPt = chromGraphSettingsGet(tg->track, NULL, tg->tdb, cart); }
struct genoGraph *getCompGraphs(struct sqlConnection *conn) /* Get graphs defined in database that are part of a composite. */ { struct genoGraph *list = NULL, *gg; struct sqlConnection *conn2 = hAllocConn(database); struct slName *compositeGGList = NULL, *comp; /* Get initial information from metaChromGraph table */ if (sqlTableExists(conn, "metaChromGraph")) compositeGGList = sqlQuickList(conn, "select name from metaChromGraph where binaryFile='composite'"); /* Build a hash of genoGraphs out of composite trackDbs and fill in from cart. */ for (comp = compositeGGList; comp != NULL; comp = comp->next) { struct trackDb *tdb = hTrackDbForTrack(database, comp->name); if (tdb) { struct chromGraphSettings *cgs = chromGraphSettingsGet(comp->name, conn2, tdb, cart); AllocVar(gg); gg->name = cloneString(comp->name); gg->shortLabel = tdb->shortLabel; gg->longLabel = tdb->longLabel; gg->settings = cgs; gg->isSubGraph = FALSE; gg->isComposite = TRUE; slAddHead(&list, gg); } } hFreeConn(&conn2); slReverse(&list); return list; }
void chromGraphMethods(struct track *tg) /* Fill in chromGraph methods for built in track. */ { chromGraphMethodsCommon(tg); tg->drawItems = cgDrawItems; struct sqlConnection *conn = hAllocConn(database); tg->customPt = chromGraphSettingsGet(tg->track, conn, tg->tdb, cart); hFreeConn(&conn); }
struct genoGraph *getUserGraphs() /* Get list of all user graphs */ { struct genoGraph *list = NULL, *gg; struct customTrack *ct, *ctList = customTracksParseCart(database, cart, NULL, NULL); for (ct = ctList; ct != NULL; ct = ct->next) { struct trackDb *tdb = ct->tdb; if (sameString(tdb->type, "chromGraph")) { AllocVar(gg); gg->name = tdb->table; gg->shortLabel = tdb->shortLabel; gg->longLabel = tdb->longLabel; gg->binFileName = trackDbRequiredSetting(tdb, "binaryFile"); gg->settings = chromGraphSettingsGet(gg->name, NULL, tdb, cart); gg->isSubGraph = FALSE; gg->isComposite = FALSE; slAddHead(&list, gg); } } slReverse(&list); return list; }