src/hg/instinct/hgPathways/hgCircleMaps.c 1.16

1.16 2009/11/07 00:35:49 sbenz
Bunch of updates to make this work, and slightly change the UI
Index: src/hg/instinct/hgPathways/hgCircleMaps.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgPathways/hgCircleMaps.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -B -U 4 -r1.15 -r1.16
--- src/hg/instinct/hgPathways/hgCircleMaps.c	15 Sep 2009 00:08:14 -0000	1.15
+++ src/hg/instinct/hgPathways/hgCircleMaps.c	7 Nov 2009 00:35:49 -0000	1.16
@@ -603,10 +603,9 @@
 if (mgFontStringWidth(font, cm->name) < cm->minR * 2.0)
     vgTextCentered(vg, 0, 0, cm->width, cm->width, textCol, font, cm->name);
 else
 	{
-	char *substr;
-	strncpy(substr,cm->name,5);
+	char *substr = cloneStringZ(cm->name,5);
 	vgTextCentered(vg, 0, 0, cm->width, cm->width, textCol, font, substr);
 	}
 }
 
@@ -641,9 +640,9 @@
 
 off_t size = fileSize(md5Tn->forCgi);
 if (!fileExists(md5Tn->forCgi) || (size == 0) || DEBUG_IMG)
     {
-    struct hvGfx *vg = hvGfxOpenPng(cm->width, cm->width, md5Tn->forCgi, TRUE);
+    struct hvGfx *vg = hvGfxOpenGif(cm->width, cm->width, md5Tn->forCgi, TRUE);
     drawCircleMap(vg->vg, cm);
     hvGfxClose(&vg);
     }
 
@@ -1103,9 +1102,9 @@
 		{
 	    struct ring *sortRg = addRingToCircleMap(cm, sortGene, sl->name, FALSE);
 		if (!sortRg->data)
 		    sortRg->data = hashNew(0);
-		if(sameStringN(sl->name,"factorGraph_",12) || sameStringN(sl->name,"fg_",3) )
+		if(sameStringN(sl->name,"factorGraph_",12) || sameStringN(sl->name,"fg_",3) || sameStringN(sl->name,"fgEM_",5) )
 			{
 			safef(query, sizeof(query), "select DISTINCT samples.name,val from %s data inner join entities_ncipid on entities_ncipid.entity_id = data.feature_id left join samples on samples.id = data.sample_id where data.pathway_id = \"%s\" AND entities_ncipid.entity_name LIKE(\"%s\") ORDER BY samples.id",
 				sl->name,pathwayID,sortGene);
 			}
@@ -1158,9 +1157,9 @@
 
 	if (!rg->data)
 	    rg->data = hashNew(0);
 		
-	if(sameStringN(sl->name,"factorGraph_",12) || sameStringN(sl->name,"fg_",3) )
+	if(sameStringN(sl->name,"factorGraph_",12) || sameStringN(sl->name,"fg_",3)  || sameStringN(sl->name,"fgEM_",5) )
 		{
 		safef(query, sizeof(query), "select DISTINCT samples.name,val from %s data inner join entities_ncipid on entities_ncipid.entity_id = data.feature_id left join samples on samples.id = data.sample_id where data.pathway_id = \"%s\" AND entities_ncipid.entity_name LIKE(\"%s\") ORDER BY samples.id",
 			sl->name,pathwayID,gene);
 		}
@@ -1235,12 +1234,12 @@
 /* Layout circle map, setting radial widths */
 layoutCircleMap(cm, width);
 }
 
-struct slName *getValidSamples(analysisID)
+struct slName *getValidSamples(char *analysisID)
 {
 if(!analysisID)
-	return;
+	return NULL;
 
 struct slName *sampleList = NULL;
 
 struct sqlConnection *conn = hAllocConnProfile(heatMapDbProfile, database);
@@ -1252,9 +1251,9 @@
 char **row = NULL;
 safef(query, sizeof(query), "select COUNT(*) as num from analyses,datasetCohort where analyses.id = %s and datasetCohort.cohort_id = analyses.cohort_id",
 	analysisID);
 sr = sqlGetResult(conn, query);
-char *datasetCount;
+char *datasetCount = NULL;
 if ((row = sqlNextRow(sr)) != NULL)
 	{
 		datasetCount = cloneString(row[0]);
 	}
@@ -1313,8 +1311,9 @@
 	setupCircleMap(cm, datasets, gene->name, width, pathway, validSamples);
 	
 	//char *gGif = circleMapGif(cm);
 	struct tempName *cmTmp = circleMapGif(cm);
+	
 	char *gGif = replaceChars(cmTmp->forHtml, "..", "");
 
 	// OPEN the file we just made and stream it to the output
 	// this saves us the multiple image openings on the client side