Skip to content

Commit ae04d13

Browse files
Oncoprinter enable submitting of data in same format as MutationMapper
1 parent f968f82 commit ae04d13

File tree

5 files changed

+452
-291
lines changed

5 files changed

+452
-291
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@
356356
"es-abstract": "1.18.0-next.2",
357357
"expect": "^1.20.2",
358358
"expect-jsx": "5.0.0",
359+
"glob": "7.2.0",
359360
"http-server": "0.11.1",
360361
"identity-obj-proxy": "^3.0.0",
361362
"jasmine-core": "^3.9.0",

src/pages/staticPages/tools/oncoprinter/OncoprinterGeneticUtils.spec.ts

Lines changed: 104 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -3,111 +3,107 @@ import { parseGeneticInput } from './OncoprinterGeneticUtils';
33

44
describe('OncoprinterGeneticUtils', () => {
55
describe('parseGeneticInput', () => {
6-
it('skips header line', () => {
7-
assert.deepEqual(
8-
parseGeneticInput(
9-
'sample gene alteration type\nsample_id TP53 FUSION FUSION\n'
10-
),
11-
{
12-
parseSuccess: true,
13-
result: [
14-
{
15-
sampleId: 'sample_id',
16-
hugoGeneSymbol: 'TP53',
17-
alteration: 'structuralVariant',
18-
eventInfo: 'FUSION',
19-
trackName: undefined,
20-
},
21-
],
22-
error: undefined,
23-
}
6+
it('skips header line', async () => {
7+
const parsed = await parseGeneticInput(
8+
'sample gene alteration type\nsample_id TP53 FUSION FUSION\n'
249
);
10+
assert.deepEqual(parsed, {
11+
parseSuccess: true,
12+
result: [
13+
{
14+
sampleId: 'sample_id',
15+
hugoGeneSymbol: 'TP53',
16+
alteration: 'structuralVariant',
17+
eventInfo: 'FUSION',
18+
trackName: undefined,
19+
},
20+
],
21+
error: undefined,
22+
});
2523
});
26-
it('parses fusion command correctly', () => {
27-
assert.deepEqual(
28-
parseGeneticInput('sample_id TP53 FUSION FUSION'),
29-
{
30-
parseSuccess: true,
31-
result: [
32-
{
33-
sampleId: 'sample_id',
34-
hugoGeneSymbol: 'TP53',
35-
alteration: 'structuralVariant',
36-
eventInfo: 'FUSION',
37-
trackName: undefined,
38-
},
39-
],
40-
error: undefined,
41-
}
24+
it('parses fusion command correctly', async () => {
25+
const parsed = await parseGeneticInput(
26+
'sample_id TP53 FUSION FUSION'
4227
);
28+
assert.deepEqual(parsed, {
29+
parseSuccess: true,
30+
result: [
31+
{
32+
sampleId: 'sample_id',
33+
hugoGeneSymbol: 'TP53',
34+
alteration: 'structuralVariant',
35+
eventInfo: 'FUSION',
36+
trackName: undefined,
37+
},
38+
],
39+
error: undefined,
40+
});
4341
});
44-
it('throws an error if fusion is not specified correctly', () => {
42+
it('throws an error if fusion is not specified correctly', async () => {
4543
try {
46-
const parsed = parseGeneticInput(
44+
const parsed = await parseGeneticInput(
4745
'sample_id TP53 FUSION apsoidjfpaos'
4846
);
4947
assert(false);
5048
} catch (e) {}
5149
});
52-
it('parses germline mutation correctly', () => {
53-
assert.deepEqual(
54-
parseGeneticInput('sampleid BRCA1 Q1538A MISSENSE_GERMLINE'),
55-
{
56-
parseSuccess: true,
57-
result: [
58-
{
59-
sampleId: 'sampleid',
60-
hugoGeneSymbol: 'BRCA1',
61-
alteration: 'missense',
62-
proteinChange: 'Q1538A',
63-
isGermline: true,
64-
trackName: undefined,
65-
},
66-
],
67-
error: undefined,
68-
}
50+
it('parses germline mutation correctly', async () => {
51+
const parsed = await parseGeneticInput(
52+
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE'
6953
);
54+
assert.deepEqual(parsed, {
55+
parseSuccess: true,
56+
result: [
57+
{
58+
sampleId: 'sampleid',
59+
hugoGeneSymbol: 'BRCA1',
60+
alteration: 'missense',
61+
proteinChange: 'Q1538A',
62+
isGermline: true,
63+
trackName: undefined,
64+
},
65+
],
66+
error: undefined,
67+
});
7068
});
71-
it('parses driver mutation correctly', () => {
72-
assert.deepEqual(
73-
parseGeneticInput('sampleid BRCA1 Q1538A TRUNC_DRIVER'),
74-
{
75-
parseSuccess: true,
76-
result: [
77-
{
78-
sampleId: 'sampleid',
79-
hugoGeneSymbol: 'BRCA1',
80-
alteration: 'trunc',
81-
proteinChange: 'Q1538A',
82-
isCustomDriver: true,
83-
trackName: undefined,
84-
},
85-
],
86-
error: undefined,
87-
}
69+
it('parses driver mutation correctly', async () => {
70+
const parsed = await parseGeneticInput(
71+
'sampleid BRCA1 Q1538A TRUNC_DRIVER'
8872
);
73+
assert.deepEqual(parsed, {
74+
parseSuccess: true,
75+
result: [
76+
{
77+
sampleId: 'sampleid',
78+
hugoGeneSymbol: 'BRCA1',
79+
alteration: 'trunc',
80+
proteinChange: 'Q1538A',
81+
isCustomDriver: true,
82+
trackName: undefined,
83+
},
84+
],
85+
error: undefined,
86+
});
8987
});
90-
it('parses germline & driver mutation correctly', () => {
91-
assert.deepEqual(
92-
parseGeneticInput(
93-
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER'
94-
),
95-
{
96-
parseSuccess: true,
97-
result: [
98-
{
99-
sampleId: 'sampleid',
100-
hugoGeneSymbol: 'BRCA1',
101-
alteration: 'missense',
102-
proteinChange: 'Q1538A',
103-
isGermline: true,
104-
isCustomDriver: true,
105-
trackName: undefined,
106-
},
107-
],
108-
error: undefined,
109-
}
88+
it('parses germline & driver mutation correctly', async () => {
89+
const parsed = await parseGeneticInput(
90+
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER'
11091
);
92+
assert.deepEqual(parsed, {
93+
parseSuccess: true,
94+
result: [
95+
{
96+
sampleId: 'sampleid',
97+
hugoGeneSymbol: 'BRCA1',
98+
alteration: 'missense',
99+
proteinChange: 'Q1538A',
100+
isGermline: true,
101+
isCustomDriver: true,
102+
trackName: undefined,
103+
},
104+
],
105+
error: undefined,
106+
});
111107
});
112108
it('throws an error for an invalid mutation modifier', () => {
113109
try {
@@ -117,27 +113,25 @@ describe('OncoprinterGeneticUtils', () => {
117113
assert(false);
118114
} catch (e) {}
119115
});
120-
it('parses a line with a given track name correctly', () => {
121-
assert.deepEqual(
122-
parseGeneticInput(
123-
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER testTrackName'
124-
),
125-
{
126-
parseSuccess: true,
127-
result: [
128-
{
129-
sampleId: 'sampleid',
130-
hugoGeneSymbol: 'BRCA1',
131-
alteration: 'missense',
132-
proteinChange: 'Q1538A',
133-
isGermline: true,
134-
isCustomDriver: true,
135-
trackName: 'testTrackName',
136-
},
137-
],
138-
error: undefined,
139-
}
116+
it('parses a line with a given track name correctly', async () => {
117+
const parsed = await parseGeneticInput(
118+
'sampleid BRCA1 Q1538A MISSENSE_GERMLINE_DRIVER testTrackName'
140119
);
120+
assert.deepEqual(parsed, {
121+
parseSuccess: true,
122+
result: [
123+
{
124+
sampleId: 'sampleid',
125+
hugoGeneSymbol: 'BRCA1',
126+
alteration: 'missense',
127+
proteinChange: 'Q1538A',
128+
isGermline: true,
129+
isCustomDriver: true,
130+
trackName: 'testTrackName',
131+
},
132+
],
133+
error: undefined,
134+
});
141135
});
142136
});
143137
});

0 commit comments

Comments
 (0)