From 94cc375a34a6e69c5f9fe18ecd0dc160618aefde Mon Sep 17 00:00:00 2001
From: sagely1 <114952739+sagely1@users.noreply.github.com>
Date: Tue, 2 Apr 2024 12:49:10 -0700
Subject: [PATCH 1/5] AG-1412 fixed bug in border condition handling logic
---
.../gene-comparison-tool.component.spec.ts | 20 +++++++++++++++++++
.../gene-comparison-tool.component.ts | 5 +++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
index ace93c52..add7e812 100644
--- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
+++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
@@ -27,6 +27,7 @@ import { ApiService, HelperService } from '../../../../core/services';
import { GeneService } from '../../../../features/genes/services';
import { routes } from '../../../../app.routing';
import { comparisonGeneEmptyHGNCMock, comparisonGeneMock1, comparisonGeneMock2 } from '../../../../testing';
+import { GCTGeneTissue } from '../../../../models';
const DEFAULT_SIGNIFICANCE_THRESHOLD = 0.05;
@@ -518,5 +519,24 @@ describe('Component: GeneComparisonToolComponent', () => {
const expected2 = 'ENSG00000147065';
expect(label2).toBe(expected2);
});
+
+ it('should set circle size to zero for null/undefined pValues', () => {
+ let tissue: GCTGeneTissue | undefined;
+ // null/undefined values should be zero
+ const result = component.getCircleSize(tissue?.adj_p_val);
+ expect(result).toBe(0);
+ });
+
+ it('should set circle size for pValues within acceptable ranges', () => {
+ let expectedSizeInPixels = 0;
+ let pValue = 0.5;
+ let result = component.getCircleSize(pValue);
+ expect(result).toBe(expectedSizeInPixels);
+
+ expectedSizeInPixels = 33;
+ pValue = 0.04;
+ result = component.getCircleSize(pValue);
+ expect(result).toBe(expectedSizeInPixels);
+ });
});
});
diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts
index 47e3fd2f..3882c817 100644
--- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts
+++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts
@@ -906,8 +906,9 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {
const MIN_SIZE = 6;
const MAX_SIZE = 50;
- // shouldn't be undefined but if it is, don't show a circle
- if (pval === undefined)
+ // pval shouldn't be undefined but if it is, don't show a circle
+ // null means there is no data in which case, also don't show a circle
+ if (pval === null || pval === undefined)
return 0;
// if significance cutoff radio button selected and
From 9604783c9f2501de7a34ed79d5f3de5a0703e342 Mon Sep 17 00:00:00 2001
From: sagely1 <114952739+sagely1@users.noreply.github.com>
Date: Wed, 3 Apr 2024 13:59:54 -0700
Subject: [PATCH 2/5] AG-1412 since getSignificantFigures() can return emdash,
need to use innerHTML
---
...gene-comparison-tool-details-panel.component.html | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html b/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html
index ce33000e..7bf0eb02 100644
--- a/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html
+++ b/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html
@@ -18,10 +18,8 @@
P-Value
-
{{ getSignificantFigures(data.value, 3) }}
-
- {{ getSignificantFigures(data.pValue, 3) }}
-
+
+
@@ -36,17 +34,17 @@
[style]="getIntervalPositions(data)"
>
-
{{ getSignificantFigures(data.intervalMin, 3) }}
+
-
{{ getSignificantFigures(data.intervalMax, 3) }}
+
-
{{ getSignificantFigures(data.value, 3) }}
+
From 3b28333577dddbfc530c4b10e1c464da71e8eac2 Mon Sep 17 00:00:00 2001
From: sagely1 <114952739+sagely1@users.noreply.github.com>
Date: Wed, 3 Apr 2024 17:58:20 -0700
Subject: [PATCH 3/5] AG-1412 update unit tests to test null/undefined pValues
for getCircleSize()
---
.../gene-comparison-tool.component.spec.ts | 11 +++++++++--
.../gene-comparison-tool.component.ts | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
index add7e812..ff31aab3 100644
--- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
+++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
@@ -520,13 +520,20 @@ describe('Component: GeneComparisonToolComponent', () => {
expect(label2).toBe(expected2);
});
- it('should set circle size to zero for null/undefined pValues', () => {
+ it('should set circle size to zero for undefined pValues', () => {
let tissue: GCTGeneTissue | undefined;
- // null/undefined values should be zero
+ // undefined values should result in a circle size of zero
+ expect(tissue).toBeUndefined();
const result = component.getCircleSize(tissue?.adj_p_val);
expect(result).toBe(0);
});
+ it('should set circle size to zero for null pValues', () => {
+ // null values should result in a circle size of zero pixels
+ const result = component.getCircleSize(null);
+ expect(result).toBe(0);
+ });
+
it('should set circle size for pValues within acceptable ranges', () => {
let expectedSizeInPixels = 0;
let pValue = 0.5;
diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts
index 3882c817..00856bcd 100644
--- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts
+++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts
@@ -901,7 +901,7 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {
}
}
- getCircleSize(pval: number | undefined) {
+ getCircleSize(pval: number | null | undefined) {
// define min and max size of possible circles in pixels
const MIN_SIZE = 6;
const MAX_SIZE = 50;
From 1467ca8123255f62461435af7476537528e81a77 Mon Sep 17 00:00:00 2001
From: sagely1 <114952739+sagely1@users.noreply.github.com>
Date: Wed, 3 Apr 2024 18:03:07 -0700
Subject: [PATCH 4/5] AG-1412 update unit test for clarity
---
.../gene-comparison-tool.component.spec.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
index ff31aab3..bc3b7f8f 100644
--- a/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
+++ b/src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.spec.ts
@@ -530,7 +530,8 @@ describe('Component: GeneComparisonToolComponent', () => {
it('should set circle size to zero for null pValues', () => {
// null values should result in a circle size of zero pixels
- const result = component.getCircleSize(null);
+ const pValue = null;
+ const result = component.getCircleSize(pValue);
expect(result).toBe(0);
});
From bc2612a39422bfdbc2aa1e828c39280f4f5c137b Mon Sep 17 00:00:00 2001
From: sagely1 <114952739+sagely1@users.noreply.github.com>
Date: Fri, 5 Apr 2024 13:33:15 -0700
Subject: [PATCH 5/5] AG-1412 using unicode character instead of html escape
sequence
---
...mparison-tool-details-panel.component.html | 20 ++++++++++++++-----
...comparison-tool-details-panel.component.ts | 2 +-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html b/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html
index 7bf0eb02..c81ac286 100644
--- a/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html
+++ b/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.html
@@ -18,8 +18,12 @@
P-Value
-
-
+
+ {{ getSignificantFigures(data.value, 3) }}
+
+
+ {{ getSignificantFigures(data.pValue, 3) }}
+
@@ -34,17 +38,23 @@
[style]="getIntervalPositions(data)"
>
-
+
+ {{ getSignificantFigures(data.intervalMin, 3) }}
+
-
+
+ {{ getSignificantFigures(data.intervalMax, 3) }}
+
-
+
+ {{ getSignificantFigures(data.value, 3) }}
+
diff --git a/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.ts b/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.ts
index c3eb7e98..daec3512 100644
--- a/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.ts
+++ b/src/app/features/genes/components/gene-comparison-tool/components/gene-comparison-tool-details-panel/gene-comparison-tool-details-panel.component.ts
@@ -96,7 +96,7 @@ export class GeneComparisonToolDetailsPanelComponent {
}
getSignificantFigures(n: any, b: any) {
- const emdash = '—'; // Shift+Option+Hyphen
+ const emdash = '\u2014'; // Shift+Option+Hyphen
if (n === null || n === undefined)
return emdash;
return this.helperService.getSignificantFigures(n, b);