From 758826d912cc30e06d87b391ab8be24b721277ab Mon Sep 17 00:00:00 2001 From: jpfisher72 Date: Thu, 2 May 2024 13:00:03 -0400 Subject: [PATCH] update umap --- immuscreen/src/common/components/umapplot.tsx | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/immuscreen/src/common/components/umapplot.tsx b/immuscreen/src/common/components/umapplot.tsx index cc47648..dd42284 100644 --- a/immuscreen/src/common/components/umapplot.tsx +++ b/immuscreen/src/common/components/umapplot.tsx @@ -153,10 +153,10 @@ export const UmapPlot = (props) => { const maxValue = Math.max(...props.data.map(a => a.value)) const minValue = Math.min(...props.data.map(a => a.value)) - const linearScale = scaleLinear({ - domain: [minValue, maxValue], - range: ["#ffcd00", "#ff0000"], - }); + // const linearScale = scaleLinear({ + // domain: [minValue, maxValue], + // range: ["#ffcd00", "#ff0000"], + // }); let uniqcelltypes = [...new Set([...props.data].sort((a, b) => { if (!experimentInfo[a.name]?.order) console.log(a.name) //some experiments returned in gene expression umap are not in experiment list? @@ -190,7 +190,7 @@ export const UmapPlot = (props) => { numTicks={4} scale={xScale} /> - {props.data.map(point => { + {[... props.data].sort((a,b) => a.value - b.value).map(point => { return ( {point.stimulation === 'S' ? @@ -201,7 +201,7 @@ export const UmapPlot = (props) => { rotate={90} onMouseOver={(event) => handleHover(event, point)} onMouseLeave={(event) => handleLeaveHover(event, point)} - fill={(props.colorScheme === 'geneexp' || props.colorScheme === 'ZScore') ? linearScale(point.value) : getCellColor(point.celltype)} + fill={(props.colorScheme === 'geneexp' || props.colorScheme === 'ZScore') ? point.value > 1.64 ? 'red' : 'yellow' : getCellColor(point.celltype)} stroke={tooltipData && tooltipData.celltype === point.celltype ? 'black' : ''} /> : { onMouseOver={(event) => handleHover(event, point)} onMouseLeave={(event) => handleLeaveHover(event, point)} //fill= {`${linearScale(point.value)}`} - fill={(props.colorScheme === 'geneexp' || props.colorScheme === 'ZScore') ? linearScale(point.value) : getCellColor(point.celltype)} + fill={(props.colorScheme === 'geneexp' || props.colorScheme === 'ZScore') ? point.value > 1.64 ? 'red' : 'yellow' : getCellColor(point.celltype)} stroke={tooltipData && tooltipData.celltype === point.celltype ? 'black' : ''} /> } @@ -241,39 +241,40 @@ export const UmapPlot = (props) => { )}
{(props.colorScheme === 'geneexp' || props.colorScheme === 'ZScore') ? - - (+d).toFixed(2)} - > - {(labels) => - labels.sort((a, b) => b.index - a.index).map((label, i) => ( - { - //if (events) alert(`clicked: ${JSON.stringify(label)}`); - }} - > - - - - - {label.text} - - - )) - } - - + // + // (+d).toFixed(2)} + // > + // {(labels) => + // labels.sort((a, b) => b.index - a.index).map((label, i) => ( + // { + // //if (events) alert(`clicked: ${JSON.stringify(label)}`); + // }} + // > + // + // + // + // + // {label.text} + // + // + // )) + // } + // + // + <> :