Skip to content

Commit

Permalink
Added more logic to filter, created FilterDialog.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
y330 committed Sep 30, 2024
1 parent 8e11d0f commit 9759b93
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 182 deletions.
84 changes: 84 additions & 0 deletions Eplant/views/InteractionsViewer/FilterDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { FC, useState } from 'react'

import { ListItemText, ListSubheader, Switch } from '@mui/material'
import Box from '@mui/material/Box'
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'

export const FilterDialog: FC = () => {
const [EPPICorrValue, setEPPICorrValue] = useState<number>()
const [PPPICorrValue, setPPPICorrValue] = useState<number>()
const [PPPIConfValue, setPPPIConfValue] = useState<number>()
const [PPDIConfValue, setPPDIConfValue] = useState<number>()
const selectors = {
EPPISelector: '[type = "PPI"][method = "E"]', // checkbox
corrSelector: '[correlation <= ', // eppi-correlation spinner + checkbox
PPPISelector: '[type = "PPI"][method = "P"]', // checkbox
interConfSelector: '[interolog_conf <=', // PPPI correlation
EPDISelector: '[type = "PDI"][method = "E"]',
PPDISelector: '[type = "PDI"][method = "P"]',
fimoConfSelector: '[fimo_conf >= ',
}

const applyFilters = () => {
// Create selectors
const eppiCorr =
selectors.EPPISelector + selectors.corrSelector + EPPICorrValue + ']'
const pppiCorr =
selectors.PPPISelector + selectors.corrSelector + PPPICorrValue + ']'
const pppiConf =
selectors.PPPISelector + selectors.interConfSelector + PPPIConfValue + ']'
const ppdiConf =
selectors.PPDISelector + selectors.fimoConfSelector + PPDIConfValue + ']'
}

return (
<Box>
<List
sx={(theme) => ({
maxWidth: 360,
bgcolor: theme.palette.background.default,
})}
subheader={<ListSubheader>Filter Interactions</ListSubheader>}
>
<ListItem>
<ListItemText
id='filter-option-1'
primary='Hide ALL experimentally determined Protein-Protein interactions'
/>
<Switch edge='end' onChange={() => {}} checked={false} />
</ListItem>
<ListItem>
<ListItemText
id='filter-option-2'
primary='Hide only with correlation less than: 0.5 '
/>
<Switch edge='end' onChange={() => {}} checked={false} />
</ListItem>
<ListItem>
<ListItemText
id='filter-option-3'
primary='Hide ALL predicted
Protein-Protein interactions Hide only with correlation less than:
0.5'
/>
<Switch edge='end' onChange={() => {}} checked={false} />
</ListItem>
<ListItem>
<ListItemText
id='filter-option-4'
primary='Hide only with confidence less than 2'
/>
<Switch edge='end' onChange={() => {}} checked={false} />
</ListItem>
<ListItem>
<ListItemText
id='filter-option-5'
primary='Hide only with confidence less than 2'
/>
<Switch edge='end' onChange={() => {}} checked={false} />
</ListItem>
</List>
</Box>
)
}
23 changes: 19 additions & 4 deletions Eplant/views/InteractionsViewer/Topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { Unstable_Popup as Popup } from '@mui/base/Unstable_Popup'
import { Filter, FilterAlt, QuestionMark } from '@mui/icons-material'
import Add from '@mui/icons-material/Add'
import Remove from '@mui/icons-material/Remove'
import { ListItemText, ListSubheader, Switch } from '@mui/material'
import AppBar from '@mui/material/AppBar'
import Box from '@mui/material/Box'
import Button from '@mui/material/Button'
import ButtonGroup from '@mui/material/ButtonGroup'
import Toolbar from '@mui/material/Toolbar'
import Typography from '@mui/material/Typography'
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
import { ListItemText, ListSubheader, Switch } from '@mui/material'
import Toolbar from '@mui/material/Toolbar'
import Typography from '@mui/material/Typography'

interface TopbarProps {
gene: string
Expand All @@ -23,9 +23,24 @@ const Topbar: FC<TopbarProps> = ({ gene }) => {
const legendRef = useRef(null)
const [showFilter, setShowFilter] = useState<boolean>(false)
const filterRef = useRef(null)

const selectors = {
EPPISelector: '[type = "PPI"][method = "E"]', // checkbox
corrSelector: '[correlation <= ', // eppi-correlation spinner + checkbox
PPPISelector: '[type = "PPI"][method = "P"]', // checkbox
interConfSelector: '[interolog_conf <=', // PPPI correlation
EPDISelector: '[type = "PDI"][method = "E"]',
PPDISelector: '[type = "PDI"][method = "P"]',
fimoConfSelector: '[fimo_conf >= '
}
const zoomValue = 1000

const applyFilters = () =>{
// Create selectors
const eppiCorr = selectors.EPPISelector + selectors.corrSelector + EPPICorrValue + ']';
const pppiCorr = selectors.PPPISelector + selectors.corrSelector + PPPICorrValue + ']';
const pppiConf = selectors.PPPISelector + selectors.interConfSelector + PPPIConfValue + ']';
const ppdiConf = selectors.PPDISelector + selectors.fimoConfSelector + PPDIConfValue + ']';
}
const handleLegendClick = () => {
setShowLegend(!showLegend)
}
Expand Down
176 changes: 176 additions & 0 deletions Eplant/views/InteractionsViewer/cytoStyles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
const styles: any = [
{
selector: 'node',
style: {
'text-background-shape': 'roundrectangle',
'text-background-color': 'white',
'text-background-opacity': 0.9,
'background-color': '#f4f4f4',
'font-size': '11px',
//'font-weight': 'bold',
'text-halign': 'center',
'border-width': '0px',
//'width': 'auto',
'text-background-padding': '2px',
},
},
{
selector: '.compound-top',
style: {
shape: 'roundrectangle',
'background-color': '#F3F3F3',
'text-background-color': 'white',
'text-wrap': 'wrap',
width: '300px',
color: '#000',
'font-size': '10px',
'font-weight': 'bold',
'text-outline-width': '0px',
'text-valign': 'top',
},
},
{
selector: '#COMPOUND_DNA',
style: {
'background-opacity': '0',
'text-background-opacity': '1',
label: 'Protein-DNA\nInteractions',
},
},
{
selector: '#COMPOUND_PROTEIN',
style: {
'background-opacity': '0',
'text-background-opacity': '1',
label: 'Protein-Protein\nInteractions',
},
},
{
selector: '.protein-compound',
style: {
'background-opacity': 0,
events: 'no',
},
},
{
selector: '.protein-back[borderWidth]',
style: {
height: 'data(height)',
width: 'data(width)',
'pie-size': '100%',
'pie-1-background-color': 'data(pie1Colour)',
'pie-1-background-size': 'data(pie1Size)',
'pie-1-background-opacity': 1,
'pie-2-background-color': 'data(pie2Colour)',
'pie-2-background-size': 'data(pie2Size)',
'pie-2-background-opacity': 1,
'pie-3-background-color': 'data(pie3Colour)',
'pie-3-background-size': 'data(pie3Size)',
'pie-3-background-opacity': 1,
'pie-4-background-color': 'data(pie4Colour)',
'pie-4-background-size': 'data(pie4Size)',
'pie-4-background-opacity': 1,
'border-width': 'data(borderWidth)',
'border-color': '#99CC00',
events: 'no',
},
},
{
selector: '.protein-node',
style: {
height: '36px',
width: '36px',
padding: '3px 3px 3px 3px',
'text-valign': 'center',
content: 'data(content)',
events: 'yes',
'z-index': 10,
},
},
{
selector: '[id $= "QUERY_BACK"]',
style: {
height: '60px',
width: '60px',
},
},
{
selector: '[id $= "QUERY_NODE"]',
style: {
height: '48px',
width: '48px',
'font-size': '11px',
'z-index': 10000000,
},
},
{
selector: '.dna-node',
style: {
shape: 'square',
width: '34px',
height: '34px',
'border-width': '4px',
padding: '3px 3px 3px 3px',
'border-color': '#030303',
'text-valign': 'center',
content: 'data(content)',
'z-index': 10,
},
},
{
selector: 'edge',
style: {
width: 'data(size)',
'line-style': 'data(lineStyle)',
'line-color': 'data(lineColor)',
'control-point-distance': '50px',
'control-point-weight': '0.5',
},
},
{
selector: '.protein-edge',
style: {
'curve-style': 'bezier',
'mid-target-arrow-shape': 'none',
},
},
{
selector: '.dna-edge',
style: {
'curve-style': 'unbundled-bezier',
'mid-target-arrow-shape': 'triangle',
'mid-target-arrow-color': 'data(lineColor)',
},
},
{
selector: '.chr-edge',
style: {
'curve-style': 'unbundled-bezier',
'mid-target-arrow-shape': 'triangle',
'mid-target-arrow-color': 'data(arrowColor)',
'control-point-distance': '50px',
'control-point-weight': '0.5',
},
},
{
selector: '.loaded',
style: {
'background-color': '#3C3C3C',
'text-background-color': '#3C3C3C',
color: '#FFFFFF',
},
},
{
selector: '#noInteractionLabel',
style: {
shape: 'circle',
content: 'No interactions found for this gene.',
width: '1px',
height: '1px',
color: '#000',
'text-background-opacity': '0',
'font-size': 15,
},
},
]
export default styles
Loading

0 comments on commit 9759b93

Please sign in to comment.