Skip to content

Commit

Permalink
Fix gene without subfeatures not being displayed in sequence feature …
Browse files Browse the repository at this point in the history
…details (#3593)
  • Loading branch information
cmdcolin committed May 18, 2023
1 parent dba0801 commit f0d5995
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 17 deletions.
11 changes: 3 additions & 8 deletions packages/core/BaseFeatureWidget/SequenceFeatureDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ const useStyles = makeStyles()(theme => ({
formControl: {
margin: 0,
},
container: {
margin: theme.spacing(1),
},

container2: {
marginTop: theme.spacing(1),
},
Expand All @@ -56,13 +54,10 @@ const BPLIMIT = 500_000
// to not be 100% accurate
export default function SequenceFeatureDetails({ model, feature }: BaseProps) {
const { classes } = useStyles()
const parentFeature = feature as unknown as ParentFeat
const hasCDS = !!parentFeature.subfeatures?.find(sub => sub.type === 'CDS')
const isGene = feature.type === 'gene'
const [shown, setShown] = useState(false)
const [helpShown, setHelpShown] = useState(false)

return (isGene && !hasCDS) || !model ? null : (
return !model ? null : (
<div className={classes.container2}>
<Button variant="contained" onClick={() => setShown(!shown)}>
{shown ? 'Hide feature sequence' : 'Show feature sequence'}
Expand Down Expand Up @@ -181,7 +176,7 @@ function FeatureSequence({ model, feature }: BaseProps) {
const attemptGeneType =
feature.type === 'CDS'
? sequenceTypes.includes('CDS') && !feature.parentId
: sequenceTypes.includes(feature.type)
: sequenceTypes.includes(feature.type) && feature.subfeatures?.length
const val = attemptGeneType ? (hasCDS ? 'cds' : 'cdna') : 'genomic'

// this useEffect is needed to reset the mode/setMode useState because the
Expand Down
1 change: 1 addition & 0 deletions plugins/arc/src/LinearArcDisplay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default (pluginManager: PluginManager) => {
const configSchema = configSchemaFactory(pluginManager)
return new DisplayType({
name: 'LinearArcDisplay',
displayName: 'Arc display',
configSchema,
stateModel: stateModelFactory(configSchema),
trackType: 'FeatureTrack',
Expand Down
1 change: 1 addition & 0 deletions plugins/linear-genome-view/src/LinearBareDisplay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default (pluginManager: PluginManager) => {
return new DisplayType({
name: 'LinearBareDisplay',
configSchema,
displayName: 'Bare feature display',
stateModel: stateModelFactory(configSchema),
trackType: 'BasicTrack',
viewType: 'LinearGenomeView',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ import {
} from '@mui/material'
import { makeStyles } from 'tss-react/mui'

const useStyles = makeStyles()(theme => ({
const useStyles = makeStyles()({
root: {
width: 500,
},

field: {
margin: theme.spacing(2),
},
}))
})

function SetMaxHeightDlg({
model,
handleClose,
}: {
model: {
maxHeight?: number
setMaxHeight: Function
setMaxHeight: (arg?: number) => void
}
handleClose: () => void
}) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/linear-genome-view/src/LinearBasicDisplay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default (pluginManager: PluginManager) => {
const config = configSchema(pluginManager)
return new DisplayType({
name: 'LinearBasicDisplay',
displayName: 'Basic deature display',
displayName: 'Basic feature display',
configSchema: config,
stateModel: modelFactory(config),
trackType: 'FeatureTrack',
Expand Down
2 changes: 1 addition & 1 deletion plugins/linear-genome-view/src/LinearBasicDisplay/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
/**
* #action
*/
setMaxHeight(val: number) {
setMaxHeight(val?: number) {
self.trackMaxHeight = val
},
}))
Expand Down

0 comments on commit f0d5995

Please sign in to comment.