Skip to content

Commit

Permalink
Merge pull request #45 from BioAnalyticResource/yukthiw/fix-efp-toolt…
Browse files Browse the repository at this point in the history
…ip-in-relative-mode

fix: EFP tooltip shows correct information in absolute mode
  • Loading branch information
Yukthiw authored Dec 4, 2023
2 parents ab39d9d + 7343852 commit 538f8d8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 29 deletions.
78 changes: 50 additions & 28 deletions Eplant/views/eFP/Tooltips/EFPTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import {
useTheme,
} from '@mui/material'
import React from 'react'
import { EFPGroup, EFPTissue, EFPData } from '../types'
import { EFPGroup, EFPTissue, EFPData, EFPState } from '../types'

function SVGTooltip(props: {
el: SVGElement | null
group: EFPGroup
tissue: EFPTissue
data: EFPData
state: EFPState
}) {
const [open, setOpen] = React.useState(false)
const theme = useTheme()
Expand Down Expand Up @@ -76,33 +77,54 @@ function SVGTooltip(props: {
{props.tissue.mean.toFixed(2)}±{props.tissue.std.toFixed(2)}
</TableCell>
</TableRow>
<TableRow>
<TableCell
sx={{
color: theme.palette.secondary.main,
textAlign: 'right',
}}
>
Samples
</TableCell>
<TableCell>{props.tissue.samples}</TableCell>
</TableRow>
<TableRow>
<TableCell
sx={{
color: theme.palette.secondary.main,
textAlign: 'right',
borderBottom: 'none',
}}
>
Log2 fold change vs control
</TableCell>
<TableCell sx={{ borderBottom: 'none' }}>
{Math.log2(
props.tissue.mean / (props.data.control ?? 1),
).toFixed(2)}
</TableCell>
</TableRow>
{props.state.colorMode == 'relative' ? (
<>
<TableRow>
<TableCell
sx={{
color: theme.palette.secondary.main,
textAlign: 'right',
}}
>
Samples
</TableCell>
<TableCell>{props.tissue.samples}</TableCell>
</TableRow>
<TableRow>
<TableCell
sx={{
color: theme.palette.secondary.main,
textAlign: 'right',
borderBottom: 'none',
}}
>
Log2 fold change vs control
</TableCell>
<TableCell sx={{ borderBottom: 'none' }}>
{Math.log2(
props.tissue.mean / (props.data.control ?? 1)
).toFixed(2)}
</TableCell>
</TableRow>
</>
) : (
<>
<TableRow>
<TableCell
sx={{
color: theme.palette.secondary.main,
textAlign: 'right',
borderBottom: 'none',
}}
>
Samples
</TableCell>
<TableCell sx={{ borderBottom: 'none' }}>
{props.tissue.samples}
</TableCell>
</TableRow>
</>
)}
</TableBody>
</Table>
</Box>
Expand Down
3 changes: 2 additions & 1 deletion Eplant/views/eFP/Tooltips/cellEFPTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import {
TableCell,
useTheme,
} from '@mui/material'
import { EFPGroup, EFPTissue, EFPData } from '../types'
import { EFPGroup, EFPTissue, EFPData, EFPState } from '../types'
import React from 'react'

function CellSVGTooltip(props: {
el: SVGElement | null
group: EFPGroup
tissue: EFPTissue
data: EFPData
state: EFPState
}) {
const [open, setOpen] = React.useState(false)
const theme = useTheme()
Expand Down
2 changes: 2 additions & 0 deletions Eplant/views/eFP/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class EFP implements View<EFPData, EFPState, EFPAction> {
group: EFPGroup
tissue: EFPTissue
data: EFPData
state: EFPState
}) => React.JSX.Element
constructor(
public name: string,
Expand Down Expand Up @@ -283,6 +284,7 @@ export default class EFP implements View<EFPData, EFPState, EFPAction> {
el={el}
group={group}
tissue={tissue}
state={props.state}
/>
))}
</div>
Expand Down

0 comments on commit 538f8d8

Please sign in to comment.