src/hg/instinct/hgHeatmap2/drawingCode.c 1.69
1.69 2009/08/19 22:10:30 jzhu
fix bug find to draw overlaping probes not just within probes when drawing heatmap, summary view
Index: src/hg/instinct/hgHeatmap2/drawingCode.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgHeatmap2/drawingCode.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -b -B -U 4 -r1.68 -r1.69
--- src/hg/instinct/hgHeatmap2/drawingCode.c 22 Jun 2009 21:45:36 -0000 1.68
+++ src/hg/instinct/hgHeatmap2/drawingCode.c 19 Aug 2009 22:10:30 -0000 1.69
@@ -2525,15 +2525,13 @@
{
start = nb->chromStart;
end = nb->chromEnd;
- if (start < hEl->baseStart && end > hEl->baseEnd)
- { // Window is *inside* of a probe
+ /* Window overlaps a probe */
+ if (start < hEl->baseStart)
start = hEl->baseStart;
+ if ( end > hEl->baseEnd)
end = hEl->baseEnd;
- int width = hEl->pixelEnd - hEl->pixelStart;
- pixelsPerBase = (double) width / (double) (end - start);
- }
int x = pixelsPerBase * (start - hEl->baseStart) + chromX;
int w = pixelsPerBase * (end - start);
if (w == 0)
@@ -2627,15 +2625,13 @@
{
start = nb->chromStart;
end = nb->chromEnd;
- if (start < hEl->baseStart && end > hEl->baseEnd)
- { // Window is *inside* of a probe
+ /* Window overlaps a probe */
+ if (start < hEl->baseStart)
start = hEl->baseStart;
+ if ( end > hEl->baseEnd)
end = hEl->baseEnd;
- int width = hEl->pixelEnd - hEl->pixelStart;
- pixelsPerBase = (double) width / (double) (end - start);
- }
int x = pixelsPerBase * (start - hEl->baseStart) + chromX;
int w = pixelsPerBase * (end - start);
if (w == 0)
@@ -2724,9 +2720,9 @@
int *chromOrder = getBedOrder(gh);
struct bed *ghBed=NULL, *nb=NULL;
-double pixelsPerBase = 1.0/hl->basesPerPixel;
+
double md = maxDeviation(gh->name);
double colorScale = COLOR_SCALE / md;
double val;
double absVal;
@@ -2734,9 +2730,9 @@
Color valCol;
int start, end;
float gain = gh->gainFull;
-
+double pixelsPerBase = 1.0/hl->basesPerPixel;
Color upShades[EXPR_DATA_SHADES];
Color downShades[EXPR_DATA_SHADES];
vgMakeColorGradient(vg, hl->zeroColor, hl->highColor, EXPR_DATA_SHADES, upShades);
@@ -2773,15 +2769,18 @@
{
start = nb->chromStart;
end = nb->chromEnd;
- if (start < hEl->baseStart && end > hEl->baseEnd)
- { // Window is *inside* of a probe
+ /* Window overlaps a probe */
+ if (start < hEl->baseStart)
start = hEl->baseStart;
+ if ( end > hEl->baseEnd)
end = hEl->baseEnd;
- pixelsPerBase = (double) width / (double) (end - start);
- }
+ int x = pixelsPerBase * (start - hEl->baseStart) + chromX;
+ int w = pixelsPerBase * (end - start);
+ if (w == 0)
+ w = 1;
int i;
for(i = 0; i < nb->expCount; ++i)
{
val = nb->expScores[i];
@@ -2790,12 +2789,8 @@
if (orderId == -1)
continue;
int y = chromY + orderId * sampleHeight;
- int x = pixelsPerBase * (start - hEl->baseStart) + chromX;
- int w = pixelsPerBase * (end - start);
- if (w == 0)
- w = 1;
safef(pixelStr, sizeof(pixelStr), "%d,%d", x, y);
struct hashEl *el = hashLookup(pixelHash, pixelStr);
if (!el)