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 sample and patient counts toggle for cancer summary chart tooltip #5110

Merged

Conversation

gblaih
Copy link
Contributor

@gblaih gblaih commented Feb 20, 2025

Fix cBioPortal/cbioportal#11311

Adds option to toggle between sample and patient counts in tooltip of cancer summary chart in results view. Previously, it only showed sample counts with no option to switch.

Screenshot 2025-02-20 at 5 15 42 PM

Copy link

netlify bot commented Feb 20, 2025

Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit 3c4ef59
🔍 Latest deploy log https://app.netlify.com/sites/cbioportalfrontend/deploys/67c62047b80334000834652f
😎 Deploy Preview https://deploy-preview-5110.preview.cbioportal.org
📱 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.

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 @gblaih ! The counts look good, but would be nice to update the "cases" text to "samples" when selecting "Sample Counts" (patient and case are often used as synonyms):

image

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.

Looks great! Thanks @gblaih ! Can you make the default "Patient Counts", similar to how the oncoprint works

coverageInformation
);

const alterationCounts = countByProperty
Copy link
Member

Choose a reason for hiding this comment

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

countByProperty is not a boolean so we should do something like this, right?

Suggested change
const alterationCounts = countByProperty
const alterationCounts = countByProperty === 'sampleCounts'


let alterationCounts =
countByProperty === 'sampleCounts'
? countAlterationOccurences(
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 rename this to countSampleAlterationOccurences?

@@ -272,3 +295,217 @@ export function countAlterationOccurences(
}
);
}

export function countPatientAlterationOccurences(
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 a pretty long function with nested function calls. would be nice to simplify/flatten this procedure but not sure if there is an easy way to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this function is based on the also lengthy countAlterationOccurences function but with some additional logic to account for the fact we are working with patients. i tried to combine these two into one but that proved to be very sloppy and difficult to read. i don't think it would be easy to simplify this right now but maybe can look into making both these functions cleaner in the future

@gblaih gblaih force-pushed the results-cancer-types-summary-counts-tooltip branch from ee8565f to 3c4ef59 Compare March 3, 2025 21:33
@alisman alisman merged commit 7a2006b into cBioPortal:master Mar 6, 2025
14 of 17 checks passed
@gblaih gblaih deleted the results-cancer-types-summary-counts-tooltip branch March 6, 2025 16:04
lllinging pushed a commit to lllinging/cbioportal-frontend that referenced this pull request Mar 9, 2025
…cBioPortal#5110)

* add sample and patient counts toggle for tooltip

* update text to use samples or cases depending on user select

---------

Co-authored-by: Bryan Lai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cancer type summary shows sample counts in tooltip rather than cases
4 participants