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 mutations table and fisher exact two-sided p value to comparison lollipop #4556

Conversation

gblaih
Copy link
Contributor

@gblaih gblaih commented Mar 22, 2023

@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch 2 times, most recently from 0b7979f to f9b8f3b Compare March 22, 2023 20:08
@inodb inodb added the feature label Mar 24, 2023
@inodb inodb requested a review from onursumer March 24, 2023 14:48
@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch from efc68e9 to 5abb62d Compare March 27, 2023 16:58
@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch from 600a1de to f854c96 Compare April 10, 2023 14:56
@@ -7,6 +7,7 @@ import styles from './filterResetPanel.module.scss';
type FilterResetPanelProps = {
resetFilters: () => void;
filterInfo?: JSX.Element | string;
shiftClickMessage?: JSX.Element | string;
Copy link
Member

Choose a reason for hiding this comment

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

I would name this prop additionalInfo or something like that. FilterResetPanel doesn't need to know what a shift+click is.

@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch 3 times, most recently from c19def2 to d8cbb9d Compare April 14, 2023 16:44
@@ -34,14 +35,18 @@ export class FilterResetPanel extends React.Component<
data-test="filter-reset-panel"
>
<span style={{ verticalAlign: 'middle' }}>
{this.props.filterInfo}
<span style={{ fontWeight: 'bold' }}>
Copy link
Collaborator

@alisman alisman Apr 18, 2023

Choose a reason for hiding this comment

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

use <strong> tag instead of inline style

groupToProfiledPatientCounts,
}: IFisherExactTwoSidedTestLabelProps) => {
const mutationCountForActiveGeneGroupA = countUniqueMutations(
_.intersection(
Copy link
Collaborator

Choose a reason for hiding this comment

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

we've had performance problems with intersect before. look up the package "fast-array-intersect" which we use elsehwere in our project and i think will be must faster.

)
);

const getFisherTestLabel = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

doesn't really make sense to declare function here. if you want encapsulate and test this logic then put function outside and pass it the variables it needs. otherwise, just assign to local variable.

};

return (
<div style={{ fontWeight: 'bold' }}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

wrap in <strong> inside of div

}

@observer
export default class GroupComparisonMutationMapper extends MutationMapper<
IGroupComparisonMutationMapperProps
> {
@observable.ref _enrichedGroups: string[] = this.props.groups.map(
Copy link
Collaborator

Choose a reason for hiding this comment

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

i would do this assignment in the constructor. makes it more clear that we are starting with something that comes from a prop but that henceforth this state will be managed internally and can be out of sync with the prop. is this the intention?

@observable.ref _enrichedGroups: string[] = this.props.groups.map(
group => group.nameWithOrdinal
);
@observable significanceFilter: boolean = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

not a good name for a boolean. hasSignificanceFilter? singnificanceFilterEnabled?

@@ -46,8 +76,119 @@ export default class GroupComparisonMutationMapper extends MutationMapper<
return null;
}

protected formatPaginationStatusText = (text: string) => {
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 really be a free function (not a method of class) which accepts text and tableData as arguments. would be much easier to test.

? 'Mutation'
: 'Mutations';

return text.includes('Mutations')
Copy link
Collaborator

Choose a reason for hiding this comment

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

interesting (and yucky!) we should explain this with a comment if it must be.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, we really need a comment on this whole function to explain what it does


@computed get rowDataByProteinChange() {
let dataStore = this.props.store.dataStore as MutationMapperDataStore;
let mutationsByProteinChange = _.values(
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should avoid nesting lodash. use chaining instead.
also, this seems strange because, unless i'm mistaken, will result in array of arrays? where mutationsByPorteinChange suggests a map of proteinChange to mutations.

return _.pickBy(this.rowDataByProteinChange, v => {
return this.significanceFilter
? this._enrichedGroups.includes(v.enrichedGroup) &&
v.qValue < 0.05
Copy link
Collaborator

@alisman alisman Apr 18, 2023

Choose a reason for hiding this comment

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

0.05 should be a constant defined somewhere and we should explain in comment it's meaning. having a constant name will help to explain it.


@autobind
protected mutationsGroupedByProteinChangeForGroup(groupIndex: number) {
let allGroupedData = this.store.dataStore.allData;
Copy link
Collaborator

Choose a reason for hiding this comment

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

try to avoid using let in general. here, you could just do
const allGroupedData = groupDataByGroupFilters with third arg being this.store.data.store.allData, no?

.uniq()
.value();

const filters = proteinChanges.map(value => ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

just combine this with chain above and use comments to explain/label the steps.

_.forIn(
this.mutationsGroupedByProteinChangeForGroup(groupIndex),
(v, k) => {
const uniqueMutations = _.uniqBy(v.data, d => d[0].patientId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

put in a comment here why it's uniq by patient

type="checkbox"
checked={this.significanceFilter}
onClick={this.toggleSignificanceFilter}
data-test="SwapAxes"
Copy link
Collaborator

Choose a reason for hiding this comment

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

give it a test handle that's a little more specific to feature.

@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch 4 times, most recently from 0cf182a to ca3ad0d Compare July 5, 2023 17:22
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 ! This looks good to me

As it also partially addresses: cBioPortal/cbioportal#9943. Could we do a follow up PR that updates FAQ etc?

@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch from ca3ad0d to 42431de Compare July 7, 2023 15:21
@gblaih gblaih force-pushed the group-comparison-lollipop-plot-mutations-table branch from 42431de to 24bf9a8 Compare July 7, 2023 15:56
@alisman alisman merged commit 6f94eaa into cBioPortal:master Jul 7, 2023
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
4 participants