jbrowse-plugin-protein3d 0.8.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ export default function FoldseekActionMenu({ hit, session, view, feature, select
29
29
  userProvidedTranscriptSequence,
30
30
  });
31
31
  });
32
- const { launch1D, launchMsa } = getConditionalProteinLaunches({
32
+ const { launch1D } = getConditionalProteinLaunches({
33
33
  ...baseParams,
34
34
  confidenceUrl: getConfidenceUrlFromTarget(hit.target),
35
35
  });
@@ -42,6 +42,5 @@ export default function FoldseekActionMenu({ hit, session, view, feature, select
42
42
  React.createElement(Button, { size: "small", variant: "outlined", onClick: handleClick }, "Load"),
43
43
  React.createElement(Menu, { anchorEl: anchorEl, open: open, onClose: handleMenuClose },
44
44
  React.createElement(MenuItem, { "data-testid": "protein-launch-option-3d", onClick: handleLaunch3D }, PROTEIN_LAUNCH_LABELS['3d']),
45
- launch1D ? (React.createElement(MenuItem, { "data-testid": "protein-launch-option-1d", onClick: runLaunch(launch1D) }, PROTEIN_LAUNCH_LABELS['1d'])) : null,
46
- launchMsa ? (React.createElement(MenuItem, { "data-testid": "protein-launch-option-msa", onClick: runLaunch(launchMsa) }, PROTEIN_LAUNCH_LABELS.msa)) : null)));
45
+ launch1D ? (React.createElement(MenuItem, { "data-testid": "protein-launch-option-1d", onClick: runLaunch(launch1D) }, PROTEIN_LAUNCH_LABELS['1d'])) : null)));
47
46
  }
@@ -8,7 +8,7 @@ import LaunchSettingsDialog from './LaunchSettingsDialog';
8
8
  import SequenceMismatchNotice from './SequenceMismatchNotice';
9
9
  import { useSafeLaunch } from '../hooks/useSafeLaunch';
10
10
  import { getLaunchMissingReasons } from '../utils/launchHelpers';
11
- import { PROTEIN_LAUNCH_LABELS, getConditionalProteinLaunches, launch3DProteinView, launch3DProteinViewWithMsa, } from '../utils/launchViewUtils';
11
+ import { PROTEIN_LAUNCH_LABELS, getConditionalProteinLaunches, launch3DProteinView, } from '../utils/launchViewUtils';
12
12
  export default function ProteinViewActions({ handleClose, uniprotId, userSelectedProteinSequence, selectedTranscript, url, confidenceUrl, feature, view, session, alignmentAlgorithm, onAlignmentAlgorithmChange, sequencesMatch, isLoading, error, }) {
13
13
  const [dialogOpen, setDialogOpen] = useState(false);
14
14
  const [settingsOpen, setSettingsOpen] = useState(false);
@@ -40,7 +40,7 @@ export default function ProteinViewActions({ handleClose, uniprotId, userSelecte
40
40
  const handleLaunch3DView = runLaunch(() => {
41
41
  launch3DProteinView(launch3DParams);
42
42
  });
43
- const { launch1D, launchMsa } = getConditionalProteinLaunches({
43
+ const { launch1D } = getConditionalProteinLaunches({
44
44
  session,
45
45
  view,
46
46
  feature,
@@ -65,22 +65,6 @@ export default function ProteinViewActions({ handleClose, uniprotId, userSelecte
65
65
  },
66
66
  ]
67
67
  : []),
68
- ...(launchMsa
69
- ? [
70
- {
71
- key: 'msa',
72
- title: PROTEIN_LAUNCH_LABELS.msa,
73
- description: 'View AlphaFold a3m multiple sequence alignment',
74
- onClick: runLaunch(launchMsa),
75
- },
76
- {
77
- key: '3d-msa',
78
- title: PROTEIN_LAUNCH_LABELS['3d-msa'],
79
- description: 'Launch both views with AlphaFold a3m MSA',
80
- onClick: runLaunch(() => launch3DProteinViewWithMsa(launch3DParams)),
81
- },
82
- ]
83
- : []),
84
68
  ];
85
69
  return (React.createElement(React.Fragment, null,
86
70
  launchError ? React.createElement(ErrorMessage, { error: launchError }) : null,
@@ -1,11 +1,6 @@
1
1
  import type { AlignmentAlgorithm } from '../../ProteinView/types';
2
2
  import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
3
3
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
4
- declare global {
5
- interface Window {
6
- JBrowsePluginMsaView?: unknown;
7
- }
8
- }
9
4
  interface LaunchViewParams {
10
5
  session: AbstractSessionModel;
11
6
  view: LinearGenomeViewModel;
@@ -28,14 +23,10 @@ export declare function launch3DProteinView({ session, view, feature, selectedTr
28
23
  export declare const PROTEIN_LAUNCH_LABELS: {
29
24
  readonly '3d': "Launch 3D protein structure view";
30
25
  readonly '1d': "Launch 1D protein annotation view";
31
- readonly msa: "Launch MSA view (AlphaFold a3m)";
32
- readonly '3d-msa': "Launch 3D structure + MSA view";
33
26
  };
34
27
  export declare function getConditionalProteinLaunches({ session, view, feature, selectedTranscript, uniprotId, confidenceUrl, }: LaunchViewParams & {
35
28
  confidenceUrl?: string;
36
29
  }): {
37
30
  launch1D: (() => Promise<void>) | undefined;
38
- launchMsa: (() => import("@jbrowse/core/util").AbstractViewModel | undefined) | undefined;
39
31
  };
40
- export declare function launch3DProteinViewWithMsa(params: LaunchViewParams & Launch3DExtraParams): import("@jbrowse/core/util").AbstractViewModel | undefined;
41
32
  export {};
@@ -1,6 +1,5 @@
1
1
  import { isSessionWithAddTracks } from '@jbrowse/core/util';
2
2
  import { maybeLaunchSideBySide } from './sideBySide';
3
- import { getAlphaFoldMsaUrl } from './structureUrls';
4
3
  import { getGeneDisplayName, getTranscriptDisplayName } from './util';
5
4
  import { proteinViewSnapshot } from '../../ProteinView/proteinViewSpec';
6
5
  import { launchProteinAnnotationView } from '../components/launchProteinAnnotationView';
@@ -50,56 +49,19 @@ async function launch1DProteinView({ session, view, feature, selectedTranscript,
50
49
  connectedViewId: view.id,
51
50
  });
52
51
  }
53
- // CROSS-REPO DEPENDENCY: the 'MsaView' view type is registered by
54
- // jbrowse-plugin-msaview, which wraps the `react-msaview` library. The top-level
55
- // props here (colorSchemeName, connectedViewId, connectedFeature) are native
56
- // react-msaview model properties applied directly from the snapshot; only `init`
57
- // (msaUrl) is a declarative launch contract that the plugin resolves once and
58
- // clears. These are NOT type-checked here because we only depend on it at runtime
59
- // (gated by hasMsaViewPlugin()). If react-msaview renames these, the launch
60
- // silently degrades. Keep in step with that repo.
61
- function launchMsaView({ session, view, feature, selectedTranscript, uniprotId, displayName, }) {
62
- if (!uniprotId) {
63
- return undefined;
64
- }
65
- return session.addView('MsaView', {
66
- type: 'MsaView',
67
- displayName: displayName ??
68
- formatViewName('MSA view', feature, selectedTranscript, uniprotId),
69
- connectedViewId: view.id,
70
- connectedFeature: selectedTranscript?.toJSON(),
71
- colorSchemeName: 'percent_identity',
72
- init: {
73
- msaUrl: getAlphaFoldMsaUrl(uniprotId),
74
- },
75
- });
76
- }
77
- function hasMsaViewPlugin() {
78
- return window.JBrowsePluginMsaView !== undefined;
79
- }
80
52
  // What the launches below are CALLED, shared for the same reason their
81
- // availability is: the AlphaFold and Foldseek menus offer the same three
82
- // actions, and had drifted to different names for two of them ("Launch 3D
83
- // protein structure view" vs "Launch 3D protein view", and an MSA item that
84
- // named its source on one menu and not the other). Two names for one action
85
- // reads as two actions.
86
- //
87
- // The MSA item says "(AlphaFold a3m)" rather than a bare "Launch MSA view"
88
- // because msaview contributes a gene right-click item by that exact name, and
89
- // the two build different things: msaview's is one row per species from NCBI's
90
- // orthologs, this one is the deep unlabelled alignment AlphaFold folded from.
53
+ // availability is: the AlphaFold and Foldseek menus offer the same actions, and
54
+ // had drifted to different names ("Launch 3D protein structure view" vs "Launch
55
+ // 3D protein view"). Two names for one action reads as two actions.
91
56
  export const PROTEIN_LAUNCH_LABELS = {
92
57
  '3d': 'Launch 3D protein structure view',
93
58
  '1d': 'Launch 1D protein annotation view',
94
- msa: 'Launch MSA view (AlphaFold a3m)',
95
- '3d-msa': 'Launch 3D structure + MSA view',
96
59
  };
97
- // The 1D-annotation and MSA launches share identical availability rules across
98
- // the AlphaFold and Foldseek launch menus: the 1D view needs an add-tracks
99
- // session and a uniprotId, the MSA view needs the msaview plugin and a
100
- // uniprotId. Returning each as a ready-to-run thunk (or undefined when
101
- // unavailable) is the single source of truth — an unavailable action is
102
- // unrepresentable rather than a menu item that silently no-ops.
60
+ // The 1D-annotation launch has the same availability rule on both the AlphaFold
61
+ // and Foldseek launch menus: a session it can add tracks to, and a uniprotId.
62
+ // Returning it as a ready-to-run thunk (or undefined when unavailable) is the
63
+ // single source of truth — an unavailable action is unrepresentable rather than
64
+ // a menu item that silently no-ops.
103
65
  export function getConditionalProteinLaunches({ session, view, feature, selectedTranscript, uniprotId, confidenceUrl, }) {
104
66
  const addTracksSession = isSessionWithAddTracks(session) ? session : undefined;
105
67
  return {
@@ -113,25 +75,5 @@ export function getConditionalProteinLaunches({ session, view, feature, selected
113
75
  confidenceUrl,
114
76
  })
115
77
  : undefined,
116
- launchMsa: uniprotId && hasMsaViewPlugin()
117
- ? () => launchMsaView({
118
- session,
119
- view,
120
- feature,
121
- selectedTranscript,
122
- uniprotId,
123
- })
124
- : undefined,
125
78
  };
126
79
  }
127
- export function launch3DProteinViewWithMsa(params) {
128
- const { uniprotId } = params;
129
- if (!uniprotId) {
130
- return undefined;
131
- }
132
- const msaView = launchMsaView(params);
133
- return launch3DProteinView({
134
- ...params,
135
- connectedMsaViewId: msaView?.id,
136
- });
137
- }
@@ -3,7 +3,6 @@ export declare function uniprotFastaUrl(uniprotId: string): string;
3
3
  export declare function uniprotEntryUrl(uniprotId: string): string;
4
4
  export declare function getAlphaFoldStructureUrl(uniprotId: string, version?: string): string;
5
5
  export declare function getAlphaFoldConfidenceUrl(uniprotId: string, version?: string): string;
6
- export declare function getAlphaFoldMsaUrl(uniprotId: string, version?: string): string;
7
6
  export declare function getPdbStructureUrl(pdbId: string): string;
8
7
  /**
9
8
  * Resolve the `{ uniprotId }` / `{ pdbId }` shorthand to a concrete structure
@@ -21,9 +21,6 @@ export function getAlphaFoldStructureUrl(uniprotId, version = ALPHAFOLD_VERSION)
21
21
  export function getAlphaFoldConfidenceUrl(uniprotId, version = ALPHAFOLD_VERSION) {
22
22
  return `https://alphafold.ebi.ac.uk/files/AF-${uniprotId}-F1-confidence_${version}.json`;
23
23
  }
24
- export function getAlphaFoldMsaUrl(uniprotId, version = ALPHAFOLD_VERSION) {
25
- return `https://alphafold.ebi.ac.uk/files/msa/AF-${uniprotId}-F1-msa_${version}.a3m`;
26
- }
27
24
  export function getPdbStructureUrl(pdbId) {
28
25
  return `https://files.rcsb.org/download/${pdbId}.cif`;
29
26
  }