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

Gene Panel Modal in Patient View #2782

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

ngocnn1104
Copy link
Contributor

@ngocnn1104 ngocnn1104 commented Oct 14, 2019

Gene Panel Modal in Patient View

Resolves cBioPortal/cbioportal#6670

Describe changes proposed in this pull request:

  • Created PatientViewGenePanelModal that makes use of GenePanelModal component;
  • Created GenesList component that displays a list of genes belonging to a gene panel with filtering, copy and download features - this component is passed as a child component to GenePanelModal at the moment and could be used in a separate page in the future;
  • Triggered the Gene Panel modal from several places in Patient View: Patient header, Genomic tracks, Mutations table and Copy Number Alterations table;
  • Implemented unit tests for the new component;
  • Implemented local end-to-end tests.

GIF

ezgif com-gif-maker

@pvannierop pvannierop force-pushed the patientview_gene_coverage_filter branch from b8c5b84 to 9b10cea Compare October 14, 2019 15:22
@ngocnn1104 ngocnn1104 force-pushed the patientview_gene_panel_modal branch 4 times, most recently from 0e4e4ba to 1fab19a Compare October 15, 2019 09:56
@ngocnn1104 ngocnn1104 changed the base branch from patientview_gene_coverage_filter to patientview_filter_genome_overview October 15, 2019 09:57
@ngocnn1104 ngocnn1104 changed the base branch from patientview_filter_genome_overview to gene_panel_download October 16, 2019 13:52
@ngocnn1104 ngocnn1104 force-pushed the patientview_gene_panel_modal branch 5 times, most recently from 97015d0 to 1ee9305 Compare October 22, 2019 14:53
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 23, 2019 18:58 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 24, 2019 07:15 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 24, 2019 13:05 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 24, 2019 13:49 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 24, 2019 13:52 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 24, 2019 14:08 Inactive
> {
constructor(props: IGenesListProps) {
super(props);
this.state = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think we should stick to just using mobx observables in this project (instead of traditional React component state).
Using both will cause confusion. So, no setState please.

this.setState({ filter: value });
};

filterGenes = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be computed property. That will avoid unecessary recomputation

@@ -947,6 +954,14 @@ export class PatientViewPageStore {
@action clearErrors() {
this.ajaxErrors = [];
}

@autobind
@action toggleModal(name?:string|undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

see comment above. should be on view and needs more specific name


export default class Tracks extends React.Component<TracksPropTypes, {}> {
export const DEFAULT_GENOME_BUILD="GRCh37";
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure but i think this constant already exists elsequere. we should have it one place unless it's only the default for this specific feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I searched through the source code and only found this constant used in this feature, so I think it's alright to keep it here.

export default class Tracks extends React.Component<TracksPropTypes, TracksStateTypes> {
constructor(props:TracksPropTypes) {
super(props);
this.state = { genePanelInTooltip: '' };
Copy link
Collaborator

Choose a reason for hiding this comment

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

no state

@@ -57,6 +56,27 @@ const getGenePanelIds = (props:PanelColumnFormatterProps) => {
return [];
};

const getGenePanelLinks = (props:PanelColumnFormatterProps) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could make this a React Functional Component and type it as such. Then use it in code via JSX: <GenePanelLinks ... >

src/pages/patientView/SampleManager.tsx Outdated Show resolved Hide resolved
@@ -36,6 +37,36 @@ export default class ClinicalInformationPatientTable extends React.Component<ICl
}
return ret;
}

handleClick = (name:string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

just to clarify, I think @alisman means handleClick(name:string) { ... }

src/pages/patientView/genomicOverview/tracksHelper.ts Outdated Show resolved Hide resolved
src/shared/components/GenePanelModal/GenePanelModal.tsx Outdated Show resolved Hide resolved
@alisman
Copy link
Collaborator

alisman commented Oct 24, 2019

@ngocnn1104 we put a lot of comments on this! let me know if you need any clarification or want to discuss.

@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 28, 2019 16:29 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 29, 2019 09:30 Inactive
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 29, 2019 10:02 Inactive
Copy link
Contributor

@adamabeshouse adamabeshouse left a comment

Choose a reason for hiding this comment

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

thanks for addressing comments! almost there

@action toggleGenePanelModal(genePanelId?:string|undefined) {
this.genePanelModal = {
isOpen: !this.genePanelModal.isOpen,
genePanelId: typeof genePanelId === 'string' ? genePanelId : ''
Copy link
Contributor

Choose a reason for hiding this comment

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

genePanelId: genePanelId || '' is easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, and have updated according to your suggestion. However, this function was passed directly to handle the onHide event of Bootstrap Modal and onClick event of Bootstrap Button, and whenever the function was called, an event object would get passed to the parent component and be seen as genePanelId. In order to avoid this, I modified the shared GenePanelModal component like below:

    @autobind handleClose() {
        this.props.onHide();
    }
    
    render() {
        return (
            <Modal
                show={this.props.show}
                onHide={this.handleClose} // instead of onHide={this.props.onHide}
                ...

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I understand. can you please add a comment explaining that?

src/pages/patientView/genomicOverview/Tracks.tsx Outdated Show resolved Hide resolved
@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 30, 2019 10:06 Inactive
Copy link
Contributor

@adamabeshouse adamabeshouse left a comment

Choose a reason for hiding this comment

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

please add a comment as discussed here #2782 (comment), and other than that looks good thanks!

@jjgao jjgao temporarily deployed to cbioportal-f-patientvie-gxnf52 October 31, 2019 08:55 Inactive
@ngocnn1104
Copy link
Contributor Author

please add a comment as discussed here #2782 (comment), and other than that looks good thanks!

done. Thank you!

@pvannierop pvannierop self-assigned this Nov 1, 2019
@pvannierop pvannierop added the RFC45 PatientView: gene panel integration label Nov 1, 2019
@ngocnn1104 ngocnn1104 changed the base branch from gene_panel_download to master December 2, 2019 10:37
- Created gene panel modal component in patient view with unit tests
- Trigger gene panel modal from genomic tracks and patient header
- Trigger gene panel modal from mutations and copy number tables
- Implemented local e2e tests & format new files with prettier

Signed-off-by: Ngoc Nguyen <nguyennhungoc1104@gmail.com>
@alisman alisman merged commit cd1ae43 into cBioPortal:master Dec 3, 2019
@ngocnn1104 ngocnn1104 deleted the patientview_gene_panel_modal branch January 25, 2020 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature RFC45 PatientView: gene panel integration
Projects
None yet
5 participants