-
Notifications
You must be signed in to change notification settings - Fork 303
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
Capture selected scale in URL in group comparison lollipop plot #4436
Merged
alisman
merged 4 commits into
cBioPortal:master
from
gblaih:group-comparison-lollipop-plot-scale-url
Dec 5, 2022
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,11 @@ import { MakeMobxView } from 'shared/components/MobxView'; | |
import { countUniqueMutations } from 'shared/lib/MutationUtils'; | ||
import ErrorMessage from 'shared/components/ErrorMessage'; | ||
import { AxisScale, LollipopTooltipCountInfo } from 'react-mutation-mapper'; | ||
import GroupComparisonURLWrapper from './GroupComparisonURLWrapper'; | ||
|
||
interface IGroupComparisonMutationsTabPlotProps { | ||
store: GroupComparisonStore; | ||
urlWrapper: GroupComparisonURLWrapper; | ||
mutations?: Mutation[]; | ||
filters?: any; | ||
} | ||
|
@@ -37,7 +39,6 @@ function plotYAxisLabelFormatter(symbol: string, groupName: string) { | |
} | ||
} | ||
return `${symbol} ${label}`; | ||
// return `${symbol} ${groupName}`; | ||
} | ||
|
||
function plotLollipopTooltipCountInfo( | ||
|
@@ -59,7 +60,6 @@ export default class GroupComparisonMutationsTabPlot extends React.Component< | |
IGroupComparisonMutationsTabPlotProps, | ||
{} | ||
> { | ||
@observable public axisMode: AxisScale = AxisScale.PERCENT; | ||
constructor(props: IGroupComparisonMutationsTabPlotProps) { | ||
super(props); | ||
makeObservable(this); | ||
|
@@ -78,17 +78,19 @@ export default class GroupComparisonMutationsTabPlot extends React.Component< | |
mutations: Mutation[], | ||
group: string | ||
) { | ||
return this.axisMode === AxisScale.PERCENT | ||
? (countUniqueMutations(mutations) / | ||
return this.props.urlWrapper.query.axisMode === AxisScale.COUNT | ||
? countUniqueMutations(mutations) | ||
: (countUniqueMutations(mutations) / | ||
this.props.store.groupToProfiledSamples.result![group] | ||
.length) * | ||
100 | ||
: countUniqueMutations(mutations); | ||
100; | ||
} | ||
|
||
@action.bound | ||
private onScaleToggle(selectedScale: AxisScale) { | ||
this.axisMode = selectedScale; | ||
this.props.urlWrapper.updateURL({ | ||
axisMode: selectedScale, | ||
}); | ||
} | ||
|
||
readonly plotUI = MakeMobxView({ | ||
|
@@ -130,7 +132,11 @@ export default class GroupComparisonMutationsTabPlot extends React.Component< | |
plotLollipopTooltipCountInfo={ | ||
plotLollipopTooltipCountInfo | ||
} | ||
axisMode={this.axisMode} | ||
axisMode={ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, just give the component an axisMode property and keep it agnostic to the url, which is really a concert of the page component There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
this.props.urlWrapper.query.axisMode | ||
? this.props.urlWrapper.query.axisMode | ||
: AxisScale.PERCENT | ||
} | ||
onScaleToggle={this.onScaleToggle} | ||
plotYAxisLabelFormatter={plotYAxisLabelFormatter} | ||
/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to give this component a property onScaleToggle and then update the urlWrapper at this level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, gave component onScaleToggle