From 8dd416417c5f5eb2c2d900804dfc6eab83c40142 Mon Sep 17 00:00:00 2001 From: sagely1 <114952739+sagely1@users.noreply.github.com> Date: Mon, 12 Feb 2024 04:03:54 -0800 Subject: [PATCH 1/3] AG-1346 GCT bug fix for zero p-values showing wrong circle size --- .../gene-comparison-tool/gene-comparison-tool.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 8c87d4bf..31ab0ab6 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 @@ -912,15 +912,20 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy { const tissue = gene.tissues.find((t) => t.name === tissueName); let size = 0; let color = '#F0F0F0'; + const CIRCLE_MAX_SIZE = 50; if (tissue?.adj_p_val) { size = this.getCircleSize(tissue.adj_p_val); } + if (size === 0) { + size = CIRCLE_MAX_SIZE; + } + if (tissue?.logfc) { color = this.getCircleColor(tissue.logfc); } - + return { display: size ? 'block' : 'none', width: size + 'px', From 16bcff2b608f9a0d30b619fba7611949750ed322 Mon Sep 17 00:00:00 2001 From: sagely1 <114952739+sagely1@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:00:01 -0800 Subject: [PATCH 2/3] AG-1346 refactor to provide more clarity. Note: circle scaling has been altered --- .../gene-comparison-tool.component.ts | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) 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 b07962b5..1c2b3f63 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 @@ -869,7 +869,10 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy { } } - getCircleColor(logfc: number) { + getCircleColor(logfc: number | undefined) { + if (logfc === undefined) + return '#F0F0F0'; + const rounded = this.helperService.getSignificantFigures(logfc, 3); if (rounded > 0) { if (rounded < 0.1) { @@ -898,36 +901,35 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy { } } - getCircleSize(pval: number) { + getCircleSize(pval: number | undefined) { + // define min and max size of possible circles in pixels + const MIN_SIZE = 6; + const MAX_SIZE = 50; + + // shouldn't be undefined but if it is, don't show a circle + if (pval === undefined) + return 0; + + // if significance cutoff radio button selected and + // p-Value > significance threshhold, don't show if (this.significanceThresholdActive && pval > this.significanceThreshold) { return 0; } const pValue = 1 - (this.nRoot(pval, 3) || 0); - const size = Math.round(100 * pValue * 0.44); - return size < 6 ? 6 : size; + const size = Math.round(pValue * MAX_SIZE); + + // ensure the smallest circles have a min size to be easily hoverable/clickable + return size < MIN_SIZE ? MIN_SIZE : size; } getCircleStyle(tissueName: string, gene: GCTGene) { const tissue = gene.tissues.find((t) => t.name === tissueName); - let size = 0; - let color = '#F0F0F0'; - const CIRCLE_MAX_SIZE = 50; - - if (tissue?.adj_p_val) { - size = this.getCircleSize(tissue.adj_p_val); - } - - if (size === 0) { - size = CIRCLE_MAX_SIZE; - } - - if (tissue?.logfc) { - color = this.getCircleColor(tissue.logfc); - } - + const size = this.getCircleSize(tissue?.adj_p_val); + const color = this.getCircleColor(tissue?.logfc); + return { - display: size ? 'block' : 'none', + display: size > 0 ? 'block' : 'none', width: size + 'px', height: size + 'px', backgroundColor: color, @@ -1024,10 +1026,10 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy { ...baseRow, ...[ tissueName, - tissue ? tissue.logfc : '', - tissue ? tissue.ci_r : '', - tissue ? tissue.ci_l : '', - tissue ? tissue.adj_p_val : '', + tissue?.logfc || '', + tissue?.ci_r || '', + tissue?.ci_l || '', + tissue?.adj_p_val || '', g.biodomains?.join(',') || '', ], ]); From 8df5b99de260d0a183bba0a57e79ed6a50005fc6 Mon Sep 17 00:00:00 2001 From: sagely1 <114952739+sagely1@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:15:20 -0800 Subject: [PATCH 3/3] AG-1346 - merging changes from AG-1347 --- .../gene-comparison-tool.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 1c2b3f63..47e3fd2f 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 @@ -1026,10 +1026,10 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy { ...baseRow, ...[ tissueName, - tissue?.logfc || '', - tissue?.ci_r || '', - tissue?.ci_l || '', - tissue?.adj_p_val || '', + tissue ? tissue.logfc : '', + tissue ? tissue.ci_r : '', + tissue ? tissue.ci_l : '', + tissue ? tissue.adj_p_val : '', g.biodomains?.join(',') || '', ], ]);