Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AG-1346 GCT bug fix for zero p-values showing wrong circle size #1282

Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
sagely1 marked this conversation as resolved.
Show resolved Hide resolved
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;
sagely1 marked this conversation as resolved.
Show resolved Hide resolved
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',
sagely1 marked this conversation as resolved.
Show resolved Hide resolved
width: size + 'px',
height: size + 'px',
backgroundColor: color,
Expand Down Expand Up @@ -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 || '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change intentional? It looks like this may reintroduce the bug fixed in AG-1347

Copy link
Contributor Author

@sagely1 sagely1 Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Not sure why this change didn't merge from AG-1347 but I committed it.

g.biodomains?.join(',') || '',
],
]);
Expand Down
Loading