Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/javascript/components/explore/ExploreDisplayTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import PlotUtils from '~/lib/plot'
const getPlotDimensions = PlotUtils.getPlotDimensions
import ScatterPlot from '~/components/visualization/ScatterPlot'
import StudyViolinPlot from '~/components/visualization/StudyViolinPlot'
import DotPlot from '~/components/visualization/DotPlot'
import DotPlot, { shouldUsePreprocessedData } from '~/components/visualization/DotPlot'
import Heatmap from '~/components/visualization/Heatmap'
import Pathway from '~/components/visualization/Pathway'
import GeneListHeatmap from '~/components/visualization/GeneListHeatmap'
Expand Down Expand Up @@ -279,6 +279,9 @@ export default function ExploreDisplayTabs({
const referencePlotDataParams = _clone(exploreParams)
referencePlotDataParams.genes = []

// disable 50-gene query limit if study has preprocessed dotplot data
const disableGeneQueryLimit = shouldUsePreprocessedData(flags, exploreInfo)

// TODO (SCP-5760): Refactor pathway diagrams into independent component where
// React state can be propagated conventionally, then remove this
window.SCP.exploreParamsWithDefaults = exploreParamsWithDefaults
Expand Down Expand Up @@ -539,6 +542,7 @@ export default function ExploreDisplayTabs({
isLoading={!exploreInfo}
speciesList={exploreInfo ? exploreInfo.taxonNames : []}
selectedAnnotation={selectedAnnotation}
disableGeneQueryLimit={disableGeneQueryLimit}
/>
{ // show if this is gene search || gene list
(isGene || isGeneList || hasIdeogramOutputs || isPathway) &&
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/components/explore/StudyGeneField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ function getQueryArrayFromSearchOptions(searchOptions, speciesList, selectedAnno
* @param queryFn Function to call to execute the API search
* @param allGenes String array of valid genes in the study
* @param speciesList String array of species scientific names
* @param isLoading boolean flag for disabling search while loading
* @param disableGeneQueryLimit boolean flag for allowing searches larger than 50 genes for preprocessed data
*/
export default function StudyGeneField({
queries, queryFn, allGenes, speciesList, selectedAnnotation, isLoading=false
queries, queryFn, allGenes, speciesList, selectedAnnotation, isLoading=false, disableGeneQueryLimit = false
}) {
const [inputText, setInputText] = useState('')

Expand Down Expand Up @@ -158,7 +160,7 @@ export default function StudyGeneField({
} else if (newQueryArray && newQueryArray.length) {
const newQueries = getQueriesFromSearchOptions(newQueryArray, speciesList, selectedAnnotation)
const queries = newQueries
if (queries.length > window.MAX_GENE_SEARCH) {
if (queries.length > window.MAX_GENE_SEARCH && !disableGeneQueryLimit) {
log('search-too-many-genes', { numGenes: queries.length })
setShowTooManyGenesModal(true)
} else {
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/components/visualization/DotPlot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export function renderDotPlot({
focus: null,
tabManager: morpheusTabManager($target),
tools,
loadedCallback: () => logMorpheusPerfTime(target, 'dotplot', genes)
loadedCallback: () => logMorpheusPerfTime(target, 'dotplot', genes, isPrecomputed)
}

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

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

log(`plot:${plotType}`, { perfTime, genes })
log(`plot:${plotType}`, { perfTime, genes, isPrecomputed })
}

/** Log performance of loading JSON datasets for Morpheus */
Expand Down
35 changes: 20 additions & 15 deletions app/javascript/components/visualization/Heatmap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,29 @@ function RawHeatmap({
const [graphId] = useState(_uniqueId('heatmap-'))
const [dataset, setDataset] = useState(morpheusData)
const morpheusHeatmap = useRef(null)
const { ErrorComponent, setShowError, setErrorContent } = useErrorMessage()
const { ErrorComponent, showError, setShowError, setError } = useErrorMessage()

// Fetch dataset if not provided via morpheusData prop, but only when tab is visible
useEffect(() => {
async function fetchDataset() {
if (isVisible && !morpheusData && cluster && annotation.name && genes.length > 0) {
const [data] = await fetchMorpheusJson(
studyAccession,
genes,
cluster,
annotation.name,
annotation.type,
annotation.scope,
subsample,
false, // mock
false // usePreprocessed - always use full morpheus data for heatmaps
)
setDataset(data)
try {
const [data] = await fetchMorpheusJson(
studyAccession,
genes,
cluster,
annotation.name,
annotation.type,
annotation.scope,
subsample,
false, // mock
false // usePreprocessed - always use full morpheus data for heatmaps
)
setDataset(data)
} catch (error) {
setError(error.message)
setShowError(true)
}
} else if (morpheusData) {
setDataset(morpheusData)
}
Expand Down Expand Up @@ -70,7 +75,7 @@ function RawHeatmap({
rowCentering: heatmapRowCentering,
sortColumns: true,
setShowError,
setErrorContent,
setError,
genes
})
}
Expand All @@ -92,7 +97,7 @@ function RawHeatmap({
<div>
<div className="plot">
{ ErrorComponent }
<LoadingSpinner isLoading={!canRender}>
<LoadingSpinner isLoading={!canRender && !showError}>
<div id={graphId} className="heatmap-graph" style={{ minWidth: '80vw' }}></div>
</LoadingSpinner>
</div>
Expand Down
5 changes: 3 additions & 2 deletions app/lib/study_search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
class StudySearchService

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

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