-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add react mutation mapper of alphaMissense
- Loading branch information
1 parent
1ec1ded
commit 3c85e7f
Showing
5 changed files
with
271 additions
and
131 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
packages/react-mutation-mapper/src/component/column/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,76 @@ | ||
import { observer } from 'mobx-react'; | ||
import * as React from 'react'; | ||
import { Mutation } from 'cbioportal-ts-api-client'; | ||
import { VariantAnnotation } from 'genome-nexus-ts-api-client'; | ||
import { defaultSortMethod, RemoteData } from 'cbioportal-utils'; | ||
// import styles from './alphaMissense.module.scss' | ||
import { getAlphaMissenseColumnData } from './AlphaMissenseHelper'; | ||
import { DefaultTooltip } from 'cbioportal-frontend-commons'; | ||
type AlphaMissenseProps = { | ||
mutation: Mutation; | ||
indexedVariantAnnotations?: RemoteData< | ||
{ [genomicLocation: string]: VariantAnnotation } | undefined | ||
>; | ||
// selectedTranscriptId?: string; | ||
}; | ||
export function download(alphaMissense?: string | null): string { | ||
return alphaMissense || 'N/A'; | ||
} | ||
|
||
export function sortValue(alphaMissense?: string | null): number | null { | ||
const score = alphaMissense?.split('|')[1]; | ||
return score ? parseFloat(score) : 0.0; | ||
} | ||
|
||
// Main component for rendering AlphaMissense data | ||
@observer | ||
export default class AlphaMissense extends React.Component< | ||
AlphaMissenseProps, | ||
{} | ||
> { | ||
get alphaMissense() { | ||
return getAlphaMissenseColumnData( | ||
this.props.mutation, | ||
this.props.indexedVariantAnnotations | ||
); | ||
} | ||
public render() { | ||
const pathogenicity = this.alphaMissense?.split('|')[0]; | ||
const score = this.alphaMissense?.split('|')[1]; | ||
return ( | ||
<span> | ||
{/*{AlphaMissenseColumnFormatter.getAlphaMissenseDataViz(*/} | ||
{/* alphaMissenseCache*/} | ||
{/*)}*/} | ||
<DefaultTooltip | ||
overlay={() => <div style={{ maxWidth: 300 }}>{score}</div>} | ||
placement="topLeft" | ||
> | ||
<span | ||
style={{ | ||
width: '24px', | ||
textAlign: 'center', | ||
}} | ||
> | ||
{pathogenicity} | ||
</span> | ||
</DefaultTooltip> | ||
</span> | ||
); | ||
} | ||
} | ||
|
||
// // Helper function to get GenomeNexus cache data | ||
// function getGenomeNexusDataFromCache( | ||
// data: Mutation[], | ||
// cache: indexedVariantAnnotations | undefined | ||
// ): GenomeNexusCacheDataType | null { | ||
// if (data.length === 0 || !cache) return null; | ||
// return cache.annoation_summery.get(data[0]); | ||
// } | ||
// | ||
|
||
// | ||
// indexedVariantAnnotations.annotation_summary?: RemoteData< | ||
// { [genomicLocation: string]: VariantAnnotation } | undefined | ||
// >; |
43 changes: 43 additions & 0 deletions
43
packages/react-mutation-mapper/src/component/column/AlphaMissenseHelper.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,43 @@ | ||
import { AlphaMissense, VariantAnnotation } from 'genome-nexus-ts-api-client'; | ||
import { Mutation, RemoteData } from 'cbioportal-utils'; | ||
import { getAnnotation } from './VariantAnnotationHelper'; | ||
// | ||
// export function getHgvsgColumnData(mutation: Mutation): string | null { | ||
// return generateHgvsgByMutation(mutation) || null; | ||
// } | ||
|
||
export function getAlphaMissenseColumnData( | ||
mutation: Mutation, | ||
indexedVariantAnnotations?: RemoteData< | ||
{ [genomicLocation: string]: VariantAnnotation } | undefined | ||
> | ||
): string | null { | ||
const variantAnnotation = getAnnotation( | ||
mutation, | ||
indexedVariantAnnotations | ||
); | ||
|
||
if (!variantAnnotation) { | ||
console.log('asdd'); | ||
return null; | ||
} | ||
|
||
// return data from transcriptConsequenceSummaries if transcript dropdown is enabled | ||
// if (selectedTranscriptId) { | ||
// const transcriptConsequenceSummary = variantAnnotation.annotation_summary?.transcriptConsequenceSummaries?.find( | ||
// transcriptConsequenceSummary => | ||
// transcriptConsequenceSummary.transcriptId === | ||
// selectedTranscriptId | ||
// ); | ||
// data = transcriptConsequenceSummary | ||
// ? transcriptConsequenceSummary.hgvsc | ||
// : null; | ||
// } | ||
|
||
return 'path|0.996'; | ||
|
||
// console.log("sss"+JSON.stringify(variantAnnotation.annotation_summary?.transcriptConsequenceSummary)) | ||
// return ((variantAnnotation.annotation_summary?.transcriptConsequenceSummary | ||
// ?.alphaMissense.pathogenicity) + "|" + (variantAnnotation.annotation_summary?.transcriptConsequenceSummary | ||
// ?.alphaMissense.score ))||'N/A'; | ||
} |
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
Oops, something went wrong.