Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
getStreamIcon,
isCDSFeature,
isExonFeature,
isGeneFeature,
isMousePositionWithFeature,
isTranscriptFeature,
navToFeatureCenter,
Expand Down Expand Up @@ -949,6 +950,28 @@ function getContextMenuItems(
},
)
}

if (
isGeneFeature(feature, session) &&
isSessionModelWithWidgets(session)
) {
contextMenuItemsForFeature.push({
label: 'Open gene details',
onClick: () => {
const apolloGeneWidget = session.addWidget(
'ApolloFeatureDetailsWidget',
'apolloFeatureDetailsWidget',
{
feature,
assembly: currentAssemblyId,
refName: region.refName,
},
)
session.showWidget(apolloGeneWidget)
},
})
}

if (isTranscriptFeature(feature, session)) {
contextMenuItemsForFeature.push({
label: 'Merge transcript',
Expand Down
14 changes: 14 additions & 0 deletions packages/jbrowse-plugin-apollo/src/util/glyphUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ export function selectFeatureAndOpenWidget(
}
}

export function isGeneFeature(
feature: AnnotationFeature,
session: ApolloSessionModel,
): boolean {
const { featureTypeOntology } = session.apolloDataStore.ontologyManager
if (!featureTypeOntology) {
throw new Error('featureTypeOntology is undefined')
}
return (
featureTypeOntology.isTypeOf(feature.type, 'gene') ||
featureTypeOntology.isTypeOf(feature.type, 'pseudogene')
)
}

export function isTranscriptFeature(
feature: AnnotationFeature,
session: ApolloSessionModel,
Expand Down