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] 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