Commit 93ff4bf8 authored by Andrew Cohen's avatar Andrew Cohen

CONSTANTS cellFeatures.range override

parent 91dfdabe
......@@ -197,6 +197,17 @@ function drawNodeFeatures(node,t0,t1,context,height,nFrames,miniLineageCanvas,li
// return;
// }
// draw axes first
context.save();
context.setLineDash([5, 3]);
context.strokeStyle = node.color.bright;
context.beginPath();
var ax=getCanvasX(node.x+0.95, lineageDiv);
context.moveTo(ax,t0);
context.lineTo(ax,t1);
context.stroke();
context.restore();
for (var n=0;n<featureDiv.children.length;n++) {
var bShow=document.getElementById('featureShow_'+n).checked;
if (!bShow)
......@@ -210,7 +221,12 @@ function drawNodeFeatures(node,t0,t1,context,height,nFrames,miniLineageCanvas,li
continue;
}
var time=getCanvasY(node.features[t][1], height, nFrames);
var fx=(node.features[t][2+n]-fmin)/(fmax-fmin) *0.95;
var fval=node.features[t][2+n];
// clip
fval=Math.min(fval,fmax);
fval=Math.max(fval,fmin);
var fx=(fval-fmin)/(fmax-fmin) *0.95;
fx=getCanvasX(node.x+fx,lineageDiv);
if (0===t)
context.moveTo(fx,time);
......@@ -221,17 +237,9 @@ function drawNodeFeatures(node,t0,t1,context,height,nFrames,miniLineageCanvas,li
context.stroke();
}
// draw axes and labels
context.save();
context.setLineDash([5, 3]);
context.strokeStyle = node.color.bright;
context.beginPath();
var ax=getCanvasX(node.x+0.95, lineageDiv);
context.moveTo(ax,t0);
context.lineTo(ax,t1);
context.stroke();
// text label axes
context.save();
context.setLineDash([]);
context.textBaseline='bottom';
context.strokeStyle='black';
......@@ -363,9 +371,13 @@ function setFeatureExtrema(node)
if (undefined==node.features || 0==node.features.length || undefined==CONSTANTS.cellFeatures ) {
return;
}
if (!isOnExtFamily(node.trackID))
return;
for (var nFeature=0;nFeature<CONSTANTS.cellFeatures.length;nFeature++) {
if (false===CONSTANTS.cellFeatures[nFeature].bShow)
continue;
if (undefined!==CONSTANTS.cellFeatures[nFeature].range)
continue;
for (var i=0;i<node.features.length;i++) {
gLineageFeatureExtrema[0]=Math.min(gLineageFeatureExtrema[0],node.features[i][2+nFeature]);
gLineageFeatureExtrema[1]=Math.max(gLineageFeatureExtrema[1],node.features[i][2+nFeature]);
......@@ -569,6 +581,14 @@ function buildAndDrawTrees(canvas)
// all the root nodes
var rgRoots = [];
gLineageFeatureExtrema=[Infinity,-Infinity];
if (undefined!==CONSTANTS.cellFeatures) {
for (var n=0;n<CONSTANTS.cellFeatures.length;n++) {
if (undefined!==CONSTANTS.cellFeatures[n].range){
gLineageFeatureExtrema[0]=Math.min(gLineageFeatureExtrema[0],CONSTANTS.cellFeatures[n].range[0]);
gLineageFeatureExtrema[1]=Math.max(gLineageFeatureExtrema[1],CONSTANTS.cellFeatures[n].range[1]);
}
}
}
// traverse each tree to find depths
gLineageMap.forEach(function(node,trackID,map) {
if (-1==node.parent) {
......
......@@ -647,6 +647,16 @@ function drawText(tHulls)
trackID=tHulls[i].trackID+'*';
else
trackID=tHulls[i].trackID;
if (undefined!==CONSTANTS.cellFeatures) {
for (var n=0;n<CONSTANTS.cellFeatures.length;n++) {
if (CONSTANTS.cellFeatures[n].bRender) {
var fval=tHulls[i][CONSTANTS.cellFeatures[n].name];
fval=Math.round(100*fval)/100;
trackID=trackID+':'+fval;
}
}
}
context.strokeText(trackID, screenPt[0], screenPt[1]);
context.lineWidth = 1;
context.fillText(trackID, screenPt[0], screenPt[1]);
......@@ -654,7 +664,7 @@ function drawText(tHulls)
}
} // drawText
var gFeatureExtrema;
var gFeatureExtrema=[];
function getFeatureExtrema()
{
if (gDB===undefined && g_db_path===undefined)
......@@ -713,6 +723,9 @@ function drawHulls(tHulls)
for (var i=0;i<CONSTANTS.cellFeatures.length;i++) {
if (CONSTANTS.cellFeatures[i].bRender) {
nFeature=i;
if (undefined!==CONSTANTS.cellFeatures[i].range) {
gFeatureExtrema[i]=CONSTANTS.cellFeatures[i].range;
}
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment