Skip to content

Commit 2e24485

Browse files
authored
RFC69 : survival chart with landmark events and hazard ratio (#4740)
Add the group information as label below chart landmark line functionality Dynamic calculation of groups for axis Implement hazard ratio show hazard ratio between every group Remove hazard ratio warning when feature flag is disabled Removed feature flag for survival chart
1 parent 4a84511 commit 2e24485

21 files changed

+2448
-230
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
var goToUrlAndSetLocalStorage = require('../../shared/specUtils')
2+
.goToUrlAndSetLocalStorage;
3+
var waitForNetworkQuiet = require('../../shared/specUtils').waitForNetworkQuiet;
4+
var openGroupComparison = require('../../shared/specUtils').openGroupComparison;
5+
var assertScreenShotMatch = require('../../shared/lib/testUtils')
6+
.assertScreenShotMatch;
7+
var setInputText = require('../../shared/specUtils').setInputText;
8+
var {
9+
setDropdownOpen,
10+
selectClinicalTabPlotType,
11+
getElementByTestHandle,
12+
setCheckboxChecked,
13+
} = require('../../shared/specUtils');
14+
15+
const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, '');
16+
17+
describe('Screenshot test for extend survival chart (feature flag)', function() {
18+
this.retries(0);
19+
20+
before(function() {
21+
openGroupComparison(
22+
`${CBIOPORTAL_URL}/study/summary?id=lgg_ucsf_2014_test_generic_assay&featureFlags=SURVIVAL_PLOT_EXTENDED`,
23+
'chart-container-OS_STATUS',
24+
100000
25+
);
26+
$('.tabAnchor_survival').click();
27+
$('[data-test="ComparisonPageSurvivalTabDiv"]').waitForExist({
28+
timeout: 20000,
29+
});
30+
});
31+
it('Survival chart with landmark event and hazard ratio disabled', function() {
32+
var res = browser.checkElement('div[data-test=SurvivalChart]');
33+
assertScreenShotMatch(res);
34+
});
35+
it('Survival chart with landmark event at time point 20', function() {
36+
setCheckboxChecked(true, 'input[data-test=landmarkLines]');
37+
setInputText('input[data-test=landmarkValues]', '20');
38+
var res = browser.checkElement('div[data-test=SurvivalChart]');
39+
assertScreenShotMatch(res);
40+
});
41+
it('Survival chart with hazard ratio table', function() {
42+
setCheckboxChecked(false, 'input[data-test=landmarkLines]');
43+
setCheckboxChecked(true, 'input[data-test=hazardRatioCheckbox]');
44+
var res = browser.checkElement('div[data-test=survivalTabView]');
45+
assertScreenShotMatch(res);
46+
});
47+
it('Survival chart with hazard ratio table and landmark line', function() {
48+
setCheckboxChecked(true, 'input[data-test=landmarkLines]');
49+
setInputText('input[data-test=landmarkValues]', '20');
50+
setCheckboxChecked(true, 'input[data-test=hazardRatioCheckbox]');
51+
var res = browser.checkElement('div[data-test=survivalTabView]');
52+
assertScreenShotMatch(res);
53+
});
54+
});

src/pages/groupComparison/ClinicalData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { scatterPlotSize } from 'shared/components/plots/PlotUtils';
3434
import {
3535
CLINICAL_TAB_NOT_ENOUGH_GROUPS_MSG,
3636
ClinicalDataEnrichmentWithQ,
37-
getStatisticalCautionInfo,
37+
GetStatisticalCautionInfo,
3838
} from './GroupComparisonUtils';
3939
import ReactSelect from 'react-select1';
4040
import { MakeMobxView } from 'shared/components/MobxView';
@@ -170,7 +170,7 @@ export default class ClinicalData extends React.Component<
170170
} else {
171171
content.push(
172172
<div className={'tabMessageContainer'}>
173-
{getStatisticalCautionInfo()}
173+
<GetStatisticalCautionInfo />
174174
<OverlapExclusionIndicator store={this.props.store} />
175175
</div>
176176
);

src/pages/groupComparison/GroupComparisonUtils.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ export function getGroupsDownloadData(
931931
return lines.map(line => line.join('\t')).join('\n');
932932
}
933933

934-
export function getStatisticalCautionInfo() {
934+
export const GetStatisticalCautionInfo: React.FunctionComponent = () => {
935935
return (
936936
<div className="alert alert-info">
937937
<i
@@ -947,7 +947,25 @@ export function getStatisticalCautionInfo() {
947947
analyses. Consider consulting a statistician.
948948
</div>
949949
);
950-
}
950+
};
951+
952+
export const GetHazardRatioCautionInfo: React.FunctionComponent = () => {
953+
return (
954+
<div className="alert alert-info">
955+
<i
956+
className="fa fa-md fa-info-circle"
957+
style={{
958+
verticalAlign: 'middle !important',
959+
marginRight: 6,
960+
marginBottom: 1,
961+
}}
962+
/>
963+
The log-rank test is used to test the null hypothesis that there is
964+
no difference between the groups in the probability of an event at
965+
any time point. Hazard ratios are derived from the log-rank test.
966+
</div>
967+
);
968+
};
951969

952970
export const AlterationFilterMenuSection: React.FunctionComponent<{
953971
store: ComparisonStore;

src/pages/groupComparison/Survival.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { MakeMobxView } from '../../shared/components/MobxView';
88
import {
99
SURVIVAL_NOT_ENOUGH_GROUPS_MSG,
1010
SURVIVAL_TOO_MANY_GROUPS_MSG,
11-
getStatisticalCautionInfo,
11+
GetStatisticalCautionInfo,
12+
GetHazardRatioCautionInfo,
1213
} from './GroupComparisonUtils';
1314
import ErrorMessage from '../../shared/components/ErrorMessage';
1415
import { blendColors } from './OverlapUtils';
@@ -316,7 +317,8 @@ export default class Survival extends React.Component<ISurvivalProps, {}> {
316317
className={'tabMessageContainer'}
317318
style={{ paddingBottom: 0 }}
318319
>
319-
{getStatisticalCautionInfo()}
320+
<GetStatisticalCautionInfo />
321+
<GetHazardRatioCautionInfo />
320322
{isGenieBpcStudy &&
321323
!this.props.store.isLeftTruncationAvailable
322324
.result && (
@@ -703,8 +705,9 @@ export default class Survival extends React.Component<ISurvivalProps, {}> {
703705
/>
704706
)}
705707
<div
708+
data-test={'survivalTabView'}
706709
className="borderedChart"
707-
style={{ width: '920px' }}
710+
style={{ width: 'auto' }}
708711
>
709712
<SurvivalChart
710713
key={key}

0 commit comments

Comments
 (0)