src/hg/instinct/hgHeatmap2/hgHeatmap2.c 1.83
1.83 2010/03/11 19:39:03 jsanborn
fixed getHeatmaps to look at two databases
Index: src/hg/instinct/hgHeatmap2/hgHeatmap2.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgHeatmap2/hgHeatmap2.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -b -B -U 4 -r1.82 -r1.83
--- src/hg/instinct/hgHeatmap2/hgHeatmap2.c 10 Mar 2010 22:55:39 -0000 1.82
+++ src/hg/instinct/hgHeatmap2/hgHeatmap2.c 11 Mar 2010 19:39:03 -0000 1.83
@@ -53,9 +53,10 @@
boolean hasCustomTracks = FALSE; /* whether any custom tracks are for this db*/
struct slName *browserLines = NULL; /* Custom track "browser" lines. */
-static char *heatMapDbProfile = "localDb"; // database profile to use
+static char *localDbProfile = "localDb"; // local database profile to use
+static char *publicDbProfile = "cancerPubDb"; // public database profile to use
struct chromZoom {
struct chromZoom *next;
@@ -613,9 +614,9 @@
return;
if (!slCount(datasets))
return;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, database);
if (!conn)
return;
char *name;
@@ -638,9 +639,9 @@
if (!userHasAccess)
continue;
- gh = getHeatmap(conn, database, name, col->settings);
+ gh = getHeatmap(conn, NULL, database, name, col->settings);
if (!gh)
continue;
if (!gh->private)
@@ -667,12 +668,15 @@
struct genoHeatmap *getDbHeatmaps(char *set, char *raName)
/* Get graphs defined. Requried to be present in the database as well as
in the datasets.ra file */
{
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
-if (!conn)
+struct sqlConnection *localConn = hAllocConnProfile(localDbProfile, database);
+if (!localConn)
return NULL;
+/* This can be NULL */
+struct sqlConnection *publicConn = hAllocConnProfile(publicDbProfile, database);
+
char varName[1024];
char *name;
struct genoHeatmap *list = NULL, *gh;
@@ -700,18 +704,19 @@
else
vis = "off";
}
- gh = getHeatmap(conn, database, name, col->settings);
+ gh = getHeatmap(localConn, publicConn, database, name, col->settings);
if (!gh)
continue;
if (gh->private)
continue; // do not include private datasets.
slAddHead(&list,gh);
}
-hFreeConn(&conn);
+hFreeConn(&localConn);
+hFreeConn(&publicConn);
addUserDbHeatmaps(&list, raName);
addCustomDbHeatmaps(&list, raName);
slReverse(&list);
@@ -988,9 +993,9 @@
parseChromStrings(chromStart, &startChrom, &startBase,
chromEnd, &endChrom, &endBase);
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = chromLayout(conn, gh, startChrom, startBase,
endChrom, endBase, width, sampleHeight);
if (differentWord(gh->dataType,"bed 15") || !gotAdvFilter(gh->patDb) || !func)
@@ -1040,9 +1045,9 @@
return;
char *raName= gh->raFile;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = genesetLayout(gh, geneSetNames, width, sampleHeight);
if (!hl)
return;
struct geneSet *geneSets = getAllPathways(cart, getPathwayDb(), geneSetNames);
@@ -1075,9 +1080,9 @@
parseChromStrings(chromStart, &startChrom, &startBase,
chromEnd, &endChrom, &endBase);
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = chromLayout(conn, gh, startChrom, startBase,
endChrom, endBase, width, sampleHeight);
setUserDefinedColor(hl);
@@ -1133,9 +1138,9 @@
{
if (!gh || !geneSetNames)
return;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = genesetLayout(gh, geneSetNames, width, height);
if (!hl)
return;
@@ -1197,9 +1202,9 @@
parseChromStrings(chromStart, &startChrom, &startBase,
chromEnd, &endChrom, &endBase);
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = chromLayout(conn, gh, startChrom, startBase,
endChrom, endBase, width, sampleHeight);
setUserDefinedColor(hl);
@@ -1219,9 +1224,9 @@
parseChromStrings(chromStart, &startChrom, &startBase,
chromEnd, &endChrom, &endBase);
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, database);
struct heatmapLay *hl = chromLayout(conn, NULL, startChrom, startBase,
endChrom, endBase, width, 1);
char *gGif = genomeLabelsGif(conn, hl);
@@ -1236,9 +1241,9 @@
{
if (!gh || !geneSetNames)
return;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = genesetLayout(gh, geneSetNames, width, sampleHeight);
if (!hl)
return;
@@ -1257,9 +1262,9 @@
{
if (!geneSetNames)
return;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, database);
struct heatmapLay *hl = genesetLayout(NULL, geneSetNames, width, 1);
if (!hl)
return;
@@ -1284,9 +1289,9 @@
int sampleHeight = 0;
parseChromStrings(chromStart, &startChrom, &startBase,
chromEnd, &endChrom, &endBase);
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, database);
struct heatmapLay *hl = chromLayout(conn, NULL, startChrom, startBase,
endChrom, endBase, width, sampleHeight);
hFreeConn(&conn);
@@ -1302,9 +1307,9 @@
if (!gh->patDb)
return;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = featureLayout(gh, width, sampleHeight);
char *fGif = featureGif(conn, hl, gh, gh->name);
@@ -1342,9 +1347,9 @@
if (!gh->patDb)
return;
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, gh->database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, gh->database);
struct heatmapLay *hl = featureLayout(gh, width, sampleHeight);
char *raName = gh->raFile;
int subsetNum = cartUsualInt(cart, hgh2SubgroupNum, hgh2SubgroupDefaultNum);
@@ -1589,9 +1594,8 @@
{
// this now uses the priority within each group instead of alphabetical by short name
// this prevents having to use some weird stuff in order to get the datasets to show up correctly
slReverse(&gr->datasets);
- //slSort(&gr->datasets, datasetCmpShortLabel);
struct json *set, *group = jsonAddContainerList(js, gr->name);
set = group;
@@ -2079,9 +2083,9 @@
parseChromStrings(chromStart, &startChrom, &startBase,
chromEnd, &endChrom, &endBase);
-struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
+struct sqlConnection *conn = hAllocConnProfile(localDbProfile, database);
struct genoLayChrom *chrom, *allChromList = genoLayDbChroms(conn, FALSE);
if (!allChromList)
return;