Skip to content

Commit

Permalink
add p value to boxplots of comparison clinical tab (cBioPortal#4842)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryan Lai <[email protected]>
  • Loading branch information
gblaih and Bryan Lai authored Feb 5, 2024
1 parent 2097f99 commit 8e132c3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/pages/groupComparison/ClinicalData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,16 @@ export default class ClinicalData extends React.Component<
symbol="circle"
useLogSpaceTicks={true}
legendLocationWidthThreshold={550}
pValue={
this.showPAndQ
? this.highlightedRow.pValue
: null
}
qValue={
this.showPAndQ
? this.highlightedRow.qValue
: null
}
/>
);
} else if (this.boxPlotData.isError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export type ClinicalNumericalDataVisualisationProps = IBoxScatterPlotProps<
IBoxScatterPlotPoint
> & {
type: ClinicalNumericalVisualisationType;
pValue: number | null;
qValue: number | null;
};

export class ClinicalNumericalDataVisualisation extends React.Component<
Expand Down Expand Up @@ -70,6 +72,8 @@ export class ClinicalNumericalDataVisualisation extends React.Component<
legendLocationWidthThreshold={
this.props.legendLocationWidthThreshold
}
pValue={this.props.pValue}
qValue={this.props.qValue}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/groupComparison/MultipleCategoryBarPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ type PQValueLabelProps = {
qValue: number | null;
};

const PQValueLabel: React.FunctionComponent<PQValueLabelProps> = props => {
export const PQValueLabel: React.FunctionComponent<PQValueLabelProps> = props => {
const pFormatted = formatLabel('p', props.pValue);
const qFormatted = formatLabel('q', props.qValue);
return (
Expand Down
9 changes: 9 additions & 0 deletions src/shared/components/plots/BoxScatterPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import classnames from 'classnames';
import WindowStore from '../window/WindowStore';
import LegendDataComponent from './LegendDataComponent';
import LegendLabelComponent from './LegendLabelComponent';
import { PQValueLabel } from 'pages/groupComparison/MultipleCategoryBarPlot';

export interface IBaseBoxScatterPlotPoint {
value: number;
Expand Down Expand Up @@ -91,6 +92,8 @@ export interface IBoxScatterPlotProps<D extends IBaseBoxScatterPlotPoint> {
svgRef?: (svgContainer: SVGElement | null) => void;
compressXAxis?: boolean;
legendTitle?: string | string[];
pValue?: number | null;
qValue?: number | null;
}

type BoxModel = {
Expand Down Expand Up @@ -818,6 +821,12 @@ export default class BoxScatterPlot<
>
{this.title}
{this.legend}
<PQValueLabel
x={this.chartWidth - 40}
y={50}
pValue={this.props.pValue || null}
qValue={this.props.qValue || null}
/>
{this.horzAxis}
{this.vertAxis}
<VictoryBoxPlot
Expand Down

0 comments on commit 8e132c3

Please sign in to comment.