@@ -21,6 +21,7 @@ import { renderDotPlot } from '~/components/visualization/DotPlot'
2121import { getEligibleLabels } from '~/lib/cluster-utils'
2222import { fetchMorpheusJson } from '~/lib/scp-api'
2323import { getFeatureFlagsWithDefaults } from '~/providers/UserProvider'
24+ import { shouldUsePreprocessedData } from '~/components/visualization/DotPlot'
2425
2526// Denoise DevTools console log by not showing error that lacks user impact
2627window . onerror = function ( error ) {
@@ -83,7 +84,7 @@ window.SCP.renderBackgroundDotPlotRegister = {}
8384export async function renderBackgroundDotPlot (
8485 studyAccession , genes = [ ] , cluster , annotation = { } ,
8586 subsample , annotationValues , drawCallback ,
86- topContainerSelector
87+ topContainerSelector , usePreprocessed
8788) {
8889 const graphId = 'background-dot-plot'
8990 document . querySelector ( `#${ graphId } ` ) ?. remove ( )
@@ -122,7 +123,9 @@ export async function renderBackgroundDotPlot(
122123 annotation . name ,
123124 annotation . type ,
124125 annotation . scope ,
125- subsample
126+ subsample ,
127+ false , // mock flag
128+ usePreprocessed
126129 )
127130 dataset = results [ 0 ]
128131
@@ -317,6 +320,8 @@ function mergeDotPlotMetrics(newMetrics, oldMetrics) {
317320
318321/** Color pathway gene nodes by expression */
319322export async function renderPathwayExpression ( studyAccession , cluster , annotation , label , labels ) {
323+ const flags = getFeatureFlagsWithDefaults ( )
324+ const usePreprocessed = shouldUsePreprocessedData ( flags , window . SCP ?. exploreInfo )
320325 let allDotPlotMetrics = { }
321326
322327 const pathwayGenes = getPathwayGenes ( )
@@ -337,10 +342,9 @@ export async function renderPathwayExpression(studyAccession, cluster, annotatio
337342 // the second render is for collapsed label-x-gene metrics (dotplot)
338343
339344 numDraws += 1
340- if ( numDraws === 1 ) { return }
345+ if ( numDraws === 1 && ! usePreprocessed ) { return }
341346
342347 const dotPlotMetrics = getDotPlotMetrics ( dotPlot )
343-
344348 if ( ! dotPlotMetrics ) {
345349 // Occurs upon resizing window, artifact of internal Morpheus handling
346350 // of pre-dot-plot heatmap matrix. No user-facing impact.
@@ -367,7 +371,7 @@ export async function renderPathwayExpression(studyAccession, cluster, annotatio
367371 renderBackgroundDotPlot (
368372 studyAccession , dotPlotGeneBatches [ numRenders ] , cluster , annotation ,
369373 'All' , annotationLabels , backgroundDotPlotDrawCallback ,
370- '#_ideogramPathwayContainer'
374+ '#_ideogramPathwayContainer' , usePreprocessed
371375 )
372376 }
373377 }
@@ -378,7 +382,7 @@ export async function renderPathwayExpression(studyAccession, cluster, annotatio
378382 renderBackgroundDotPlot (
379383 studyAccession , dotPlotGeneBatches [ 0 ] , cluster , annotation ,
380384 'All' , annotationLabels , backgroundDotPlotDrawCallback ,
381- '#_ideogramPathwayContainer'
385+ '#_ideogramPathwayContainer' , usePreprocessed
382386 )
383387}
384388
0 commit comments