Skip to content

Commit

Permalink
Add frame color to transcript widget structure
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Nov 11, 2024
1 parent 4bb6b8b commit 1352885
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
LocationEndChange,
LocationStartChange,
} from '@apollo-annotation/shared'
import { AbstractSessionModel, revcom } from '@jbrowse/core/util'
import { AbstractSessionModel, getFrame, revcom } from '@jbrowse/core/util'
import {
Paper,
Typography,
Expand All @@ -12,6 +12,7 @@ import {
TableCell,
TableContainer,
TableRow,
useTheme,
} from '@mui/material'
import { observer } from 'mobx-react'
import React from 'react'
Expand All @@ -35,6 +36,7 @@ export const TranscriptBasicInformation = observer(
const currentAssembly = session.apolloDataStore.assemblies.get(assembly)
const refData = currentAssembly?.getByRefName(refName)
const { changeManager } = session.apolloDataStore
const theme = useTheme()

function handleLocationChange(
oldLocation: number,
Expand Down Expand Up @@ -95,7 +97,11 @@ export const TranscriptBasicInformation = observer(
}
let fivePrimeSpliceSite
let threePrimeSpliceSite
let frameColor
if (type === 'CDS') {
const { phase } = loc
const frame = getFrame(min, max, strand ?? 1, phase)
frameColor = theme.palette.framesCDS.at(frame)?.main
const previousLoc = firstLocation.at(idx - 1)
const nextLoc = firstLocation.at(idx + 1)
if (strand === 1) {
Expand All @@ -114,7 +120,14 @@ export const TranscriptBasicInformation = observer(
}
}
}
return { min, max, label, fivePrimeSpliceSite, threePrimeSpliceSite }
return {
min,
max,
label,
fivePrimeSpliceSite,
threePrimeSpliceSite,
frameColor,
}
})
.filter((loc) => loc.label !== 'intron')

Expand All @@ -129,7 +142,11 @@ export const TranscriptBasicInformation = observer(
<TableBody>
{locationData.map((loc) => (
<TableRow key={`${loc.label}:${loc.min}-${loc.max}`}>
<TableCell component="th" scope="row">
<TableCell
component="th"
scope="row"
style={{ background: loc.frameColor }}
>
{loc.label}
</TableCell>
<TableCell>{loc.fivePrimeSpliceSite ?? ''}</TableCell>
Expand Down

0 comments on commit 1352885

Please sign in to comment.