Skip to content

Commit 73fc29b

Browse files
authored
Merge pull request #2344 from broadinstitute/development
Release 1.107.0
2 parents 18762eb + 39b95ae commit 73fc29b

File tree

5 files changed

+35
-23
lines changed

5 files changed

+35
-23
lines changed

app/javascript/components/explore/ExploreDisplayTabs.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import PlotUtils from '~/lib/plot'
1111
const getPlotDimensions = PlotUtils.getPlotDimensions
1212
import ScatterPlot from '~/components/visualization/ScatterPlot'
1313
import StudyViolinPlot from '~/components/visualization/StudyViolinPlot'
14-
import DotPlot from '~/components/visualization/DotPlot'
14+
import DotPlot, { shouldUsePreprocessedData } from '~/components/visualization/DotPlot'
1515
import Heatmap from '~/components/visualization/Heatmap'
1616
import Pathway from '~/components/visualization/Pathway'
1717
import GeneListHeatmap from '~/components/visualization/GeneListHeatmap'
@@ -279,6 +279,9 @@ export default function ExploreDisplayTabs({
279279
const referencePlotDataParams = _clone(exploreParams)
280280
referencePlotDataParams.genes = []
281281

282+
// disable 50-gene query limit if study has preprocessed dotplot data
283+
const disableGeneQueryLimit = shouldUsePreprocessedData(flags, exploreInfo)
284+
282285
// TODO (SCP-5760): Refactor pathway diagrams into independent component where
283286
// React state can be propagated conventionally, then remove this
284287
window.SCP.exploreParamsWithDefaults = exploreParamsWithDefaults
@@ -539,6 +542,7 @@ export default function ExploreDisplayTabs({
539542
isLoading={!exploreInfo}
540543
speciesList={exploreInfo ? exploreInfo.taxonNames : []}
541544
selectedAnnotation={selectedAnnotation}
545+
disableGeneQueryLimit={disableGeneQueryLimit}
542546
/>
543547
{ // show if this is gene search || gene list
544548
(isGene || isGeneList || hasIdeogramOutputs || isPathway) &&

app/javascript/components/explore/StudyGeneField.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ function getQueryArrayFromSearchOptions(searchOptions, speciesList, selectedAnno
9898
* @param queryFn Function to call to execute the API search
9999
* @param allGenes String array of valid genes in the study
100100
* @param speciesList String array of species scientific names
101+
* @param isLoading boolean flag for disabling search while loading
102+
* @param disableGeneQueryLimit boolean flag for allowing searches larger than 50 genes for preprocessed data
101103
*/
102104
export default function StudyGeneField({
103-
queries, queryFn, allGenes, speciesList, selectedAnnotation, isLoading=false
105+
queries, queryFn, allGenes, speciesList, selectedAnnotation, isLoading=false, disableGeneQueryLimit = false
104106
}) {
105107
const [inputText, setInputText] = useState('')
106108

@@ -158,7 +160,7 @@ export default function StudyGeneField({
158160
} else if (newQueryArray && newQueryArray.length) {
159161
const newQueries = getQueriesFromSearchOptions(newQueryArray, speciesList, selectedAnnotation)
160162
const queries = newQueries
161-
if (queries.length > window.MAX_GENE_SEARCH) {
163+
if (queries.length > window.MAX_GENE_SEARCH && !disableGeneQueryLimit) {
162164
log('search-too-many-genes', { numGenes: queries.length })
163165
setShowTooManyGenesModal(true)
164166
} else {

app/javascript/components/visualization/DotPlot.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export function renderDotPlot({
325325
focus: null,
326326
tabManager: morpheusTabManager($target),
327327
tools,
328-
loadedCallback: () => logMorpheusPerfTime(target, 'dotplot', genes)
328+
loadedCallback: () => logMorpheusPerfTime(target, 'dotplot', genes, isPrecomputed)
329329
}
330330

331331
// For pre-computed data, tell Morpheus to display series 0 for color
@@ -466,14 +466,14 @@ export function morpheusTabManager($target) {
466466
}
467467

468468
/** Log render performance timing for Morpheus dot plots and heatmaps */
469-
export function logMorpheusPerfTime(target, plotType, genes) {
469+
export function logMorpheusPerfTime(target, plotType, genes, isPrecomputed) {
470470
const graphId = target.slice(1) // e.g. #dotplot-1 -> dotplot-1
471471
performance.measure(graphId, `perfTimeStart-${graphId}`)
472472
const perfTime = Math.round(
473473
performance.getEntriesByName(graphId)[0].duration
474474
)
475475

476-
log(`plot:${plotType}`, { perfTime, genes })
476+
log(`plot:${plotType}`, { perfTime, genes, isPrecomputed })
477477
}
478478

479479
/** Log performance of loading JSON datasets for Morpheus */

app/javascript/components/visualization/Heatmap.jsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,29 @@ function RawHeatmap({
2424
const [graphId] = useState(_uniqueId('heatmap-'))
2525
const [dataset, setDataset] = useState(morpheusData)
2626
const morpheusHeatmap = useRef(null)
27-
const { ErrorComponent, setShowError, setErrorContent } = useErrorMessage()
27+
const { ErrorComponent, showError, setShowError, setError } = useErrorMessage()
2828

2929
// Fetch dataset if not provided via morpheusData prop, but only when tab is visible
3030
useEffect(() => {
3131
async function fetchDataset() {
3232
if (isVisible && !morpheusData && cluster && annotation.name && genes.length > 0) {
33-
const [data] = await fetchMorpheusJson(
34-
studyAccession,
35-
genes,
36-
cluster,
37-
annotation.name,
38-
annotation.type,
39-
annotation.scope,
40-
subsample,
41-
false, // mock
42-
false // usePreprocessed - always use full morpheus data for heatmaps
43-
)
44-
setDataset(data)
33+
try {
34+
const [data] = await fetchMorpheusJson(
35+
studyAccession,
36+
genes,
37+
cluster,
38+
annotation.name,
39+
annotation.type,
40+
annotation.scope,
41+
subsample,
42+
false, // mock
43+
false // usePreprocessed - always use full morpheus data for heatmaps
44+
)
45+
setDataset(data)
46+
} catch (error) {
47+
setError(error.message)
48+
setShowError(true)
49+
}
4550
} else if (morpheusData) {
4651
setDataset(morpheusData)
4752
}
@@ -70,7 +75,7 @@ function RawHeatmap({
7075
rowCentering: heatmapRowCentering,
7176
sortColumns: true,
7277
setShowError,
73-
setErrorContent,
78+
setError,
7479
genes
7580
})
7681
}
@@ -92,7 +97,7 @@ function RawHeatmap({
9297
<div>
9398
<div className="plot">
9499
{ ErrorComponent }
95-
<LoadingSpinner isLoading={!canRender}>
100+
<LoadingSpinner isLoading={!canRender && !showError}>
96101
<div id={graphId} className="heatmap-graph" style={{ minWidth: '80vw' }}></div>
97102
</LoadingSpinner>
98103
</div>

app/lib/study_search_service.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
class StudySearchService
33

44
MAX_GENE_SEARCH = 50
5-
MAX_GENE_SEARCH_MSG = "For performance reasons, gene search is limited to #{MAX_GENE_SEARCH} genes. Please use " \
6-
'multiple searches to view more genes.'.freeze
5+
MAX_GENE_SEARCH_MSG = "For performance reasons, gene search is limited to #{MAX_GENE_SEARCH} genes, except for " \
6+
'pre-processed dot plots (where available). ' \
7+
'Please use multiple searches to view more genes.'.freeze
78

89
# list of common 'stop words' to scrub from term-based search requests
910
# these are unhelpful in search contexts as they artificially inflate irrelevant results

0 commit comments

Comments
 (0)