-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show clinical data numerical summary statistics as table
- Loading branch information
Bas Leenknegt
committed
Jun 8, 2022
1 parent
de475f0
commit e877a63
Showing
16 changed files
with
316 additions
and
117 deletions.
There are no files selected for viewing
Binary file added
BIN
+27 KB
...ference/displays_100%_stacked_bar_chart_by_default_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.4 KB
...ce/displays_heatmap_when_picked_from_plot_dropdown_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.8 KB
...nshots/reference/shows_box_plot_for_numerical_data_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.7 KB
...nce/shows_table_when_selecting_table_visualisation_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Binary file modified
BIN
+1.63 KB
(100%)
...cluding_unprofiled_samples_comparison_tab_clinical_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.3 KB
(100%)
...ab_include_overlapping_samples_kruskal_wallis_test_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.43 KB
(100%)
...n_page_clinical_tab_log_scale__kruskal_wallis_test_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.76 KB
(100%)
..._page_clinical_tab_swaped_axes_kruskal_wallis_test_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.5 KB
(100%)
...ab_include_overlapping_samples_kruskal_wallis_test_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.18 KB
(100%)
...on_tab_clinical_tab_log_scale__kruskal_wallis_test_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.83 KB
(100%)
...n_tab_clinical_tab_swaped_axes_kruskal_wallis_test_element_chrome_1600x1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
76 changes: 76 additions & 0 deletions
76
src/pages/groupComparison/ClinicalNumericalDataVisualisation.tsx
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import BoxScatterPlot, { | ||
IBoxScatterPlotProps, | ||
toBoxPlotData, | ||
} from 'shared/components/plots/BoxScatterPlot'; | ||
import { IBoxScatterPlotPoint } from 'pages/resultsView/plots/PlotsTabUtils'; | ||
import React from 'react'; | ||
import { computed, makeObservable } from 'mobx'; | ||
import { SummaryStatisticsTable } from './SummaryStatisticsTable'; | ||
|
||
export enum ClinicalNumericalVisualisationType { | ||
Plot = 'Plot', | ||
Table = 'Table', | ||
} | ||
|
||
export class PlotsTabBoxPlot extends BoxScatterPlot<IBoxScatterPlotPoint> {} | ||
|
||
export type ClinicalNumericalDataVisualisationProps = IBoxScatterPlotProps< | ||
IBoxScatterPlotPoint | ||
> & { | ||
type: ClinicalNumericalVisualisationType; | ||
}; | ||
|
||
export class ClinicalNumericalDataVisualisation extends React.Component< | ||
ClinicalNumericalDataVisualisationProps | ||
> { | ||
constructor(props: any) { | ||
super(props); | ||
makeObservable(this); | ||
} | ||
|
||
render() { | ||
const isTable = | ||
this.props.type === ClinicalNumericalVisualisationType.Table; | ||
return <>{isTable ? this.table : this.plot}</>; | ||
} | ||
|
||
@computed get table() { | ||
const groupStats = toBoxPlotData( | ||
this.props.data, | ||
this.props.boxCalculationFilter, | ||
this.props.excludeLimitValuesFromBoxPlot, | ||
this.props.logScale | ||
); | ||
const groupLabels = this.props.data.map(d => d.label); | ||
return ( | ||
<SummaryStatisticsTable data={groupStats} labels={groupLabels} /> | ||
); | ||
} | ||
|
||
@computed get plot() { | ||
return ( | ||
<PlotsTabBoxPlot | ||
svgId={this.props.svgId} | ||
domainPadding={this.props.domainPadding} | ||
boxWidth={this.props.boxWidth} | ||
axisLabelX={this.props.axisLabelX} | ||
axisLabelY={this.props.axisLabelY} | ||
data={this.props.data} | ||
chartBase={this.props.chartBase} | ||
scatterPlotTooltip={this.props.scatterPlotTooltip} | ||
boxPlotTooltip={this.props.boxPlotTooltip} | ||
horizontal={this.props.horizontal} | ||
logScale={this.props.logScale} | ||
size={this.props.size} | ||
fill={this.props.fill} | ||
stroke={this.props.stroke} | ||
strokeOpacity={this.props.strokeOpacity} | ||
symbol={this.props.symbol} | ||
useLogSpaceTicks={this.props.useLogSpaceTicks} | ||
legendLocationWidthThreshold={ | ||
this.props.legendLocationWidthThreshold | ||
} | ||
/> | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { FunctionComponent } from 'react'; | ||
import _ from 'lodash'; | ||
import * as React from 'react'; | ||
|
||
type SummaryStatisticsTableProps = { data: any[]; labels: string[] }; | ||
|
||
export const SummaryStatisticsTable: FunctionComponent<SummaryStatisticsTableProps> = ( | ||
props: SummaryStatisticsTableProps | ||
) => { | ||
const headers = | ||
props.labels.length === 1 ? ( | ||
<th colSpan={2}>{props.labels[0]}</th> | ||
) : ( | ||
[<th />, props.labels.map(label => <th colSpan={1}>{label}</th>)] | ||
); | ||
return ( | ||
<table className="table table-striped" style={{ minWidth: '400px' }}> | ||
<thead> | ||
<tr>{headers}</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Maximum</td> | ||
{props.data.map(d => ( | ||
<td>{_.round(d.max, 2)}</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>75% (q3)</td> | ||
{props.data.map(d => ( | ||
<td>{_.round(d.q3, 2)}</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Median</td> | ||
{props.data.map(d => ( | ||
<td>{_.round(d.median, 2)}</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>25% (q1)</td> | ||
{props.data.map(d => ( | ||
<td>{_.round(d.q1, 2)}</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Minimum</td> | ||
{props.data.map(d => ( | ||
<td>{_.round(d.min, 2)}</td> | ||
))} | ||
</tr> | ||
</tbody> | ||
</table> | ||
); | ||
}; |
Oops, something went wrong.