Skip to content
Open
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@
"es-abstract": "1.18.0-next.2",
"expect": "^1.20.2",
"expect-jsx": "5.0.0",
"glob": "7.2.0",
"http-server": "0.11.1",
"identity-obj-proxy": "^3.0.0",
"jasmine-core": "^3.9.0",
Expand Down
214 changes: 104 additions & 110 deletions src/pages/staticPages/tools/oncoprinter/OncoprinterGeneticUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,111 +3,107 @@ import { parseGeneticInput } from './OncoprinterGeneticUtils';

describe('OncoprinterGeneticUtils', () => {
describe('parseGeneticInput', () => {
it('skips header line', () => {
assert.deepEqual(
parseGeneticInput(
'sample gene alteration type\nsample_id TP53 FUSION FUSION\n'
),
{
parseSuccess: true,
result: [
{
sampleId: 'sample_id',
hugoGeneSymbol: 'TP53',
alteration: 'structuralVariant',
eventInfo: 'FUSION',
trackName: undefined,
},
],
error: undefined,
}
it('skips header line', async () => {
const parsed = await parseGeneticInput(
'sample gene alteration type\nsample_id TP53 FUSION FUSION\n'
);
assert.deepEqual(parsed, {
parseSuccess: true,
result: [
{
sampleId: 'sample_id',
hugoGeneSymbol: 'TP53',
alteration: 'structuralVariant',
eventInfo: 'FUSION',
trackName: undefined,
},
],
error: undefined,
});
});
it('parses fusion command correctly', () => {
assert.deepEqual(
parseGeneticInput('sample_id TP53 FUSION FUSION'),
{
parseSuccess: true,
result: [
{
sampleId: 'sample_id',
hugoGeneSymbol: 'TP53',
alteration: 'structuralVariant',
eventInfo: 'FUSION',
trackName: undefined,
},
],
error: undefined,
}
it('parses fusion command correctly', async () => {
const parsed = await parseGeneticInput(
'sample_id TP53 FUSION FUSION'
);
assert.deepEqual(parsed, {
parseSuccess: true,
result: [
{
sampleId: 'sample_id',
hugoGeneSymbol: 'TP53',
alteration: 'structuralVariant',
eventInfo: 'FUSION',
trackName: undefined,
},
],
error: undefined,
});
});
it('throws an error if fusion is not specified correctly', () => {
it('throws an error if fusion is not specified correctly', async () => {
try {
const parsed = parseGeneticInput(
const parsed = await parseGeneticInput(
'sample_id TP53 FUSION apsoidjfpaos'
);
assert(false);
} catch (e) {}
});
it('parses germline mutation correctly', () => {
assert.deepEqual(
parseGeneticInput('sampleid BRCA1 Q1538A MISSENSE_GERMLINE'),
{
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'missense',
proteinChange: 'Q1538A',
isGermline: true,
trackName: undefined,
},
],
error: undefined,
}
it('parses germline mutation correctly', async () => {
const parsed = await parseGeneticInput(
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE'
);
assert.deepEqual(parsed, {
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'missense',
proteinChange: 'Q1538A',
isGermline: true,
trackName: undefined,
},
],
error: undefined,
});
});
it('parses driver mutation correctly', () => {
assert.deepEqual(
parseGeneticInput('sampleid BRCA1 Q1538A TRUNC_DRIVER'),
{
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'trunc',
proteinChange: 'Q1538A',
isCustomDriver: true,
trackName: undefined,
},
],
error: undefined,
}
it('parses driver mutation correctly', async () => {
const parsed = await parseGeneticInput(
'sampleid BRCA1 Q1538A TRUNC_DRIVER'
);
assert.deepEqual(parsed, {
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'trunc',
proteinChange: 'Q1538A',
isCustomDriver: true,
trackName: undefined,
},
],
error: undefined,
});
});
it('parses germline & driver mutation correctly', () => {
assert.deepEqual(
parseGeneticInput(
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER'
),
{
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'missense',
proteinChange: 'Q1538A',
isGermline: true,
isCustomDriver: true,
trackName: undefined,
},
],
error: undefined,
}
it('parses germline & driver mutation correctly', async () => {
const parsed = await parseGeneticInput(
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER'
);
assert.deepEqual(parsed, {
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'missense',
proteinChange: 'Q1538A',
isGermline: true,
isCustomDriver: true,
trackName: undefined,
},
],
error: undefined,
});
});
it('throws an error for an invalid mutation modifier', () => {
try {
Expand All @@ -117,27 +113,25 @@ describe('OncoprinterGeneticUtils', () => {
assert(false);
} catch (e) {}
});
it('parses a line with a given track name correctly', () => {
assert.deepEqual(
parseGeneticInput(
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER testTrackName'
),
{
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'missense',
proteinChange: 'Q1538A',
isGermline: true,
isCustomDriver: true,
trackName: 'testTrackName',
},
],
error: undefined,
}
it('parses a line with a given track name correctly', async () => {
const parsed = await parseGeneticInput(
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER testTrackName'
);
assert.deepEqual(parsed, {
parseSuccess: true,
result: [
{
sampleId: 'sampleid',
hugoGeneSymbol: 'BRCA1',
alteration: 'missense',
proteinChange: 'Q1538A',
isGermline: true,
isCustomDriver: true,
trackName: 'testTrackName',
},
],
error: undefined,
});
});
});
});
Loading