jbrowse-plugin-protein3d 1.33.0 → 1.35.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/README.md +10 -11
- package/dist/LaunchProteinView/index.js +20 -84
- package/dist/LaunchProteinViewExtensionPoint/launchProteinView.js +13 -3
- package/dist/ProteinView/markProblems.js +7 -1
- package/dist/ProteinView/residueMarks.js +41 -15
- package/dist/ProteinView/structureLoader.js +8 -6
- package/dist/ProteinView/structureModel.js +8 -5
- package/dist/ProteinView/structurePipeline.js +34 -2
- package/dist/chunks/{AddStructureDialog-RO4QWRSL.js → AddStructureDialog-6CWM5DGW.js} +2 -2
- package/dist/chunks/{AlphaMissensePathogenicityAdapter-UX7VHUBB.js → AlphaMissensePathogenicityAdapter-JCHDJ5CZ.js} +2 -2
- package/dist/chunks/{GenomeTrackColorDialog-EJZ5KTKX.js → GenomeTrackColorDialog-G3RPUVPX.js} +2 -2
- package/dist/chunks/{HelpDialog-ZGLXAIOU.js → HelpDialog-MSZSJO5F.js} +2 -2
- package/dist/chunks/{LaunchProteinViewDialog-OMCH6FKM.js → LaunchProteinViewDialog-PCQQI2FP.js} +3 -3
- package/dist/chunks/{LaunchProteinViewDialog-OMCH6FKM.js.map → LaunchProteinViewDialog-PCQQI2FP.js.map} +1 -1
- package/dist/chunks/{ManualAlignmentDialog-IWVSCVAI.js → ManualAlignmentDialog-E6FEY5OI.js} +2 -2
- package/dist/chunks/{ProteinAlignmentHelpDialog-7DFITDVK.js → ProteinAlignmentHelpDialog-OTSZXOOU.js} +2 -2
- package/dist/chunks/{ProteinView-IM7GNXMQ.js → ProteinView-RGOD6DEB.js} +3 -3
- package/dist/chunks/chunk-GPMX3YBJ.js +2 -0
- package/dist/chunks/chunk-GPMX3YBJ.js.map +7 -0
- package/dist/chunks/{chunk-VQ5X2CAU.js → chunk-H74KBZLE.js} +2 -2
- package/dist/chunks/{chunk-VQ5X2CAU.js.map → chunk-H74KBZLE.js.map} +2 -2
- package/dist/chunks/chunk-HNG6EUQA.js +2 -0
- package/dist/chunks/{chunk-TZ54BAT7.js.map → chunk-HNG6EUQA.js.map} +4 -4
- package/dist/chunks/{chunk-UWFZCUMZ.js → chunk-HSBVTMBK.js} +2 -2
- package/dist/chunks/{chunk-A4XT2SQ7.js → chunk-IKXMX5OW.js} +2 -2
- package/dist/chunks/{chunk-RPRTWFVS.js → chunk-LQ6SZ6DD.js} +2 -2
- package/dist/chunks/chunk-N3ZJYLQ3.js +3 -0
- package/dist/chunks/chunk-N3ZJYLQ3.js.map +7 -0
- package/dist/chunks/{chunk-EKHBUHHM.js → chunk-OZ6WLM7F.js} +2 -2
- package/dist/chunks/{chunk-EKHBUHHM.js.map → chunk-OZ6WLM7F.js.map} +1 -1
- package/dist/chunks/{chunk-LVAZFGE6.js → chunk-PUFN5OCK.js} +2 -2
- package/dist/chunks/chunk-QDEJUSPX.js +2 -0
- package/dist/chunks/chunk-QDEJUSPX.js.map +7 -0
- package/dist/chunks/chunk-ZM3UTIKZ.js +2 -0
- package/dist/chunks/{chunk-22BDSJBC.js.map → chunk-ZM3UTIKZ.js.map} +1 -1
- package/dist/chunks/{chunk-53Z5PTMG.js → chunk-ZSEHREL2.js} +2 -2
- package/dist/chunks/clinVarSource-XMEVWIBY.js +2 -0
- package/dist/chunks/launchAnnotationView-BJ7FCRXX.js +2 -0
- package/dist/chunks/{launchAnnotationView-XZ7GDC3Z.js.map → launchAnnotationView-BJ7FCRXX.js.map} +1 -1
- package/dist/chunks/launchProteinView-3GPFRKDX.js +2 -0
- package/dist/chunks/launchProteinView-3GPFRKDX.js.map +7 -0
- package/dist/chunks/model-35ZSLFYJ.js +2 -0
- package/dist/chunks/model-35ZSLFYJ.js.map +7 -0
- package/dist/chunks/{molstarExports-5EF5VYZ6.js → molstarExports-6RWVF2ZY.js} +2 -2
- package/dist/jbrowse-plugin-protein3d.esm.js +1 -1
- package/dist/jbrowse-plugin-protein3d.esm.js.map +3 -3
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/LaunchProteinView/CLAUDE.md +12 -0
- package/src/LaunchProteinView/index.ts +21 -100
- package/src/LaunchProteinView/menuTarget.test.ts +34 -14
- package/src/LaunchProteinViewExtensionPoint/launchProteinView.ts +22 -6
- package/src/LaunchProteinViewExtensionPoint/launchViewSnapshot.test.ts +35 -1
- package/src/ProteinView/CLAUDE.md +25 -0
- package/src/ProteinView/markProblems.test.ts +9 -2
- package/src/ProteinView/markProblems.ts +7 -1
- package/src/ProteinView/residueMarks.test.ts +22 -0
- package/src/ProteinView/residueMarks.ts +62 -24
- package/src/ProteinView/structureLoader.test.ts +35 -3
- package/src/ProteinView/structureLoader.ts +9 -6
- package/src/ProteinView/structureModel.test.ts +1 -1
- package/src/ProteinView/structureModel.ts +8 -5
- package/src/ProteinView/structurePipeline.test.ts +67 -0
- package/src/ProteinView/structurePipeline.ts +47 -6
- package/src/version.ts +1 -1
- package/dist/chunks/chunk-22BDSJBC.js +0 -2
- package/dist/chunks/chunk-7GELEOAH.js +0 -2
- package/dist/chunks/chunk-7GELEOAH.js.map +0 -7
- package/dist/chunks/chunk-A73LEL2C.js +0 -2
- package/dist/chunks/chunk-A73LEL2C.js.map +0 -7
- package/dist/chunks/chunk-BR44SFC2.js +0 -2
- package/dist/chunks/chunk-BR44SFC2.js.map +0 -7
- package/dist/chunks/chunk-ENW425OE.js +0 -2
- package/dist/chunks/chunk-ENW425OE.js.map +0 -7
- package/dist/chunks/chunk-MBUM32YU.js +0 -3
- package/dist/chunks/chunk-MBUM32YU.js.map +0 -7
- package/dist/chunks/chunk-TZ54BAT7.js +0 -2
- package/dist/chunks/clinVarSource-36GTMEOG.js +0 -2
- package/dist/chunks/launchAnnotationView-XZ7GDC3Z.js +0 -2
- package/dist/chunks/launchProteinView-ZCQRFJXK.js +0 -2
- package/dist/chunks/launchProteinView-ZCQRFJXK.js.map +0 -7
- package/dist/chunks/launchViewUtils-6INIP22K.js +0 -2
- package/dist/chunks/launchViewUtils-6INIP22K.js.map +0 -7
- package/dist/chunks/model-J5LYRYAB.js +0 -2
- package/dist/chunks/model-J5LYRYAB.js.map +0 -7
- package/dist/chunks/resolveGeneLaunch-4AG66E4N.js +0 -2
- package/dist/chunks/resolveGeneLaunch-4AG66E4N.js.map +0 -7
- package/src/LaunchProteinView/openAlphaFoldStructure.test.ts +0 -94
- /package/dist/chunks/{AddStructureDialog-RO4QWRSL.js.map → AddStructureDialog-6CWM5DGW.js.map} +0 -0
- /package/dist/chunks/{AlphaMissensePathogenicityAdapter-UX7VHUBB.js.map → AlphaMissensePathogenicityAdapter-JCHDJ5CZ.js.map} +0 -0
- /package/dist/chunks/{GenomeTrackColorDialog-EJZ5KTKX.js.map → GenomeTrackColorDialog-G3RPUVPX.js.map} +0 -0
- /package/dist/chunks/{HelpDialog-ZGLXAIOU.js.map → HelpDialog-MSZSJO5F.js.map} +0 -0
- /package/dist/chunks/{ManualAlignmentDialog-IWVSCVAI.js.map → ManualAlignmentDialog-E6FEY5OI.js.map} +0 -0
- /package/dist/chunks/{ProteinAlignmentHelpDialog-7DFITDVK.js.map → ProteinAlignmentHelpDialog-OTSZXOOU.js.map} +0 -0
- /package/dist/chunks/{ProteinView-IM7GNXMQ.js.map → ProteinView-RGOD6DEB.js.map} +0 -0
- /package/dist/chunks/{chunk-UWFZCUMZ.js.map → chunk-HSBVTMBK.js.map} +0 -0
- /package/dist/chunks/{chunk-A4XT2SQ7.js.map → chunk-IKXMX5OW.js.map} +0 -0
- /package/dist/chunks/{chunk-RPRTWFVS.js.map → chunk-LQ6SZ6DD.js.map} +0 -0
- /package/dist/chunks/{chunk-LVAZFGE6.js.map → chunk-PUFN5OCK.js.map} +0 -0
- /package/dist/chunks/{chunk-53Z5PTMG.js.map → chunk-ZSEHREL2.js.map} +0 -0
- /package/dist/chunks/{clinVarSource-36GTMEOG.js.map → clinVarSource-XMEVWIBY.js.map} +0 -0
- /package/dist/chunks/{molstarExports-5EF5VYZ6.js.map → molstarExports-6RWVF2ZY.js.map} +0 -0
package/README.md
CHANGED
|
@@ -11,17 +11,16 @@ selected in magenta on the structure, and its codon is marked on the gene.
|
|
|
11
11
|
CI re-renders the figure from `main` every hour
|
|
12
12
|
([scripts/readme-figure.mjs](scripts/readme-figure.mjs)).
|
|
13
13
|
|
|
14
|
-
Right-click a gene and choose **
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
highlights its residue.
|
|
14
|
+
Right-click a gene and choose **Launch › Protein view...** for the dialog that
|
|
15
|
+
offers every choice. The dialog looks the gene up in UniProt and lists every
|
|
16
|
+
structure found for it in one list: the AlphaFold model, the experimental PDB
|
|
17
|
+
entries RCSB maps to that UniProt entry with their partner proteins and ligands,
|
|
18
|
+
and the complexes AlphaFold DB predicted, grouped by what each shows, led by any
|
|
19
|
+
structures the site lists for the gene in a dataset of its own. Check several to
|
|
20
|
+
open them superposed in one view. It can also search Foldseek for related
|
|
21
|
+
structures, or open your own file. The plugin aligns each structure to the
|
|
22
|
+
transcript's translation, so hovering a residue highlights its codon and
|
|
23
|
+
hovering a codon highlights its residue.
|
|
25
24
|
|
|
26
25
|
## Try it
|
|
27
26
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
+
import { pushLaunchViewMenuItem } from '@jbrowse/core/ui';
|
|
2
3
|
import { getContainingTrack, getContainingView, getSession, isGeneLikeType, } from '@jbrowse/core/util';
|
|
3
4
|
import AddIcon from '@mui/icons-material/Add';
|
|
4
5
|
import { isCodingFeature } from './codingFeature';
|
|
5
6
|
import { isLaunchingGenomeView } from './utils/genomeView';
|
|
6
|
-
import { getGeneDisplayName } from './utils/util';
|
|
7
7
|
// the menu items register at boot; what they open loads on the first click
|
|
8
8
|
const LaunchProteinViewDialog = lazy(() => import('./components/LaunchProteinViewDialog'));
|
|
9
9
|
function isDisplay(elt) {
|
|
@@ -27,28 +27,6 @@ export function resolveTarget(self) {
|
|
|
27
27
|
preferredTranscriptId: subfeature?.featureId,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function withCodingFeature(self, target, then) {
|
|
31
|
-
const session = getSession(self);
|
|
32
|
-
target
|
|
33
|
-
.fetchFeature()
|
|
34
|
-
.then(feature => {
|
|
35
|
-
if (!feature) {
|
|
36
|
-
session.notify('Could not load feature for protein view', 'warning');
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
else if (!isCodingFeature(feature)) {
|
|
40
|
-
session.notify(`${feature.get('name') ?? feature.get('id') ?? 'This feature'} has no coding sequence, so there is no protein to show`, 'info');
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return then(feature);
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
.catch((e) => {
|
|
48
|
-
console.error(e);
|
|
49
|
-
session.notifyError(`${e}`, e);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
30
|
function openDialog(self, target, feature) {
|
|
53
31
|
const session = getSession(self);
|
|
54
32
|
const view = getContainingView(self);
|
|
@@ -68,62 +46,23 @@ function openDialog(self, target, feature) {
|
|
|
68
46
|
]);
|
|
69
47
|
}
|
|
70
48
|
function launchProteinView(self, target) {
|
|
71
|
-
withCodingFeature(self, target, feature => {
|
|
72
|
-
openDialog(self, target, feature);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
const lookingUp = new Set();
|
|
76
|
-
// The dialog's defaults without the dialog. Where they name no single
|
|
77
|
-
// structure, a gene two UniProt entries answer to or one AlphaFold has not
|
|
78
|
-
// folded, the dialog opens for the choice only a person can make.
|
|
79
|
-
function openAlphaFoldStructure(self, target) {
|
|
80
49
|
const session = getSession(self);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!genomeView || !assemblyName) {
|
|
87
|
-
openDialog(self, target, feature);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const key = `${genomeView.id}:${feature.id()}:${target.preferredTranscriptId}`;
|
|
91
|
-
if (lookingUp.has(key)) {
|
|
92
|
-
session.notify(`Still looking up the AlphaFold structure of ${name}`, 'info');
|
|
93
|
-
return;
|
|
50
|
+
target
|
|
51
|
+
.fetchFeature()
|
|
52
|
+
.then(feature => {
|
|
53
|
+
if (!feature) {
|
|
54
|
+
session.notify('Could not load feature for protein view', 'warning');
|
|
94
55
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
session.notify(`Looking up the AlphaFold structure of ${name}`, 'info');
|
|
98
|
-
const [{ describeMissingStructure, resolveGeneLaunch, sessionGeneLaunchHost }, { launch3DProteinView },] = await Promise.all([
|
|
99
|
-
import('./resolveGeneLaunch'),
|
|
100
|
-
import('./utils/launchViewUtils'),
|
|
101
|
-
]);
|
|
102
|
-
const launch = await resolveGeneLaunch({
|
|
103
|
-
host: sessionGeneLaunchHost(session, assemblyName),
|
|
104
|
-
feature,
|
|
105
|
-
preferredTranscriptId: target.preferredTranscriptId,
|
|
106
|
-
});
|
|
107
|
-
const { transcript, userProvidedTranscriptSequence, uniprotId, url } = launch;
|
|
108
|
-
if (url) {
|
|
109
|
-
await launch3DProteinView({
|
|
110
|
-
session,
|
|
111
|
-
view: genomeView,
|
|
112
|
-
feature,
|
|
113
|
-
selectedTranscript: transcript,
|
|
114
|
-
uniprotId,
|
|
115
|
-
sources: [{ url }],
|
|
116
|
-
userProvidedTranscriptSequence,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
session.notify(describeMissingStructure(name, launch), launch.lookupError === undefined ? 'info' : 'warning');
|
|
121
|
-
openDialog(self, target, feature);
|
|
122
|
-
}
|
|
56
|
+
else if (isCodingFeature(feature)) {
|
|
57
|
+
openDialog(self, target, feature);
|
|
123
58
|
}
|
|
124
|
-
|
|
125
|
-
|
|
59
|
+
else {
|
|
60
|
+
session.notify(`${feature.get('name') ?? feature.get('id') ?? 'This feature'} has no coding sequence, so there is no protein to show`, 'info');
|
|
126
61
|
}
|
|
62
|
+
})
|
|
63
|
+
.catch((e) => {
|
|
64
|
+
console.error(e);
|
|
65
|
+
session.notifyError(`${e}`, e);
|
|
127
66
|
});
|
|
128
67
|
}
|
|
129
68
|
function proteinMenuItems(self) {
|
|
@@ -131,14 +70,7 @@ function proteinMenuItems(self) {
|
|
|
131
70
|
return target && isGeneLikeType(target.type)
|
|
132
71
|
? [
|
|
133
72
|
{
|
|
134
|
-
label: '
|
|
135
|
-
icon: AddIcon,
|
|
136
|
-
onClick: () => {
|
|
137
|
-
openAlphaFoldStructure(self, target);
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
label: 'Launch protein view',
|
|
73
|
+
label: 'Protein view...',
|
|
142
74
|
icon: AddIcon,
|
|
143
75
|
onClick: () => {
|
|
144
76
|
launchProteinView(self, target);
|
|
@@ -151,7 +83,11 @@ function proteinMenuItems(self) {
|
|
|
151
83
|
// while reading it would take the host's whole context menu down with it
|
|
152
84
|
export function withProteinMenuItems(self, hostItems) {
|
|
153
85
|
try {
|
|
154
|
-
|
|
86
|
+
const items = [...hostItems];
|
|
87
|
+
for (const item of proteinMenuItems(self)) {
|
|
88
|
+
pushLaunchViewMenuItem(items, item);
|
|
89
|
+
}
|
|
90
|
+
return items;
|
|
155
91
|
}
|
|
156
92
|
catch (e) {
|
|
157
93
|
console.error('Protein view menu items failed', e);
|
|
@@ -27,6 +27,18 @@ export function launchViewSettings({ alignmentAlgorithm, color, colorScheme, ...
|
|
|
27
27
|
: colorOfScheme(colorScheme),
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The structures a launch opens, given the AlphaFold model its `gene` lookup
|
|
32
|
+
* picked for the transcript, an isoform's for an isoform transcript. That
|
|
33
|
+
* model fills only the structure the launch leaves to the gene; every entry of
|
|
34
|
+
* `structures` names its own source, so `{ uniprotId: 'P04637' }` there opens
|
|
35
|
+
* the canonical model beside any transcript.
|
|
36
|
+
*/
|
|
37
|
+
export function withGeneModel({ requested, geneModel }, named) {
|
|
38
|
+
return named && geneModel
|
|
39
|
+
? requested.map(s => ({ ...s, url: named.url }))
|
|
40
|
+
: requested;
|
|
41
|
+
}
|
|
30
42
|
/**
|
|
31
43
|
* A LaunchView point is a transformer, so the launch returns its extendee. A
|
|
32
44
|
* failure throws: the host launches a spec through
|
|
@@ -63,9 +75,7 @@ export async function launchProteinView(args) {
|
|
|
63
75
|
throw new Error(`${describeMissingStructure(gene, named)}; name a ${named.uniprotId ? 'pdbId or url' : 'uniprotId or pdbId'}`);
|
|
64
76
|
}
|
|
65
77
|
const launchFeature = resolved?.feature ?? feature;
|
|
66
|
-
const withTranscripts = (named
|
|
67
|
-
? normalized.requested.map(s => ({ ...s, url: named.url }))
|
|
68
|
-
: normalized.requested).map(s => ({
|
|
78
|
+
const withTranscripts = withGeneModel(normalized, named).map(s => ({
|
|
69
79
|
...s,
|
|
70
80
|
userProvidedTranscriptSequence: s.userProvidedTranscriptSequence ??
|
|
71
81
|
resolved?.userProvidedTranscriptSequence ??
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { narrowsChains } from './residueFilter';
|
|
2
2
|
import { parseSite } from './residueSpec';
|
|
3
|
-
const MARK_TYPES = ['spheres', 'sticks', 'cartoon'];
|
|
3
|
+
const MARK_TYPES = ['spheres', 'sticks', 'cartoon', 'none'];
|
|
4
4
|
const HEX_COLOR = /^#[0-9a-f]{6}$/i;
|
|
5
5
|
function isRecord(x) {
|
|
6
6
|
return typeof x === 'object' && x !== null && !Array.isArray(x);
|
|
@@ -58,6 +58,12 @@ export function markProblems(marks, structures = []) {
|
|
|
58
58
|
`${where}.mark is one of ${MARK_TYPES.join(', ')}, not ${JSON.stringify(mark.mark)}`,
|
|
59
59
|
]
|
|
60
60
|
: []),
|
|
61
|
+
...(mark.label !== undefined &&
|
|
62
|
+
(typeof mark.label !== 'string' || mark.label.trim() === '')
|
|
63
|
+
? [
|
|
64
|
+
`${where}.label is the text to write, not ${JSON.stringify(mark.label)}`,
|
|
65
|
+
]
|
|
66
|
+
: []),
|
|
61
67
|
...encodingProblems(where, mark),
|
|
62
68
|
...(mark.mark === 'cartoon' &&
|
|
63
69
|
site?.kind === 'chain' &&
|
|
@@ -16,10 +16,10 @@ function markRepresentation(mark) {
|
|
|
16
16
|
: { type: 'spacefill', typeParams: { sizeFactor: 1 } };
|
|
17
17
|
}
|
|
18
18
|
export const DEFAULT_MARK_COLOR = '#f28e2b';
|
|
19
|
-
export function syncResidueMarks({ plugin, structures, marks, }) {
|
|
19
|
+
export function syncResidueMarks({ plugin, structures, marks, labels = true, }) {
|
|
20
20
|
return serialPerPlugin(plugin, async () => {
|
|
21
21
|
const molstar = await loadMolstar();
|
|
22
|
-
const { Color, MolScriptBuilder: MS, StateSelection, StateTransforms, createStructureRepresentationParams, } = molstar;
|
|
22
|
+
const { Color, MolScriptBuilder: MS, Script, StateSelection, StructureSelection, StateTransforms, createStructureRepresentationParams, } = molstar;
|
|
23
23
|
const update = plugin.state.data.build();
|
|
24
24
|
for (const cell of plugin.state.data.select(StateSelection.Generators.root.subtree().withTag(RESIDUE_MARKS_TAG))) {
|
|
25
25
|
update.delete(cell.transform.ref);
|
|
@@ -33,20 +33,46 @@ export function syncResidueMarks({ plugin, structures, marks, }) {
|
|
|
33
33
|
if (!structure || !site || !root) {
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
if (mark.mark !== 'none') {
|
|
37
|
+
const color = encodedColor(mark.encoding, DEFAULT_MARK_COLOR);
|
|
38
|
+
update
|
|
39
|
+
.to(root)
|
|
40
|
+
.apply(StateTransforms.Model.StructureComponent, {
|
|
41
|
+
type: { name: 'expression', params: siteExpression(MS, site) },
|
|
42
|
+
nullIfEmpty: true,
|
|
43
|
+
label: mark.site,
|
|
44
|
+
}, drawnUnder(root, RESIDUE_MARKS_TAG))
|
|
45
|
+
.apply(StateTransforms.Representation.StructureRepresentation3D, createStructureRepresentationParams(plugin, structure, {
|
|
46
|
+
...markRepresentation(mark.mark),
|
|
47
|
+
color: 'uniform',
|
|
48
|
+
colorParams: { value: Color.fromHexStyle(color) },
|
|
49
|
+
}), drawnUnder(root, RESIDUE_MARKS_TAG));
|
|
50
|
+
}
|
|
49
51
|
}
|
|
50
52
|
await update.commit();
|
|
53
|
+
if (labels) {
|
|
54
|
+
for (const mark of marks) {
|
|
55
|
+
const structure = structures[mark.structure ?? 0];
|
|
56
|
+
const site = parseSite(mark.site);
|
|
57
|
+
if (mark.label && structure && site) {
|
|
58
|
+
const loci = StructureSelection.toLociWithSourceUnits(Script.getStructureSelection(siteExpression(MS, site), structure));
|
|
59
|
+
await plugin.managers.structure.measurement.addLabel(loci, {
|
|
60
|
+
selectionTags: [RESIDUE_MARKS_TAG],
|
|
61
|
+
reprTags: [RESIDUE_MARKS_TAG],
|
|
62
|
+
labelParams: {
|
|
63
|
+
customText: mark.label,
|
|
64
|
+
textColor: Color.fromHexStyle(encodedColor(mark.encoding, DEFAULT_MARK_COLOR)),
|
|
65
|
+
textSize: 0.14,
|
|
66
|
+
borderWidth: 0,
|
|
67
|
+
offsetZ: 4,
|
|
68
|
+
background: true,
|
|
69
|
+
backgroundColor: Color.fromHexStyle('#ffffff'),
|
|
70
|
+
backgroundOpacity: 0.85,
|
|
71
|
+
backgroundMargin: 0.2,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
51
77
|
});
|
|
52
78
|
}
|
|
@@ -52,9 +52,10 @@ export function makeStructureLoader(host, fetchModels = fetchAlphaFoldModels, fe
|
|
|
52
52
|
/**
|
|
53
53
|
* Which AlphaFold file an accession opens. Asked rather than spelled: a
|
|
54
54
|
* protein folded past the length cap has no F1 fragment, and the model
|
|
55
|
-
* version moves, so a hardcoded name 404s. The
|
|
56
|
-
*
|
|
57
|
-
*
|
|
55
|
+
* version moves, so a hardcoded name 404s. The accession's own model wins,
|
|
56
|
+
* so `P04637` opens the canonical model beside an isoform's transcript and
|
|
57
|
+
* `P04637-4` the isoform's. Only an accession AlphaFold DB folded as
|
|
58
|
+
* isoforms alone goes to the picker, with the transcript's translation.
|
|
58
59
|
*
|
|
59
60
|
* The two ways that can come back empty are not the same answer. An
|
|
60
61
|
* unreachable API says nothing about the accession, so the spelled canonical
|
|
@@ -72,9 +73,10 @@ export function makeStructureLoader(host, fetchModels = fetchAlphaFoldModels, fe
|
|
|
72
73
|
structure.setUrl(getAlphaFoldStructureUrl(uniprotId));
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
|
-
const picked =
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const picked = models.find(m => m.accession === uniprotId) ??
|
|
77
|
+
pickAlphaFoldModel(models, {
|
|
78
|
+
transcript: { seq: structure.userProvidedTranscriptSequence },
|
|
79
|
+
});
|
|
78
80
|
if (!picked) {
|
|
79
81
|
throw new Error(`AlphaFold DB has no model for ${uniprotId}`);
|
|
80
82
|
}
|
|
@@ -1905,11 +1905,14 @@ const Structure = types
|
|
|
1905
1905
|
// carries an already-set url, so it passes through unchanged.
|
|
1906
1906
|
//
|
|
1907
1907
|
// A given accession outranks the one the url spells, because they differ
|
|
1908
|
-
// exactly when it matters
|
|
1909
|
-
//
|
|
1910
|
-
//
|
|
1911
|
-
//
|
|
1912
|
-
//
|
|
1908
|
+
// exactly when it matters. `{ gene: 'TP53', transcriptId: 'NM_001126118.2',
|
|
1909
|
+
// uniprotId: 'P04637' }` opens the isoform file AF-P04637-4-F1 its transcript
|
|
1910
|
+
// was folded from, as the launch dialog does for an isoform, and the loader
|
|
1911
|
+
// opens an isoform file such as AF-P11532-2-F1 for an accession AlphaFold DB
|
|
1912
|
+
// folded as isoforms alone. Reading the accession back off that url would
|
|
1913
|
+
// save the isoform's, which UniProt's GFF endpoint does not serve, so a
|
|
1914
|
+
// reopened session lost its entry link. The entry's features are numbered for
|
|
1915
|
+
// the entry, not the isoform file, so `structureUniProt` withholds them.
|
|
1913
1916
|
//
|
|
1914
1917
|
// A snapshot carrying an alignment but no alignmentImported predates the
|
|
1915
1918
|
// flag or was written by hand; either way the alignment is used as given.
|
|
@@ -9,6 +9,36 @@ import { serialPerPlugin } from './serialPerPlugin';
|
|
|
9
9
|
function parseTrajectory(plugin, raw, format) {
|
|
10
10
|
return plugin.builders.structure.parseTrajectory(raw, format);
|
|
11
11
|
}
|
|
12
|
+
// Typed as always resolving to a selector, but a commit that reverts resolves
|
|
13
|
+
// with nothing
|
|
14
|
+
function commitDownload(built) {
|
|
15
|
+
return built.commit({ revertOnError: true });
|
|
16
|
+
}
|
|
17
|
+
/** Mol*'s download reverts a failed request, as it must: a failed update left
|
|
18
|
+
* in the tree flags any data transaction open beside it, which then rolls
|
|
19
|
+
* back. The revert takes the cell's error with it, so the parse after it said
|
|
20
|
+
* only "Invalid data cell"; the error is read off the cell as it fails. */
|
|
21
|
+
async function download(plugin, url) {
|
|
22
|
+
const molstar = await loadMolstar();
|
|
23
|
+
const state = plugin.state.data;
|
|
24
|
+
const built = state
|
|
25
|
+
.build()
|
|
26
|
+
.toRoot()
|
|
27
|
+
.apply(molstar.StateTransforms.Data.Download, { url, isBinary: isBinaryStructureUrl(url) }, { state: { isGhost: true } });
|
|
28
|
+
const failures = [];
|
|
29
|
+
const watch = state.events.cell.stateUpdated.subscribe(({ ref, cell }) => {
|
|
30
|
+
if (ref === built.ref && cell.status === 'error') {
|
|
31
|
+
failures.push(cell.errorText?.replace(/^Error: /, '') ?? 'no data');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const raw = await commitDownload(built).finally(() => {
|
|
35
|
+
watch.unsubscribe();
|
|
36
|
+
});
|
|
37
|
+
if (!raw?.isOk) {
|
|
38
|
+
throw new Error(`Could not download ${url}: ${failures.at(-1) ?? 'no data'}`);
|
|
39
|
+
}
|
|
40
|
+
return raw;
|
|
41
|
+
}
|
|
12
42
|
/** Download or ingest a structure and parse it into a trajectory, with the
|
|
13
43
|
* format sniffed from the content or the url.
|
|
14
44
|
* Needs no renderer, so a headless plugin can run it to read sequences.
|
|
@@ -26,14 +56,16 @@ export async function parseStructureTrajectory({ plugin, data, url, }) {
|
|
|
26
56
|
}
|
|
27
57
|
else if (url !== undefined) {
|
|
28
58
|
parsedAs = structureFormatFromName(url);
|
|
29
|
-
raw = await
|
|
59
|
+
raw = await download(plugin, url);
|
|
30
60
|
}
|
|
31
61
|
else {
|
|
32
62
|
throw new Error('a structure needs either data or a url');
|
|
33
63
|
}
|
|
34
64
|
const trajectory = await parseTrajectory(plugin, raw, parsedAs);
|
|
35
65
|
if (!trajectory?.obj?.data.frameCount) {
|
|
36
|
-
|
|
66
|
+
// a plugin disposed mid-load fails the removal too, and the parse's own
|
|
67
|
+
// error is the one to report
|
|
68
|
+
await removeWithGhosts(plugin, await loadMolstar(), raw.ref).catch(() => { });
|
|
37
69
|
throw new Error(`No model could be read from ${url ?? 'the structure data'} as ${parsedAs}`);
|
|
38
70
|
}
|
|
39
71
|
return trajectory;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b,b as E,c as M,d as L}from"./chunk-UXGREKQA.js";import{E as p,G as m,a as c,c as x,e as A,f as U,g as w,h as F,j as B,k as d,t as a,u as k}from"./chunk-SB4F5EHZ.js";import{b as I}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=AddStructureDialog-
|
|
1
|
+
import{a as b,b as E,c as M,d as L}from"./chunk-UXGREKQA.js";import{eb as f}from"./chunk-JKKI7LFR.js";import{E as p,G as m,a as c,c as x,e as A,f as U,g as w,h as F,j as B,k as d,t as a,u as k}from"./chunk-SB4F5EHZ.js";import{b as I}from"./chunk-H74KBZLE.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as t,s as e,u as K}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";K();var Q=D(function({model:g,handleClose:h}){let[n,N]=t(),[l,V]=t(""),[u,W]=t(""),[o,q]=t("pdb"),[s,_]=t(""),[v,y]=t(),[G,C]=t(!1),[S,J]=t(!0),O=!!g.primaryStructure?.userProvidedTranscriptSequence,H=async()=>{C(!0),y(void 0);try{let r=o==="pdb"&&l?{pdbId:l}:o==="uniprot"&&u?{uniprotId:u}:o==="url"&&s?{url:s}:o==="file"&&n?{data:await M(n)}:void 0;if(r){let i=g.primaryStructure,z=S&&i?.userProvidedTranscriptSequence?{userProvidedTranscriptSequence:i.userProvidedTranscriptSequence,feature:i.feature,connectedViewId:i.connectedViewId}:{};g.addStructure({...r,...z}),h()}}catch(r){console.error(r),y(r)}finally{C(!1)}},P=l!==""&&!f(l),T=u!==""&&!b(u),j=o==="url"&&s!==""||o==="file"&&n!==void 0||o==="pdb"&&f(l)||o==="uniprot"&&b(u);return e.createElement(A,{open:!0,onClose:h,maxWidth:"sm",fullWidth:!0},e.createElement(F,null,"Add structure"),e.createElement(w,null,v?e.createElement(I,{error:v}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Add another structure to superpose on the existing structure(s)."),e.createElement(B,{component:"fieldset",sx:{mb:2}},e.createElement(k,{value:o,onChange:r=>{q(r.target.value)}},e.createElement(d,{value:"pdb",control:e.createElement(a,null),label:"PDB ID"}),e.createElement(d,{value:"uniprot",control:e.createElement(a,null),label:"UniProt ID (AlphaFold)"}),e.createElement(d,{value:"url",control:e.createElement(a,null),label:"URL"}),e.createElement(d,{value:"file",control:e.createElement(a,null),label:"File"}))),o==="pdb"?e.createElement(p,{fullWidth:!0,value:l,onChange:r=>{V(r.target.value.trim().toUpperCase())},label:"PDB ID (e.g. 1CRN)",placeholder:"Enter PDB ID",error:P,helperText:P?"A PDB ID is four characters beginning with a digit":void 0,sx:{mb:2}}):null,o==="uniprot"?e.createElement(p,{fullWidth:!0,value:u,onChange:r=>{W(r.target.value.trim().toUpperCase())},label:"UniProt ID (e.g. P04637)",placeholder:"Enter UniProt ID",error:T,helperText:T?E:"Fetches the AlphaFold predicted structure",sx:{mb:2}}):null,o==="url"?e.createElement(p,{fullWidth:!0,label:"Structure URL",value:s,onChange:r=>{_(r.target.value.trim())},placeholder:"https://files.rcsb.org/download/1CRN.cif",sx:{mb:2}}):null,o==="file"?e.createElement("div",{style:{marginBottom:16}},e.createElement(c,{variant:"outlined",component:"label"},n?n.name:"Choose file",e.createElement("input",{type:"file",hidden:!0,accept:L,onChange:({target:r})=>{let i=r.files?.[0];i&&N(i)}})),n?e.createElement(m,{variant:"body2",sx:{mt:1}},"Selected: ",n.name):null):null,O?e.createElement(d,{control:e.createElement(x,{checked:S,onChange:r=>{J(r.target.checked)}}),label:"Map to the same transcript as the first structure (alignment, hover and click linked to the genome)"}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mt:1}},"Tip: Structures will be automatically superposed using TM-align. For manual control, use the Mol* controls (\u{1F527} wrench icon).")),e.createElement(U,null,e.createElement(c,{onClick:h},"Cancel"),e.createElement(c,{onClick:()=>{H()},variant:"contained",color:"primary",disabled:!j||G},"Add structure")))}),te=Q;export{te as default};
|
|
2
|
+
//# sourceMappingURL=AddStructureDialog-6CWM5DGW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=AlphaMissensePathogenicityAdapter-
|
|
1
|
+
import{a as i}from"./chunk-INWFM3CY.js";import{a as n}from"./chunk-7B4IRZLD.js";import{a as s}from"./chunk-HNO3QZD6.js";import{k as o,l as r}from"./chunk-Y5T7GSKP.js";import"./chunk-XBJKSIMP.js";var a=class extends n{async loadFeatures(){return i(await s(this.getConf("location")).readFile("utf8"))}featureData(t,e){return{...t,refName:e,source:t.variant}}async getGlobalStats(t){let e=(await this.loadData()).map(p=>p.score);return{scoreMin:r(e),scoreMax:o(e)}}async getMultiRegionFeatureDensityStats(t){return{featureDensity:0}}async getSources(){return[...new Set((await this.loadData()).map(e=>e.variant))].map(e=>({name:e,__name:e}))}};export{a as default};
|
|
2
|
+
//# sourceMappingURL=AlphaMissensePathogenicityAdapter-JCHDJ5CZ.js.map
|
package/dist/chunks/{GenomeTrackColorDialog-EJZ5KTKX.js → GenomeTrackColorDialog-G3RPUVPX.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=GenomeTrackColorDialog-
|
|
1
|
+
import{a as _}from"./chunk-NCH7IJII.js";import{c as C}from"./chunk-F65VCIGM.js";import"./chunk-46MRJY2F.js";import{g as A,h as F}from"./chunk-Y5T7GSKP.js";import{d as M}from"./chunk-LGVXT66Y.js";import{d as E}from"./chunk-THJLCDMW.js";import{E as b,G as V,a as T,e as N,f as B,g as P,h as W,r as g}from"./chunk-SB4F5EHZ.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as f,s as t,u as O}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";O();var y=["#d7191c","#fdae61","#abd9e9","#2c7bb6"],q={2:["#d7191c","#2c7bb6"],3:["#d7191c","#fdae61","#abd9e9"],4:y};function L(i){let n=q[i];if(n)return n;let r=E({field:"palette",scale:"linear",domainMin:0,domainMax:1,range:y});return Array.from({length:Math.max(i,1)},(s,l)=>r(i>1?l/(i-1):0)??y[0])}function j(i){let n=i.split(/[\s,;]+/).filter(Boolean).map(Number);return n.length>0&&n.every((r,s)=>Number.isFinite(r)&&(s===0||r>n[s-1]))?n:void 0}var z={mean:"Mean of the three bases",max:"Highest of the three bases",min:"Lowest of the three bases",count:"How many features fall on the codon"},Q=new Set(["QuantitativeTrack","VariantTrack","FeatureTrack"]),X=D(function({model:n,handleClose:r}){let s=A(n),l=n.structures.find(e=>e.connectedView)?.connectedView?.assemblyNames[0],p=l?s.assemblyManager.get(l):void 0,v=new Set([...l?[l]:[],...p?[p.name,...p.aliases]:[]]),x=s.tracks.filter(e=>Q.has(e.type)).filter(e=>{let a=_(s,e);return a!==void 0&&(v.size===0||M(a,"assemblyNames").some(d=>v.has(d)))}).map(e=>({trackId:e.trackId,name:F(e,s)})).toSorted((e,a)=>e.name.localeCompare(a.name)),{color:o}=n,[m,G]=f(o.field==="track"?o.trackId??"":""),[u,H]=f(o.field==="track"?o.stat??"mean":"mean"),[c,J]=f(o.field==="track"&&o.scale==="threshold"?"threshold":"linear"),[S,K]=f(o.field==="track"&&o.domain?o.domain.join(", "):""),h=j(S),k=c==="threshold"&&!h;return t.createElement(N,{open:!0,onClose:r,maxWidth:"sm",fullWidth:!0},t.createElement(W,null,"Color by a genome track"),t.createElement(P,null,t.createElement(V,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Each residue takes the track's scores under its codon on the genome view's assembly",l?` (${l})`:"","."," ",u==="count"?"A residue no feature falls on reads 0.":"Residues with no score are grey."),t.createElement(b,{select:!0,fullWidth:!0,label:"Track",value:m,onChange:e=>{G(e.target.value)},helperText:x.length===0?"This session has no quantitative, variant or feature track on the genome view\u2019s assembly":void 0,sx:{mb:2}},x.map(e=>t.createElement(g,{key:e.trackId,value:e.trackId},e.name))),t.createElement(b,{select:!0,fullWidth:!0,label:"Score per residue",value:u,onChange:e=>{let a=C.find(d=>d===e.target.value);a&&H(a)}},C.map(e=>t.createElement(g,{key:e,value:e},z[e]))),t.createElement(b,{select:!0,fullWidth:!0,label:"Scale",value:c,onChange:e=>{J(e.target.value)},sx:{mt:2}},t.createElement(g,{value:"linear"},"Continuous, light to dark"),t.createElement(g,{value:"threshold"},"Thresholds")),c==="threshold"?t.createElement(b,{fullWidth:!0,label:"Cuts, lowest first",placeholder:"-1.328, -0.748",value:S,error:k,helperText:k?"Numbers, each above the last":"Red below the first cut, blue above the last",onChange:e=>{K(e.target.value)},sx:{mt:2}}):null),t.createElement(B,null,t.createElement(T,{onClick:r},"Cancel"),t.createElement(T,{variant:"contained",disabled:!m||k,onClick:()=>{let e=o.field==="track"&&o.trackId===m,a=e&&o.scale==="threshold"==(c==="threshold")?o:void 0,d=e&&u!=="count"?o.scoreField:void 0,w=e?o.filter:void 0,I=a?.range?.length===(h?.length??0)+1;n.setColor(c==="threshold"&&h?{...a,field:"track",trackId:m,stat:u,scoreField:d,filter:w,scale:c,domain:h,range:I?a.range:L(h.length+1),labels:I?a.labels:void 0}:{...a,field:"track",trackId:m,stat:u,scoreField:d,filter:w}),r()}},"Color")))}),re=X;export{re as default};
|
|
2
|
+
//# sourceMappingURL=GenomeTrackColorDialog-G3RPUVPX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=HelpDialog-
|
|
1
|
+
import{a as h}from"./chunk-LQ6SZ6DD.js";import{G as t,a as r,f as s,g as a,i as l}from"./chunk-SB4F5EHZ.js";import"./chunk-CFGPSBOM.js";import{a as i}from"./chunk-H74KBZLE.js";import{a as n}from"./chunk-BWRMG55K.js";import"./chunk-R3GQXMDR.js";import{s as e,u as p}from"./chunk-INAB36B4.js";import"./chunk-XBJKSIMP.js";p();var u="https://github.com/GMOD/jbrowse-plugin-protein3d/issues",d=n(function({handleClose:o}){return e.createElement(i,{open:!0,maxWidth:"lg",onClose:o,title:"Help"},e.createElement(a,null,e.createElement(t,{sx:{mb:2}},"Each tab finds a structure a different way. All of them end in the same place: the plugin aligns the structure's residues to the protein sequence it translates from the transcript you pick, and that alignment maps genome coordinates onto positions in the 3D view."),e.createElement(t,{component:"div"},e.createElement("ul",null,e.createElement("li",null,e.createElement("b",null,"Structures for the gene")," resolves the feature to a UniProt entry, shown in the bar at the top (",e.createElement("i",null,"Change")," picks another), and lists every structure found for it: AlphaFold's model, the experimental PDB entries RCSB aligns to the entry, and the complexes AlphaFold DB predicted with other proteins. The list is grouped by what each structure shows: the protein on its own, the protein with another protein, and short fragments. Check several rows to open them in one view, superposed onto the first; a short fragment opens on its own. ",e.createElement("i",null,"Open by PDB ID")," opens any entry instead. When this site lists its own structures for the gene, in a dataset its configuration names, they lead the list under the dataset's name and the first is checked, mapped through the transcript it was folded from."),e.createElement("li",null,e.createElement("b",null,"Similar structures (Foldseek)")," sends the protein sequence to the foldseek.com servers and lists structures similar in shape, including ones with little sequence similarity."),e.createElement("li",null,e.createElement("b",null,"Your file or URL")," opens a structure you already have \u2014 the output of ColabFold or another modelling tool, or any PDB/mmCIF file reachable by URL."))),e.createElement(t,{sx:{mb:2}},"The transcript list ranks the isoforms against the first checked structure, marking which match its residues exactly and counting identical residues for the rest. You do not need an exact match; the alignment absorbs the differences between the two representations."),e.createElement(t,null,"If a gene will not resolve, or something looks wrong, please open an issue at"," ",e.createElement(h,{href:u},"github.com/GMOD/jbrowse-plugin-protein3d"),".")),e.createElement(l,null),e.createElement(s,null,e.createElement(r,{onClick:o,color:"primary"},"Close")))}),w=d;export{w as default};
|
|
2
|
+
//# sourceMappingURL=HelpDialog-MSZSJO5F.js.map
|