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-1412 fixed bug in border condition handling logic #1297

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<div>P-Value</div>
</div>
<div>
<div>{{ getSignificantFigures(data.value, 3) }}</div>
<div>
{{ getSignificantFigures(data.value, 3) }}
</div>
<div>
{{ getSignificantFigures(data.pValue, 3) }}
</div>
Expand All @@ -36,17 +38,23 @@
[style]="getIntervalPositions(data)"
>
<div>
<div class="gct-details-panel-chart-interval-left">{{ getSignificantFigures(data.intervalMin, 3) }}</div>
<div class="gct-details-panel-chart-interval-left">
{{ getSignificantFigures(data.intervalMin, 3) }}
</div>
</div>
<div>
<div class="gct-details-panel-chart-interval-right">{{ getSignificantFigures(data.intervalMax, 3) }}</div>
<div class="gct-details-panel-chart-interval-right">
{{ getSignificantFigures(data.intervalMax, 3) }}
</div>
</div>
</div>
<div
class="gct-details-panel-chart-value"
[style]="getValuePosition(data)"
>
<div>{{ getSignificantFigures(data.value, 3) }}</div>
<div>
{{ getSignificantFigures(data.value, 3) }}
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class GeneComparisonToolDetailsPanelComponent {
}

getSignificantFigures(n: any, b: any) {
const emdash = '&#8212;'; // Shift+Option+Hyphen
const emdash = '\u2014'; // Shift+Option+Hyphen
if (n === null || n === undefined)
return emdash;
return this.helperService.getSignificantFigures(n, b);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -518,5 +519,32 @@ describe('Component: GeneComparisonToolComponent', () => {
const expected2 = 'ENSG00000147065';
expect(label2).toBe(expected2);
});

it('should set circle size to zero for undefined pValues', () => {
let tissue: GCTGeneTissue | undefined;
// 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 pValue = null;
const result = component.getCircleSize(pValue);
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);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -901,13 +901,14 @@ 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;

// 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)
sagely1 marked this conversation as resolved.
Show resolved Hide resolved
return 0;

// if significance cutoff radio button selected and
Expand Down
Loading