Skip to content

Commit d5be008

Browse files
authored
Merge pull request #395 from zhx828/bug-fix
Add mutation effect references
2 parents 03e5f09 + 1e140bf commit d5be008

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

src/main/webapp/app/components/CitationTooltip.tsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { CSSProperties } from 'react';
22
import { observer } from 'mobx-react';
33
import { remoteData } from 'cbioportal-frontend-commons';
44
import request from 'superagent';
@@ -7,10 +7,11 @@ import { ArticleAbstract } from 'app/shared/api/generated/OncoKbAPI';
77
import _ from 'lodash';
88
import PmidItem from 'app/components/PmidItem';
99
import ArticleAbstractItem from 'app/components/ArticleAbstractItem';
10+
import { TOOLTIP_MAX_HEIGHT } from 'app/config/constants';
1011

1112
@observer
1213
export class CitationTooltip extends React.Component<
13-
{ pmids: string[]; abstracts: ArticleAbstract[] },
14+
{ pmids: string[]; abstracts: ArticleAbstract[]; style?: CSSProperties },
1415
{}
1516
> {
1617
readonly citationContent = remoteData<any>({
@@ -48,12 +49,17 @@ export class CitationTooltip extends React.Component<
4849
}
4950

5051
render() {
52+
const style = {
53+
maxHeight: TOOLTIP_MAX_HEIGHT,
54+
overflowY: 'scroll',
55+
...this.props.style
56+
} as CSSProperties;
5157
return (
52-
<>
58+
<div>
5359
{this.citationContent.isPending ? (
5460
<LoadingIndicator isLoading={true} size={'small'} />
5561
) : (
56-
<div>
62+
<div style={style}>
5763
{this.getPmidItems()}
5864
{this.props.abstracts.map(abstract => (
5965
<ArticleAbstractItem
@@ -64,7 +70,7 @@ export class CitationTooltip extends React.Component<
6470
))}
6571
</div>
6672
)}
67-
</>
73+
</div>
6874
);
6975
}
7076
}

src/main/webapp/app/config/constants.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ export const IMG_MAX_WIDTH = 700;
162162
export const COMPONENT_PADDING = ['pl-2', 'pr-2', 'mb-2'];
163163
export const H5_FONT_SIZE = '1.25rem';
164164

165+
// Defaults for tooltip size
166+
export const TOOLTIP_MAX_HEIGHT = 300;
167+
165168
// Defaults for the models
166169
export const DEFAULT_ONCOKB_INFO: OncoKBInfo = {
167170
dataVersion: {

src/main/webapp/app/pages/alterationPage/AlterationPage.tsx

+19-5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import classnames from 'classnames';
3434
import SmallPageContainer from 'app/components/SmallPageContainer';
3535
import InfoIcon from 'app/shared/icons/InfoIcon';
3636
import DocumentTitle from 'react-document-title';
37+
import { MutationEffectResp } from 'app/shared/api/generated/OncoKbPrivateAPI';
3738

3839
enum SummaryKey {
3940
GENE_SUMMARY = 'geneSummary',
@@ -53,7 +54,7 @@ const SUMMARY_TITLE = {
5354

5455
const AlterationInfo: React.FunctionComponent<{
5556
oncogenicity: string;
56-
mutationEffect: string;
57+
mutationEffect: MutationEffectResp;
5758
isVus: boolean;
5859
highestSensitiveLevel: string | undefined;
5960
highestResistanceLevel: string | undefined;
@@ -72,7 +73,21 @@ const AlterationInfo: React.FunctionComponent<{
7273
);
7374
}
7475
if (props.mutationEffect) {
75-
content.push(<span key="mutationEffect">{props.mutationEffect}</span>);
76+
content.push(
77+
<span>
78+
<span key="mutationEffect">{props.mutationEffect.knownEffect}</span>
79+
<DefaultTooltip
80+
overlay={() => (
81+
<CitationTooltip
82+
pmids={props.mutationEffect.citations.pmids}
83+
abstracts={props.mutationEffect.citations.abstracts}
84+
/>
85+
)}
86+
>
87+
<i className="fa fa-book mx-1" style={{ fontSize: '0.8em' }}></i>
88+
</DefaultTooltip>
89+
</span>
90+
);
7691
}
7792
if (props.highestSensitiveLevel || props.highestResistanceLevel) {
7893
content.push(
@@ -226,6 +241,7 @@ export default class GenePage extends React.Component<
226241
props.original.citations.pmids.length;
227242
return (
228243
<DefaultTooltip
244+
placement={'left'}
229245
overlay={() => (
230246
<CitationTooltip
231247
pmids={props.original.citations.pmids}
@@ -280,9 +296,7 @@ export default class GenePage extends React.Component<
280296
</h2>
281297
<AlterationInfo
282298
oncogenicity={this.store.annotationResult.result.oncogenic}
283-
mutationEffect={
284-
this.store.annotationResult.result.mutationEffect.knownEffect
285-
}
299+
mutationEffect={this.store.annotationResult.result.mutationEffect}
286300
isVus={this.store.annotationResult.result.vus}
287301
highestSensitiveLevel={
288302
this.store.annotationResult.result.highestSensitiveLevel

src/main/webapp/app/pages/genePage/GenePage.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ export default class GenePage extends React.Component<
329329
props.original.mutationEffectPmids.length;
330330
return (
331331
<DefaultTooltip
332+
placement={'left'}
332333
overlay={() => (
333334
<CitationTooltip
334335
pmids={props.original.mutationEffectPmids}

0 commit comments

Comments
 (0)