Skip to content

Commit 9221631

Browse files
authored
Merge pull request #153 from BioAnalyticResource/yonah-InteractionsView
Interactions view
2 parents ae0a792 + 6c88e6e commit 9221631

19 files changed

Lines changed: 3207 additions & 812 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ dist
106106

107107
# notes files
108108
*-notes.md
109-
.DS_Store
109+
.DS_Store

Eplant/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ExperimentEFP from './views/ExperimentEFP'
77
import FallbackView from './views/FallbackView'
88
import GeneInfoView from './views/GeneInfoView'
99
import GetStartedView from './views/GetStartedView'
10+
import InteractionsViewer from './views/InteractionsViewer'
1011
import NavigatorView from './views/NavigatorViewer'
1112
import PlantEFP from './views/PlantEFP'
1213
import PublicationViewer from './views/PublicationViewer'
@@ -36,6 +37,7 @@ const userViews = [
3637
ExperimentEFP,
3738
WorldEFP,
3839
ChromosomeViewer,
40+
InteractionsViewer,
3941
NavigatorView,
4042
]
4143

Eplant/views/ChromosomeViewer/Viewer/GeneInfoPopup.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const GeneInfoPopup: FC<GeneInfoPopupProps> = (props) => {
4343
const geneticElements = useGeneticElements()
4444
const setGeneticElements = useSetGeneticElements()
4545
const theme = useTheme()
46-
4746
useEffect(() => {
4847
if (props.gene != gene) {
4948
setOpen(props.open)

Eplant/views/InteractionsViewer/InteractionsView.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import React, { FC, useEffect, useState } from 'react'
2+
3+
import GeneticElement from '@eplant/GeneticElement'
4+
import arabidopsis from '@eplant/Species/arabidopsis'
5+
import {
6+
useActiveGeneId,
7+
useGeneticElements,
8+
useSetGeneticElements,
9+
} from '@eplant/state'
10+
import Box from '@mui/material/Box'
11+
import useTheme from '@mui/material/styles/useTheme'
12+
import Table from '@mui/material/Table'
13+
import TableBody from '@mui/material/TableBody'
14+
import TableCell from '@mui/material/TableCell'
15+
import TableRow from '@mui/material/TableRow'
16+
17+
import { GeneItem } from '../../ChromosomeViewer/types'
18+
interface GeneDialogProps {
19+
gene: GeneItem
20+
}
21+
/** Gene dialog to show gene infomation when hovering over gene node. currently not implemented due to restrictions of cytoscape
22+
* @param {GeneItem} gene GeneItem object to show in table format in the dialog
23+
* */
24+
const GeneDialog: FC<GeneDialogProps> = ({ gene }) => {
25+
// Global State
26+
const [activeGeneId, setActiveGeneId] = useActiveGeneId()
27+
const geneticElements = useGeneticElements()
28+
const setGeneticElements = useSetGeneticElements()
29+
const theme = useTheme()
30+
31+
const handleLoadGeneClick = (event: React.MouseEvent<HTMLElement>) => {
32+
if (gene != null) {
33+
const geneticElement = new GeneticElement(
34+
gene.id,
35+
gene.annotation,
36+
arabidopsis,
37+
gene.aliases
38+
)
39+
40+
setGeneticElements([...geneticElements[0], geneticElement])
41+
setActiveGeneId(gene.id)
42+
}
43+
}
44+
45+
return (
46+
<div
47+
style={{
48+
minWidth: '350px',
49+
maxWidth: '350px',
50+
minHeight: '150px',
51+
maxHeight: '400px',
52+
paddingInline: 2,
53+
paddingBlockStart: 1,
54+
paddingBlockEnd: 2,
55+
border: '2px solid white',
56+
}}
57+
>
58+
{/* GENE INFO TABLE */}
59+
<table>
60+
<tr>
61+
<td className='label'>Identifier</td>
62+
<td>{gene.id}</td>
63+
</tr>
64+
<tr>
65+
<td className='label'>Aliases</td>
66+
<td>{gene.aliases.length > 0 ? gene.aliases : 'N/A'}</td>
67+
</tr>
68+
<tr>
69+
<td className='label'>Annotation</td>
70+
<td>{gene.annotation != '' ? gene.annotation : 'N/A'}</td>
71+
</tr>
72+
</table>
73+
</div>
74+
)
75+
}
76+
77+
export default GeneDialog
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { ChangeEvent } from 'react'
2+
3+
import InputAdornment from '@mui/material/InputAdornment'
4+
import TextField from '@mui/material/TextField'
5+
6+
interface numberInputProps {
7+
label: string
8+
changeFunc: (event: ChangeEvent) => void
9+
prefix?: string
10+
}
11+
12+
/** Number selector for filter dialog
13+
* @param {string} label number selector label
14+
* @param {func} changeFunc function to call on change
15+
* @param {string} prefix prefix to prepend to number
16+
*/
17+
const NumberInput = (props: numberInputProps) => {
18+
return (
19+
<>
20+
<TextField
21+
label={props.label}
22+
size='small'
23+
variant='outlined'
24+
color='secondary'
25+
type='number'
26+
margin='dense'
27+
onChange={(event: ChangeEvent) => {
28+
props.changeFunc(event)
29+
}}
30+
inputProps={{
31+
defaultValue: 0,
32+
step: 0.1,
33+
min: -1,
34+
max: 1,
35+
}}
36+
InputProps={
37+
props.prefix
38+
? {
39+
startAdornment: (
40+
<InputAdornment position='start'>
41+
{props.prefix}
42+
</InputAdornment>
43+
),
44+
}
45+
: {}
46+
}
47+
/>
48+
</>
49+
)
50+
}
51+
export default NumberInput

0 commit comments

Comments
 (0)