) {
// determine count
const count =
caseType === 'sample'
? selectionInfo.overlappingSamples.length
: selectionInfo.overlappingPatients.length;
if (count === 0) {
// omit message if 0 overlap
return null;
}
let message;
if (
this.props.survivalTabMode &&
selectionInfo.totalPatientOverlap > 0 &&
this.props.store.overlapStrategy === OverlapStrategy.INCLUDE
) {
// handle survival mode
message = makeSurvivalTabMessage(count);
} else {
// determine groups
const includedGroups = selectionInfo.groups.filter(
g => !(g.uid in selectionInfo.excludedFromAnalysis)
);
const groupsAreExcluded =
includedGroups.length < selectionInfo.groups.length;
let groupsSummary;
if (groupsAreExcluded) {
groupsSummary = (
between {joinGroupNames(includedGroups, 'and')}
);
} else {
groupsSummary = in the selected groups;
}
message = (
{`${
caseType === 'sample' ? 'Samples' : 'Patients'
} (${count}) that overlap `}
{groupsSummary}
{` are ${
this.props.store.overlapStrategy ===
OverlapStrategy.INCLUDE
? 'included in'
: 'excluded from'
}`}
{this.props.overlapTabMode
? ` ${caseType}-level analysis in other tabs.`
: ` ${caseType}-level analysis below.`}
);
}
return (
{message}
);
}
render() {
if (!this.props.store.overlapComputations.isComplete) {
return null;
} else {
const selectionInfo = this.props.store.overlapComputations.result!;
if (
(!selectionInfo.totalSampleOverlap &&
!selectionInfo.totalPatientOverlap) ||
(this.props.only === 'sample' &&
!selectionInfo.totalSampleOverlap) ||
(this.props.only === 'patient' &&
!selectionInfo.totalPatientOverlap)
) {
return null;
}
return (
{this.excludedGroupsSummary.component}
{this.props.only !== 'patient' &&
this.makeOverlappingCasesMessage(
'sample',
selectionInfo
)}
{this.props.only !== 'sample' &&
this.makeOverlappingCasesMessage(
'patient',
selectionInfo
)}
);
}
}
}