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

Mutational signature plot with cosmic reference signature #4771

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

TJMKuijpers
Copy link
Contributor

This PR adds the cosmic reference signatures to the mutational signature plot. This will add a new graph to the existing mutational signature graph to show the percentage of a mutation (SBS, DBS, or ID) in a signature of interest.

image

It also fixes the following issues:

  • Table rows are highlighted on hoover and colored when clicked.
  • signatures category 'Unknown' has a color.
  • Removed word "sample" to every sample ID in the sample menu dropdown menu.
  • Summary stacked bar chart only displays top 10 (no overlfow when there are many significant mutational signatures
  • Minimum and maximum height are set for Y-axis when no data is present (for some patients).
  • selectedSignature --> empty string is not a good default value is fixed.
  • Updated test from the original mutational signatures.

Checks

  • Has tests or has a separate issue that describes the types of test that should be created. If no test is included it should explicitly be mentioned in the PR why there is no test.
  • The commit log is comprehensible. It follows 7 rules of great commit messages. For most PRs a single commit should suffice, in some cases multiple topical commits can be useful. During review it is ok to see tiny commits (e.g. Fix reviewer comments), but right before the code gets merged to master or rc branch, any such commits should be squashed since they are useless to the other developers. Definitely avoid merge commits, use rebase instead.
  • Is this PR adding logic based on one or more clinical attributes? If yes, please make sure validation for this attribute is also present in the data validation / data loading layers (in backend repo) and documented in File-Formats Clinical data section!

Any screenshots or GIFs?

If this is a new visual feature please add a before/after screenshot or gif
here with e.g. Giphy CAPTURE or Peek

Notify reviewers

Read our Pull request merging
policy
. It can help to figure out who worked on the
file before you. Please use git blame <filename> to determine that
and notify them either through slack or by assigning them as a reviewer on the PR

@TJMKuijpers
Copy link
Contributor Author

@inodb this PR should extend the current mutational signature plot with the cosmic reference. Maybe we can update the current mutational signature plot after code review on the private instance (for the pancan study)?

@TJMKuijpers TJMKuijpers requested review from inodb and alisman November 9, 2023 11:38
@TJMKuijpers TJMKuijpers marked this pull request as ready for review November 9, 2023 11:41
@TJMKuijpers TJMKuijpers force-pushed the cosmic-reference-signature-plot branch from e52e1b7 to 6a27001 Compare November 9, 2023 15:34
@TJMKuijpers TJMKuijpers changed the title Mutaitonal signature plot with cosmic reference signature Mutational signature plot with cosmic reference signature Nov 10, 2023
@inodb inodb force-pushed the cosmic-reference-signature-plot branch from 6a27001 to cc6755d Compare December 12, 2023 11:08
@inodb
Copy link
Member

inodb commented Dec 12, 2023

@TJMKuijpers Looks great!

Product feedback

  • Mutational count (value) -> Mutation count - I think this is just nr of mutations (or percentages) right?

  • I think counts should always be integers (here y axis shows .5):

    image
  • Make tooltip on bars more clear, maybe 43 single nucleotide variants (x%) with a T(C>T)A or A(T>C)T change. Can do same for indels and DBS
    image

  • Add info icon explaining what SBS, DBS and ID are. Maybe right after the dropdown?
    image

  • Maybe make it more clear the bottom shows a reference signature? E.g.: Percentage of DBS -> COSMIC Reference and DBS2 (Smoking) -> DBS2 (Smoking) (%)

image

Other thoughts:

  • Switching the sample signature display inside of the tab feels a little odd, but I think it's ok for now:
image

Code Review

The cosmic reference files are stored directly in the frontend. That seems ok, as it's only 9.9MB and they stay pretty static:

9.9M    src/pages/patientView/mutationalSignatures/cosmic_reference.json

We also have some other reference files that are stored in the repo:

 17M    src/shared/lib/data/reference_genome_hg19.json

Just wondering if we should organize this a bit better, so it's clear both of these use a similar mechanism (e.g. they are stored in some shared reference files folder) CC @alisman

@TJMKuijpers
Copy link
Contributor Author

TJMKuijpers commented Dec 12, 2023

Community meeting remarks

  • Add sample summary

  • Add total mutational count

  • Clear label for the tooltip
    image

  • Right justify the numbers in mutational signature table
    image

  • Don't show a reference signature by default but let the user pick one.
    image

  • Add the cosmic annotation for the x-axis in ID plot
    mutationalBarChart (17)

  • Remove the parenthesis in the SBS axis label

  • Top legend boxes: increase width and spacing

  • General styling of the plot

  • Format the xticks for SBS to match the COSMIC plot
    mutationalBarChart (19)

@inodb inodb force-pushed the cosmic-reference-signature-plot branch from 6104ab1 to d48fa60 Compare December 21, 2023 15:35
Copy link

netlify bot commented Dec 22, 2023

Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit bda597a
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/65b9766a14b1b000084b9e7e
😎 Deploy Preview https://deploy-preview-4771--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.

@TJMKuijpers TJMKuijpers force-pushed the cosmic-reference-signature-plot branch 3 times, most recently from 93200a6 to 30511e0 Compare December 29, 2023 12:19
@inodb
Copy link
Member

inodb commented Jan 2, 2024

Thanks @TJMKuijpers !

One more minor thing:

  • PDF download does not work for me
  • Can we call the tab Mutational Signatures (so remove "Data")
  • For the y axis, can we name it the same as for COSMIC? E.g. for SBS, write it out: Single Base Substitutions (%), Indels (%), Double Base Substitutions (%)

Other thoughts:

  • When looking at multiple samples for one patient, the select by row feels a little odd. A select per cell might be cleaner, where you e.g. select the sample + reference in that cell. We can follow up with this later, but just a thought

@schultzn
Copy link

schultzn commented Jan 2, 2024

Thanks @TJMKuijpers

I agree with Ino's comments above. Some other thoughts:

  • Can you rename "Version" in the top left corner to "Variant Class" to be consistent with COSMIC nomenclature?
  • Does it make sense to always show the y-axis as 100%? COSMIC seems to dynamically change the y-axis to match the data.
  • In the bar chart tooltips for small insertions and deletions, 1 bp insertions and deletions, the last word needs to be removed (deletion / insertion).
  • It is not clear at all to me how to switch samples for a patient with multiple samples, e.g. this one.

@tmazor
Copy link
Contributor

tmazor commented Jan 2, 2024

I agree with Ino & Niki's comments, and have a few additional notes:

  • I think the axis labels & tooltips using a different font than the rest of the site - if that's true, please standardize
    image

  • Looks like there's a missing space in the tooltip after each colon
    image

  • I suggest some slight changes to the tooltip text that I think will help with clarity & interpretation:
    Instead of "20% SBS of [C->T] around A[C->T]G"
    image
    how about "20% of SBS mutations (x/y) are C>T at A[C>T]G trinucleotide" where x/y is the fraction used to calculate 20%.
    Similarly for DBS:
    "33% DBS of CC to AG" --> "33% of DBS mutations (1/3) are CC>AG"
    image
    And for ID:
    "11% 1bp deletion(C) with homopolymer length of 0 deletion" --> "11% of small indels (x/y) are 1bp deletion of C in a homopolymer of length 0"
    image

  • Tooltip is cutoff when it runs into the edge of the plot
    image
    https://private.cbioportal.mskcc.org/patient/mutationalSignatures?studyId=pancan_pcawg_2020&caseId=DO46334

@TJMKuijpers
Copy link
Contributor Author

  • PDF download does not work for me

@inodb I'm able to download the plot as PDF in Chrome, Brave and FireFox. Is this a Safari issue?

@TJMKuijpers
Copy link
Contributor Author

how to switch samples for a patient with multiple samples, e.g. this one.

The sample selector disappears when not all samples are profiled for mutational signatures (which is the case for DO46329). I added a banner to make this more clear.
image

@TJMKuijpers
Copy link
Contributor Author

@schultzn

Does it make sense to always show the y-axis as 100%? COSMIC seems to dynamically change the y-axis to match the data.

I think it does make sense if you want to compare the sample profile versus the reference profile. I think it would be more difficult to compare the two if the y-axis match the data (for example when sample mutational profile is between 0-50% and the reference plot between 0-10%)

@TJMKuijpers TJMKuijpers force-pushed the cosmic-reference-signature-plot branch 2 times, most recently from b31781b to 3e433b2 Compare January 8, 2024 15:04
updated progress bar tooltip

Fixed change version error

Update color signature class unknown

Updated the labels to COSMIC style

Change spacing between the plot and reference

Updated the data store

Updated bar chart and table

Updated mutational signatures table

Fixed highlighting of the mutational signature table

Updated click behavior table

Revmoved commented code

Removed unnecessary imports

updated number of top signatures

Removed spaces

Update with community feedback

Update mutational signature plot with new tooltip and annotation

Removed <text> tag

Updated bar chart

Align contribution values in table to the right

Update the indel label with counting from 1-6+ for insertion and microhomology

Update the MutationalSignatureBarChart test

SBS labels COSMIC style format

Bar width responsive to screen size

Updated d3 scaleBand to scalePoint

Updated screenshot

Updated the tooltip to show significant signatures

Updated tooltip significant mutational signatures

Updated the tooltip, Sample not profiled banner

label padding and theme
@inodb inodb force-pushed the cosmic-reference-signature-plot branch from 3e433b2 to f3937f4 Compare January 30, 2024 15:38
Copy link
Member

@inodb inodb left a comment

Choose a reason for hiding this comment

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

Thanks so much for fixing all the feedback! Great job! Updated some localdb screenshots, will merge shortly

@inodb inodb merged commit 759b34f into cBioPortal:master Jan 31, 2024
13 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