Skip to content

Commit

Permalink
Merge pull request #3705 from adamabeshouse/8501-driver
Browse files Browse the repository at this point in the history
Add driver annotation to download tab
  • Loading branch information
adamabeshouse authored Apr 13, 2021
2 parents 12b6502 + 7ba8e01 commit 0b206b1
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 35 additions & 3 deletions src/pages/resultsView/download/CaseAlterationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ import { insertBetween } from 'shared/lib/ArrayUtils';
export interface ISubAlteration {
type: string;
value: number;
putativeDriver?: boolean;
}

export interface IOqlData {
geneSymbol: string;
sequenced: boolean;
mutation: { proteinChange: string; isGermline: boolean }[];
mutation: {
proteinChange: string;
isGermline: boolean;
putativeDriver: boolean;
}[];
fusion: string[];
cna: ISubAlteration[];
mrnaExp: ISubAlteration[];
Expand Down Expand Up @@ -78,7 +83,9 @@ type RenderGenerator<T> = {
function mutationMapper(forDownload?: boolean) {
const renderMutation = (d: IOqlData['mutation'][0]) => {
if (forDownload) {
return `${d.proteinChange}${d.isGermline ? ' [germline]' : ''}`;
return `${d.proteinChange}${d.isGermline ? ' [germline]' : ''}${
d.putativeDriver ? ' (driver)' : ''
}`;
} else {
return (
<span>
Expand All @@ -88,6 +95,11 @@ function mutationMapper(forDownload?: boolean) {
Germline
</span>
)}
{d.putativeDriver && (
<span className={proteinChangeStyles.driver}>
(Driver)
</span>
)}
</span>
);
}
Expand All @@ -97,6 +109,26 @@ function mutationMapper(forDownload?: boolean) {
alterationData.map(renderMutation);
}

function cnaMapper(forDownload?: boolean) {
const renderCna = (d: IOqlData['cna'][0]) => {
if (forDownload) {
return `${d.type}${d.putativeDriver ? ' (driver)' : ''}`;
} else {
return (
<span>
<span>{d.type}</span>
{d.putativeDriver && (
<span className={proteinChangeStyles.driver}>
(Driver)
</span>
)}
</span>
);
}
};
return (alterationData: IOqlData['cna']) => alterationData.map(renderCna);
}

export function generateOqlValue(
data: IOqlData,
alterationType: string,
Expand Down Expand Up @@ -144,7 +176,7 @@ export function generateOqlValue(
label: 'CNA',
getAlterationData: (oqlData: IOqlData) => oqlData.cna,
isNotProfiled: (oqlData: IOqlData) => oqlData.isCnaNotProfiled,
getValues: subAlterationMapper,
getValues: cnaMapper(forDownload),
};
break;
case 'EXP':
Expand Down
24 changes: 20 additions & 4 deletions src/pages/resultsView/download/DownloadUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,16 @@ describe('DownloadUtils', () => {
assert.deepEqual(
oqlData.mutation,
[
{ proteinChange: 'G598A', isGermline: true },
{ proteinChange: 'G239C', isGermline: false },
{
proteinChange: 'G598A',
isGermline: true,
putativeDriver: true,
},
{
proteinChange: 'G239C',
isGermline: false,
putativeDriver: false,
},
],
'mutation data is correct for the sample with mutation and fusion data'
);
Expand Down Expand Up @@ -867,8 +875,16 @@ describe('DownloadUtils', () => {
assert.deepEqual(
caseAlterationData[0].oqlData['EGFR'].mutation,
[
{ proteinChange: 'G598A', isGermline: true },
{ proteinChange: 'G239C', isGermline: false },
{
proteinChange: 'G598A',
isGermline: true,
putativeDriver: true,
},
{
proteinChange: 'G239C',
isGermline: false,
putativeDriver: false,
},
],
'mutation data is correct for the sample key UC0wMDAwMzc4LVQwMS1JTTM6bXNrX2ltcGFjdF8yMDE3'
);
Expand Down
2 changes: 2 additions & 0 deletions src/pages/resultsView/download/DownloadUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function generateOqlData(
cnaAlterations.push({
type: alterationSubType,
value: alteration.value,
putativeDriver: alteration.putativeDriver,
});
alterationTypes.push('CNA');
}
Expand Down Expand Up @@ -105,6 +106,7 @@ export function generateOqlData(
mutation.push({
proteinChange: alteration.proteinChange,
isGermline: !isNotGermlineMutation(alteration),
putativeDriver: alteration.putativeDriver,
});
alterationTypes.push('MUT');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
font-size: x-small;
margin-left: 5px;
}

.driver {
font-weight: normal;
font-style: italic;
margin-left: 5px;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare const styles: {
readonly "driver": string;
readonly "germline": string;
readonly "proteinChange": string;
};
Expand Down

0 comments on commit 0b206b1

Please sign in to comment.