src/hg/instinct/hgHeatmap2/drawingCode.c 1.76

1.76 2009/10/06 23:40:06 jzhu
single subgroup drawing functionality under summery view
Index: src/hg/instinct/hgHeatmap2/drawingCode.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgHeatmap2/drawingCode.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -b -B -U 4 -r1.75 -r1.76
--- src/hg/instinct/hgHeatmap2/drawingCode.c	5 Oct 2009 21:32:30 -0000	1.75
+++ src/hg/instinct/hgHeatmap2/drawingCode.c	6 Oct 2009 23:40:06 -0000	1.76
@@ -1422,19 +1422,19 @@
     return 0;
 } 
 
 void drawFeatureSubgroupBar(struct vGfx *vg, struct slName *sampleList, int sampleHeight,
-			    boolean isBottomSubgroup)
+			    boolean subset)
 {
 if (!sampleList)
     return;
 
 int height = hgHeatmapDefaultSummaryHeight; 
 int width = hghSubgroupDefaultPixWidth / 2;
 vgSetClip(vg, 0, 0, hghSubgroupDefaultPixWidth, height);
-if (isBottomSubgroup) // only draw labels on bottom/green subgroup
+if (subset ==0) // only draw labels on bottom/green subgroup
     vgBox(vg, width, 0, width, height, MG_GREEN);
-else
+else if (subset ==1)
     vgBox(vg, 0, 0, width, height, MG_RED);
 vgUnclip(vg);
 }
 
@@ -3151,8 +3151,15 @@
 if (totalW * totalH == 0)
     return NULL;
 
 boolean isBottomSubgroup = (subset + 1 == subsetNum);
+
+struct slName **ptSubsets = NULL;
+char *raName = gh->raFile;
+int ifSubsets = getSubsetsIfAny(gh, subsetNum, raName, &ptSubsets);
+if (ifSubsets ==1)
+    isBottomSubgroup=1;
+
 if (ifDrawFeatureLabel(hl) && isBottomSubgroup)
     totalH += hghFeatureLabel;
 
 struct tempName md5Tn;
@@ -3170,9 +3177,9 @@
     /* draw feature sorter */
     if (sameWord(gh->dataType,"bed 15"))
 	{
 	if (subsetNum > 1)
-	    drawFeatureSubgroupBar(vg->vg, sampleList, hl->sampleHeight, isBottomSubgroup);
+	    drawFeatureSubgroupBar(vg->vg, sampleList, hl->sampleHeight, subset);
 	drawFeatureSummary(vg->vg, tableName, hl, 0, FALSE, sampleList, isBottomSubgroup);
 	}
     hvGfxClose(&vg);
     }