Skip to content

Commit

Permalink
Merge pull request #4107 from alisman/density
Browse files Browse the repository at this point in the history
Fix handling of Spearman correlation (et al) with NaN value from server

Former-commit-id: 8bca1f8e271f50aa2aad94494268f1c53705e381
  • Loading branch information
alisman authored Jan 3, 2022
2 parents 41cf771 + 5eee883 commit f357a88
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ export default class StudyViewDensityScatterPlot
</text>,
];
let correlationLabels;

const pearson = _.isNumber(this.props.pearsonCorr)
? this.props.pearsonCorr.toFixed(4)
: this.props.pearsonCorr;
const spearman = _.isNumber(this.props.spearmanCorr)
? this.props.spearmanCorr.toFixed(4)
: this.props.spearmanCorr;

if (this.numSamples > 2) {
// otherwise p-values are null

Expand All @@ -512,7 +520,7 @@ export default class StudyViewDensityScatterPlot
y={rectY + rectHeight + 55}
dy={'-0.3em'}
>
{this.props.pearsonCorr.toFixed(4)}
{pearson}
</text>,
<text
fontSize={10.5}
Expand All @@ -538,7 +546,7 @@ export default class StudyViewDensityScatterPlot
y={rectY + rectHeight + 115}
dy={'-0.3em'}
>
{this.props.spearmanCorr.toFixed(4)}
{spearman}
</text>,
<text
fontSize={10.5}
Expand Down

0 comments on commit f357a88

Please sign in to comment.