From 5f757a2b348f8f8ffc7c72b29e722c2e3856fbc4 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Aug 2024 17:51:55 -0400 Subject: [PATCH] Add ability to launch a protein view from any gene --- eslint.config.mjs | 1 + .../components/AlphaFoldDBSearch.tsx | 125 +++++++++++++++++- src/LaunchProteinView/index.ts | 8 +- 3 files changed, 130 insertions(+), 4 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 5f9f9b2..c5ae967 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -71,6 +71,7 @@ export default tseslint.config( '@typescript-eslint/restrict-template-expressions': 'off', '@typescript-eslint/no-empty-function': 'off', + 'unicorn/no-array-for-each': 'off', 'unicorn/no-null': 'off', 'unicorn/prefer-spread': 'off', 'unicorn/no-nested-ternary': 'off', diff --git a/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx b/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx index 1e3c3d5..2aaa8b0 100644 --- a/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx +++ b/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx @@ -7,6 +7,7 @@ import { Feature, getContainingView, getSession, + isSessionWithAddTracks, } from '@jbrowse/core/util' import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui' import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view' @@ -186,12 +187,132 @@ const AlphaFoldDBSearch = observer(function ({ connectedViewId: view.id, }, ], - displayName: `Protein view ${getGeneDisplayName(feature)} - ${getTranscriptDisplayName(selectedTranscript)}`, + displayName: `Protein view ${uniprotId} - ${getGeneDisplayName(feature)} - ${getTranscriptDisplayName(selectedTranscript)}`, }) handleClose() }} > - Submit + Launch 3-D protein structure view + + diff --git a/src/LaunchProteinView/index.ts b/src/LaunchProteinView/index.ts index ec1a692..64a54f0 100644 --- a/src/LaunchProteinView/index.ts +++ b/src/LaunchProteinView/index.ts @@ -31,12 +31,16 @@ function extendStateModel(stateModel: IAnyModelType) { ...(feature ? [ { - label: 'Launch 3-D protein view', + label: 'Launch protein view', icon: AddIcon, onClick: () => { getSession(track).queueDialog(handleClose => [ LaunchProteinViewDialog, - { model: track, handleClose, feature }, + { + model: track, + handleClose, + feature, + }, ]) }, },