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

Add plots tab to study view #4802

Merged
merged 14 commits into from
Mar 25, 2024
Merged

Add plots tab to study view #4802

merged 14 commits into from
Mar 25, 2024

Conversation

gblaih
Copy link
Contributor

@gblaih gblaih commented Dec 15, 2023

Copy link

netlify bot commented Jan 5, 2024

Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit f2008cd
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/65fdeb6e3173b60008ead3fe
😎 Deploy Preview https://deploy-preview-4802--cbioportalfrontend.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@gblaih gblaih force-pushed the study-plots-tab branch 2 times, most recently from 3c8a37c to 2af58eb Compare February 13, 2024 18:10
@inodb inodb requested a review from onursumer March 7, 2024 15:50
@gblaih gblaih marked this pull request as ready for review March 7, 2024 15:54
@inodb inodb requested a review from alisman March 11, 2024 14:47
@@ -0,0 +1,5996 @@
import * as React from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

This is based on PlotsTab, right? It is virtually impossible to review the changes here because of ~6000 new lines. Do we still plan to keep the old PlotsTab component, or are we eventually going to replace it with this one?

Also, not sure if PlotsFeature is a good name for a component. It sounds a bit strange to have Feature in a component's name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, sorry about that. PlotsTab has been replaced with what was PlotsFeature

@@ -78,6 +78,7 @@ import {
prepareCustomTabConfigurations,
} from 'shared/lib/customTabs/customTabHelpers';
import { VirtualStudyModal } from 'pages/studyView/virtualStudy/VirtualStudyModal';
import PlotsFeature from 'pages/resultsView/plots/PlotsFeature';
Copy link
Member

Choose a reason for hiding this comment

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

Ideally study view should not import components from result view. We should probably move the PlotsFeature component under shared.

},
});

public groupSamplesByCancerType(
Copy link
Member

Choose a reason for hiding this comment

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

This seems like an almost duplicate of

public groupSamplesByCancerType(

It would be great if we could define utility functions for these kind of duplicates to maximize code reuse.

},
});

readonly structuralVariants = remoteData<StructuralVariant[]>({
Copy link
Member

Choose a reason for hiding this comment

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

This is another relatively long function duplicated from ResultsViewPageStore

);
}

readonly samplesSpecification = remoteData({
Copy link
Member

Choose a reason for hiding this comment

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

Another relatively long function duplicated from ResultsViewPageStore. Would be nice to identify all those duplicate functions and write a generalized utility function for each if possible.

Comment on lines 869 to 874
return {
value: geneOptions[0].value,
label: self.isGeneProfiled(geneOptions[0].label)
? geneOptions[0].label
: geneOptions[0].label + ' (Not profiled)',
};
Copy link
Member

Choose a reason for hiding this comment

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

Not a big deal but you can write a getOption(option) function for this code segment. We do the same thing for two other cases as well.

@@ -1832,7 +2053,8 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
// add gene options
allOptions.push({
label: 'Genes',
options: this.props.store.genes.result!.map(gene => ({
// options: this.props.genes.result!.filter(g => g.hugoGeneSymbol === 'KRAS').map(gene => ({
Copy link
Member

Choose a reason for hiding this comment

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

should we remove this line?

Comment on lines 3469 to 3478
if (coverageInformation) {
return Object.values(coverageInformation.samples).some(
s => !_.isEmpty(s.allGenes) || !!s.byGene[gene]
);
}
if (this.props.coverageInformation.isComplete) {
return Object.values(
this.props.coverageInformation.result!.samples
).some(s => !_.isEmpty(s.allGenes) || !!s.byGene[gene]);
}
Copy link
Member

Choose a reason for hiding this comment

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

something like this would be better I think

Suggested change
if (coverageInformation) {
return Object.values(coverageInformation.samples).some(
s => !_.isEmpty(s.allGenes) || !!s.byGene[gene]
);
}
if (this.props.coverageInformation.isComplete) {
return Object.values(
this.props.coverageInformation.result!.samples
).some(s => !_.isEmpty(s.allGenes) || !!s.byGene[gene]);
}
const samples = coverageInformation?.samples || this.props.coverageInformation.result?.samples;
if (samples) {
return Object.values(samples).some(
s => !_.isEmpty(s.allGenes) || !!s.byGene[gene]
);
}

@@ -4761,6 +5071,33 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
);
}

@computed get showNoDataTypesSelectedWarning() {
Copy link
Member

Choose a reason for hiding this comment

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

this function returns a boolean

Suggested change
@computed get showNoDataTypesSelectedWarning() {
@computed get shouldShowNoDataTypesSelectedWarning() {

);
}

@computed get showNoGenesSelectedWarning() {
Copy link
Member

Choose a reason for hiding this comment

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

same here

Suggested change
@computed get showNoGenesSelectedWarning() {
@computed get shouldShowNoGenesSelectedWarning() {

Copy link
Member

@onursumer onursumer left a comment

Choose a reason for hiding this comment

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

LGTM!

@inodb inodb merged commit 8288996 into cBioPortal:master Mar 25, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants