From 68c2b0674e8ae13786120319e319c956d2353059 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Mon, 18 Mar 2024 09:04:20 -0400 Subject: [PATCH 1/2] KPMP-5219: update table logic for DMR & SN table --- .../ExpressionTables/ExpressionXCellType.js | 22 +++++++++---------- src/helpers/Utils.js | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/ExpressionTables/ExpressionXCellType.js b/src/components/ExpressionTables/ExpressionXCellType.js index 999272c6..8cf434ec 100644 --- a/src/components/ExpressionTables/ExpressionXCellType.js +++ b/src/components/ExpressionTables/ExpressionXCellType.js @@ -31,11 +31,11 @@ class ExpressionXCellType extends Component { clusterAbbrev: cluster, clusterName: clusterName, cellCount: cellCount ? cellCount : 0, - meanExp: formatNumberToPrecision(avgExp, 3), - pctCellsExpressing: formatNumberToPrecision(pct1Value, 3), - foldChange: formatNumberToPrecision(foldChange, 3), - pVal: formatNumberToPrecision(pVal, 3), - pValAdj: formatNumberToPrecision(pValAdj, 3) + meanExp: formatNumberToPrecision(avgExp, 3, false, this.props.dataType, this.props.tissueType), + pctCellsExpressing: formatNumberToPrecision(pct1Value, 3, false, this.props.dataType, this.props.tissueType), + foldChange: formatNumberToPrecision(foldChange, 3, false, this.props.dataType, this.props.tissueType), + pVal: formatNumberToPrecision(pVal, 3, false, this.props.dataType, this.props.tissueType), + pValAdj: formatNumberToPrecision(pValAdj, 3, false, this.props.dataType, this.props.tissueType) } }); }; @@ -85,14 +85,14 @@ class ExpressionXCellType extends Component { Averaged expression values (logarithmic) for each cell cluster , name: 'avgExp', - getCellValue: row => formatNumberToPrecision(row.avgExp, 3) + getCellValue: row => formatNumberToPrecision(row.avgExp, 3, false, this.props.dataType, this.props.tissueType) }, { title: % CELLS
EXPRESSING
, name: 'pct1', getCellValue: row => { let newValue = (row.pct1 > 0) ? (row.pct1 * 100) : row.pct1; - return formatNumberToPrecision(newValue, 3); + return formatNumberToPrecision(newValue, 3, false, this.props.dataType, this.props.tissueType); } }, { @@ -101,7 +101,7 @@ class ExpressionXCellType extends Component { Log fold-change of the average expression between this cell cluster and all others. Positive values indicate that the feature is more highly expressed in this cell cluster. , name: 'foldChange', - getCellValue: row => formatNumberToPrecision(row.foldChange, 3) + getCellValue: row => formatNumberToPrecision(row.foldChange, 3, false, this.props.dataType, this.props.tissueType) }, { title: P VALUE @@ -109,7 +109,7 @@ class ExpressionXCellType extends Component { p-value (unadjusted) , name: 'pVal', - getCellValue: row => formatNumberToPrecision(row.pVal, 3) + getCellValue: row => formatNumberToPrecision(row.pVal, 3, false, this.props.dataType, this.props.tissueType) }, { title: ADJ
P VALUE @@ -117,7 +117,7 @@ class ExpressionXCellType extends Component { Adjusted p-value, based on bonferroni correction using all features in the dataset.
, name: 'pValAdj', - getCellValue: row => formatNumberToPrecision(row.pValAdj, 3) + getCellValue: row => formatNumberToPrecision(row.pValAdj, 3, false, this.props.dataType, this.props.tissueType) } ] }; @@ -189,7 +189,7 @@ class ExpressionXCellType extends Component {
{this.props.gene} Expression Comparison across Cell Clusters in {formatTissueType(this.props.tissueType)}
-
NS = Not Significant
+
NS = Not Significant { (this.props.dataType == "sn" && this.props.tissueType == "dmr") && "| - = Not Calculated" }
{ +export const formatNumberToPrecision = (number, precision, keepAsInt = false, dataType = "", tissueType = "") => { if (number) { return number.toPrecision(precision) } else if (number === 0) { return 0 } else { + if (dataType == "sn" && tissueType == "dmr") { + return "-" + } return "NS" } }; From 44901d2461a65be9eb40915d2447da6e607eb0e5 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Mon, 18 Mar 2024 09:38:49 -0400 Subject: [PATCH 2/2] update equality operator --- src/components/ExpressionTables/ExpressionXCellType.js | 2 +- src/helpers/Utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ExpressionTables/ExpressionXCellType.js b/src/components/ExpressionTables/ExpressionXCellType.js index 8cf434ec..b862877c 100644 --- a/src/components/ExpressionTables/ExpressionXCellType.js +++ b/src/components/ExpressionTables/ExpressionXCellType.js @@ -189,7 +189,7 @@ class ExpressionXCellType extends Component {
{this.props.gene} Expression Comparison across Cell Clusters in {formatTissueType(this.props.tissueType)}
-
NS = Not Significant { (this.props.dataType == "sn" && this.props.tissueType == "dmr") && "| - = Not Calculated" }
+
NS = Not Significant { (this.props.dataType === "sn" && this.props.tissueType === "dmr") && "| - = Not Calculated" }