jbrowse-plugin-protein3d 0.8.3 → 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.
- package/dist/LaunchProteinView/components/FoldseekActionMenu.js +2 -3
- package/dist/LaunchProteinView/components/ProteinViewActions.js +2 -18
- package/dist/LaunchProteinView/utils/launchViewUtils.d.ts +0 -9
- package/dist/LaunchProteinView/utils/launchViewUtils.js +8 -66
- package/dist/LaunchProteinView/utils/sideBySide.js +26 -9
- package/dist/LaunchProteinView/utils/structureUrls.d.ts +0 -1
- package/dist/LaunchProteinView/utils/structureUrls.js +0 -3
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js +14 -14
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js.map +4 -4
- package/dist/{molstar-chunk-UJIWPKE3.js → molstar-chunk-JDIZPSL3.js} +1 -1
- package/dist/{molstar-chunk-UJIWPKE3.js.map → molstar-chunk-JDIZPSL3.js.map} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -2
- package/src/LaunchProteinView/components/FoldseekActionMenu.tsx +1 -9
- package/src/LaunchProteinView/components/LaunchOptionsDialog.tsx +3 -4
- package/src/LaunchProteinView/components/ProteinViewActions.tsx +1 -20
- package/src/LaunchProteinView/utils/launchViewUtils.ts +8 -87
- package/src/LaunchProteinView/utils/sideBySide.test.ts +6 -0
- package/src/LaunchProteinView/utils/sideBySide.ts +26 -9
- package/src/LaunchProteinView/utils/structureUrls.ts +0 -7
- package/src/version.ts +1 -1
|
@@ -29,7 +29,7 @@ export default function FoldseekActionMenu({ hit, session, view, feature, select
|
|
|
29
29
|
userProvidedTranscriptSequence,
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
const { launch1D
|
|
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,
|
|
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
|
|
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
|
|
82
|
-
//
|
|
83
|
-
// protein
|
|
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
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
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
|
-
}
|
|
@@ -23,19 +23,36 @@ function isSessionWithWorkspaces(session) {
|
|
|
23
23
|
// Missing BOTH is an embedded session: it has no workspaces, there is nothing
|
|
24
24
|
// to ask for, and silence is the right answer.
|
|
25
25
|
//
|
|
26
|
-
// Missing ONE is a host that has workspaces but
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
26
|
+
// Missing ONE is a host that has workspaces but places views some other way —
|
|
27
|
+
// and silence there is how this broke before. jbrowse-web folded
|
|
28
|
+
// `setPendingMove` into its layout `init`, this guard went false, and the
|
|
29
|
+
// plugin simply stopped asking for the split: no error, no missing feature,
|
|
30
|
+
// just two views quietly stacking. Nobody noticed for weeks. Feature
|
|
31
|
+
// detection cannot ask the host to announce a change, but it can tell "not
|
|
32
|
+
// supported here" from "supported, and gone".
|
|
33
|
+
//
|
|
34
|
+
// Two very different hosts produce this one shape, and nothing on the session
|
|
35
|
+
// tells them apart, so the message carries both rather than the guess:
|
|
36
|
+
//
|
|
37
|
+
// - Releases through v4.3.0, where placement is `setPendingMoveToSplitRight`,
|
|
38
|
+
// a module function in @jbrowse/app-core's DockviewContext, not a session
|
|
39
|
+
// action. Nothing is wrong and nothing needs fixing; this plugin targets v5+
|
|
40
|
+
// and does not reach for v4's door. Measured 2026-08-17: v4.3.0 and latest
|
|
41
|
+
// stack, main splits.
|
|
42
|
+
// - A newer host that moved the action out from under us, which is the
|
|
43
|
+
// regression this warning exists to catch.
|
|
44
|
+
//
|
|
45
|
+
// Do not quiet the first case by sniffing the version. The alarm is only worth
|
|
46
|
+
// having if it fires on a shape it cannot explain, and these two shapes are
|
|
47
|
+
// identical.
|
|
33
48
|
if (canEnable !== canPlace && !warnedPartial) {
|
|
34
49
|
warnedPartial = true;
|
|
35
50
|
console.warn(`jbrowse-plugin-protein3d: this session supports workspaces but not ` +
|
|
36
51
|
`${canPlace ? 'setUseWorkspaces' : 'setPendingMove'}, so the ` +
|
|
37
|
-
`side-by-side launch was skipped and the views will stack.
|
|
38
|
-
`
|
|
52
|
+
`side-by-side launch was skipped and the views will stack. Expected on ` +
|
|
53
|
+
`releases through v4.3.0, which place views through @jbrowse/app-core ` +
|
|
54
|
+
`instead; on a newer host it means the session API moved and the plugin ` +
|
|
55
|
+
`needs updating to match.`);
|
|
39
56
|
}
|
|
40
57
|
return canEnable && canPlace;
|
|
41
58
|
}
|
|
@@ -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
|
}
|