Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plots tab related data loading on initial study view load #4958

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 4 deletions src/pages/resultsView/ResultsViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,8 @@ export default class ResultsViewPage extends React.Component<
driverAnnotationSettings={
store.driverAnnotationSettings
}
studyIdToStudy={store.studyIdToStudy.result}
structuralVariants={
store.structuralVariants.result
}
studyIdToStudy={store.studyIdToStudy}
structuralVariants={store.structuralVariants}
hugoGeneSymbols={store.hugoGeneSymbols}
selectedGenericAssayEntitiesGroupByMolecularProfileId={
store.selectedGenericAssayEntitiesGroupByMolecularProfileId
Expand Down
7 changes: 2 additions & 5 deletions src/pages/studyView/StudyViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,13 @@ export default class StudyViewPage extends React.Component<
.driverAnnotationSettings
}
studyIdToStudy={
this.store.studyIdToStudy.result
this.store.studyIdToStudy
}
structuralVariants={
this.store.structuralVariants
.result
}
hugoGeneSymbols={
allHugoGeneSymbols={
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Bryan, sorry it took me SO long to respond. This is quite confusing to have a property hugeGeneSymbols AND allHugeGeneSymbols. Lets think if there's some better we can handle this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The basic problem is that we need to wait for the gene symbols to load but we only want to do that when the tab is actually showing. We can handle that more elegantly with some kind of loading wrapper. Maybe we can do a pair programming session and figure it out.

this.store.allHugoGeneSymbols
.result
}
selectedGenericAssayEntitiesGroupByMolecularProfileId={
this.store
Expand All @@ -865,7 +863,6 @@ export default class StudyViewPage extends React.Component<
genePanelDataForAllProfiles={
this.store
.genePanelDataForAllProfiles
.result
}
patients={this.store.patients}
/>
Expand Down
26 changes: 15 additions & 11 deletions src/shared/components/plots/PlotsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,10 @@ export interface IPlotsTabProps {
[studyId: string]: MolecularProfile;
}>;
driverAnnotationSettings: DriverAnnotationSettings;
studyIdToStudy?: _.Dictionary<CancerStudy>;
structuralVariants?: StructuralVariant[];
hugoGeneSymbols: string[];
studyIdToStudy?: MobxPromiseUnionTypeWithDefault<_.Dictionary<CancerStudy>>;
structuralVariants?: MobxPromiseUnionType<StructuralVariant[]>;
hugoGeneSymbols?: string[];
allHugoGeneSymbols?: MobxPromiseUnionTypeWithDefault<string[]>;
selectedGenericAssayEntitiesGroupByMolecularProfileId: {
[molecularProfileId: string]: string[];
};
Expand All @@ -337,7 +338,7 @@ export interface IPlotsTabProps {
}>;
urlWrapper: ResultsViewURLWrapper | StudyViewURLWrapper;
hasNoQueriedGenes?: boolean;
genePanelDataForAllProfiles?: GenePanelData[];
genePanelDataForAllProfiles?: MobxPromiseUnionType<GenePanelData[]>;
queryContainsOql?: boolean;
includeGermlineMutations?: boolean;
mutationsReportByGene?: MobxPromise<{
Expand Down Expand Up @@ -3346,7 +3347,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
private scatterPlotTooltip(d: IScatterPlotData) {
return scatterPlotTooltip(
d,
this.props.studyIdToStudy || {},
this.props.studyIdToStudy?.result!,
this.horzLogScaleFunction,
this.vertLogScaleFunction,
this.coloringMenuSelection.selectedOption &&
Expand All @@ -3358,7 +3359,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
private waterfallPlotTooltip(d: IWaterfallPlotData) {
return waterfallPlotTooltip(
d,
this.props.studyIdToStudy || {},
this.props.studyIdToStudy?.result!,
this.coloringMenuSelection.selectedOption &&
this.coloringMenuSelection.selectedOption.info.clinicalAttribute
);
Expand All @@ -3370,7 +3371,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
if (this.boxPlotData.isComplete) {
content = boxPlotTooltip(
d,
this.props.studyIdToStudy || {},
this.props.studyIdToStudy?.result!,
this.boxPlotData.result.horizontal,
this.boxPlotData.result.horizontal
? this.horzLogScaleFunction
Expand Down Expand Up @@ -3552,7 +3553,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
// we don't want to allow the data to be viewed by variantClass (Variant Type in UI) so remove
// that from the options
const filterStructuralVariantOptions = _.every(
this.props.structuralVariants,
this.props.structuralVariants?.result || [],
sv => {
return !sv.variantClass || sv.variantClass === 'NA';
}
Expand Down Expand Up @@ -3673,13 +3674,16 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
}
let genericAssayOptionsCount: number = 0;
let filteredGenericAssayOptionsCount: number = 0;
const hugoGeneSymbols: string[] = this.props.hugoGeneSymbols
? this.props.hugoGeneSymbols
: this.props.allHugoGeneSymbols!.result;
if (vertical && this.vertGenericAssayOptions.result) {
genericAssayOptions =
this.makeGenericAssayGroupOptions(
this.vertGenericAssayOptions.result,
selectedEntities,
this._vertGenericAssaySearchText,
this.props.hugoGeneSymbols,
hugoGeneSymbols,
this.horzSelection.selectedGeneOption?.label,
GENERIC_ASSAY_CONFIG.genericAssayConfigByType[
axisSelection.dataType!
Expand Down Expand Up @@ -3707,7 +3711,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
this.horzGenericAssayOptions.result,
selectedEntities,
this._horzGenericAssaySearchText,
this.props.hugoGeneSymbols,
hugoGeneSymbols,
this.vertSelection.selectedGeneOption?.label,
GENERIC_ASSAY_CONFIG.genericAssayConfigByType[
axisSelection.dataType!
Expand Down Expand Up @@ -3750,7 +3754,7 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
options = options.filter(stringCompare).slice(0, 10);
const genes = await fetchGenes(options.map(o => o.label));
const coverageInformationPromise = getCoverageInformation(
this.props.genePanelDataForAllProfiles!,
this.props.genePanelDataForAllProfiles!.result!,
this.props.sampleKeyToSample.result!,
this.props.patients.result!,
genes
Expand Down
Loading