-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add alphaMissense in functional impact column (#5042)
* Add alphaMissense in functional impact column * Refactor functional impact column * Update alpha missense desciption in tooltip
- Loading branch information
Showing
9 changed files
with
483 additions
and
532 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
src/shared/components/annotation/genomeNexus/AlphaMissense.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React from 'react'; | ||
import { DefaultTooltip } from 'cbioportal-frontend-commons'; | ||
import annotationStyles from './../styles/annotation.module.scss'; | ||
import classNames from 'classnames'; | ||
import tooltipStyles from './styles/alphaMissenseTooltip.module.scss'; | ||
|
||
export interface IAlphaMissenseProps { | ||
alphaMissensePrediction: string | undefined; // benign, pathogenic, ambiguous | ||
alphaMissenseScore: number | undefined; | ||
} | ||
|
||
export function hideArrow(tooltipEl: any) { | ||
const arrowEl = tooltipEl.querySelector('.rc-tooltip-arrow'); | ||
arrowEl.style.display = 'none'; | ||
} | ||
|
||
export const AlphaMissenseUrl: string = 'https://alphamissense.hegelab.org/'; | ||
|
||
export const AlphaMissense: React.FC<IAlphaMissenseProps> = ({ | ||
alphaMissensePrediction, | ||
alphaMissenseScore, | ||
}) => { | ||
const tooltipContent = () => { | ||
const impact = alphaMissensePrediction ? ( | ||
<div> | ||
<table className={tooltipStyles['alphaMissense-tooltip-table']}> | ||
<tr> | ||
<td>Source</td> | ||
<td> | ||
<a href={AlphaMissenseUrl}>AlphaMissense</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Impact</td> | ||
<td> | ||
<span | ||
className={ | ||
(tooltipStyles as any)[ | ||
`alphaMissense-${alphaMissensePrediction}` | ||
] | ||
} | ||
> | ||
{alphaMissensePrediction} | ||
</span> | ||
</td> | ||
</tr> | ||
{(alphaMissenseScore || alphaMissenseScore === 0) && ( | ||
<tr> | ||
<td>Score</td> | ||
<td> | ||
<b>{alphaMissenseScore.toFixed(2)}</b> | ||
</td> | ||
</tr> | ||
)} | ||
</table> | ||
</div> | ||
) : null; | ||
|
||
return <span>{impact}</span>; | ||
}; | ||
|
||
let content: JSX.Element = ( | ||
<span className={`${annotationStyles['annotation-item-text']}`} /> | ||
); | ||
|
||
if (alphaMissensePrediction && alphaMissensePrediction.length > 0) { | ||
content = ( | ||
<span | ||
className={classNames( | ||
annotationStyles['annotation-item-text'], | ||
(tooltipStyles as any)[ | ||
`alphaMissense-${alphaMissensePrediction}` | ||
] | ||
)} | ||
> | ||
<i className="fa fa-circle" aria-hidden="true"></i> | ||
</span> | ||
); | ||
const arrowContent = <div className="rc-tooltip-arrow-inner" />; | ||
content = ( | ||
<DefaultTooltip | ||
overlay={tooltipContent} | ||
placement="right" | ||
trigger={['hover', 'focus']} | ||
arrowContent={arrowContent} | ||
onPopupAlign={hideArrow} | ||
destroyTooltipOnHide={false} | ||
> | ||
{content} | ||
</DefaultTooltip> | ||
); | ||
} | ||
|
||
return content; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/shared/components/annotation/genomeNexus/styles/alphaMissenseTooltip.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@import 'functionalImpact'; | ||
|
||
.alphaMissense-pathogenic { | ||
color: $high; | ||
font-weight: bold; | ||
} | ||
.alphaMissense-ambiguous { | ||
color: $low; | ||
font-weight: bold; | ||
} | ||
.alphaMissense-benign { | ||
color: $neutral; | ||
font-weight: bold; | ||
} | ||
.alphaMissense-unknown { | ||
display: none; | ||
} | ||
.alphaMissense-tooltip-table { | ||
td:first-child { | ||
padding-right: 5px; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/shared/components/annotation/genomeNexus/styles/alphaMissenseTooltip.module.scss.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare const styles: { | ||
readonly "alphaMissense-ambiguous": string; | ||
readonly "alphaMissense-benign": string; | ||
readonly "alphaMissense-pathogenic": string; | ||
readonly "alphaMissense-tooltip-table": string; | ||
readonly "alphaMissense-unknown": string; | ||
}; | ||
export = styles; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.