pdbe-molstar 3.4.0 → 3.6.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.
Files changed (73) hide show
  1. package/build/pdbe-molstar-component.js +2 -2
  2. package/build/pdbe-molstar-light.css +2 -2
  3. package/build/pdbe-molstar-plugin.js +2 -2
  4. package/build/pdbe-molstar-plugin.js.LICENSE.txt +26 -1
  5. package/build/pdbe-molstar.css +2 -2
  6. package/lib/alphafold-transparency.js +5 -6
  7. package/lib/custom-events.js +1 -1
  8. package/lib/domain-annotations/behavior.d.ts +1 -1
  9. package/lib/domain-annotations/color.js +2 -2
  10. package/lib/domain-annotations/prop.js +1 -2
  11. package/lib/extensions/complexes/coloring.d.ts +40 -0
  12. package/lib/extensions/complexes/coloring.js +118 -0
  13. package/lib/extensions/complexes/index.d.ts +55 -0
  14. package/lib/extensions/complexes/index.js +123 -0
  15. package/lib/extensions/complexes/superpose-by-biggest-chain.d.ts +17 -0
  16. package/lib/extensions/complexes/superpose-by-biggest-chain.js +135 -0
  17. package/lib/extensions/foldseek/index.d.ts +1 -1
  18. package/lib/extensions/foldseek/index.js +7 -7
  19. package/lib/extensions/interactions/index.d.ts +36 -0
  20. package/lib/extensions/interactions/index.js +112 -0
  21. package/lib/extensions/state-gallery/behavior.d.ts +1 -1
  22. package/lib/extensions/state-gallery/config.js +2 -2
  23. package/lib/extensions/state-gallery/manager.js +5 -4
  24. package/lib/extensions/state-gallery/ui.js +12 -12
  25. package/lib/helpers.d.ts +8 -0
  26. package/lib/helpers.js +175 -81
  27. package/lib/labels.d.ts +1 -1
  28. package/lib/loci-details.js +4 -5
  29. package/lib/plugin-custom-state.js +2 -2
  30. package/lib/sifts-mapping.js +1 -2
  31. package/lib/sifts-mappings-behaviour.d.ts +1 -1
  32. package/lib/spec-from-html.js +1 -2
  33. package/lib/spec.d.ts +1 -1
  34. package/lib/spec.js +3 -3
  35. package/lib/styles/pdbe-molstar/_index.scss +7 -7
  36. package/lib/styles/pdbe-molstar-dark.scss +2 -2
  37. package/lib/styles/pdbe-molstar-light.scss +2 -2
  38. package/lib/subscribe-events.js +1 -2
  39. package/lib/superposition-export.js +1 -2
  40. package/lib/superposition-focus-representation.d.ts +2 -2
  41. package/lib/superposition-focus-representation.js +1 -1
  42. package/lib/superposition-sifts-mapping.js +1 -2
  43. package/lib/superposition.d.ts +1 -1
  44. package/lib/superposition.js +34 -39
  45. package/lib/ui/alphafold-superposition.js +6 -6
  46. package/lib/ui/annotation-controls.d.ts +1 -1
  47. package/lib/ui/annotation-controls.js +2 -2
  48. package/lib/ui/annotation-row-controls.js +3 -3
  49. package/lib/ui/custom-controls.js +1 -1
  50. package/lib/ui/export-superposition.d.ts +0 -1
  51. package/lib/ui/export-superposition.js +1 -1
  52. package/lib/ui/icons.js +1 -1
  53. package/lib/ui/left-panel/core.d.ts +0 -1
  54. package/lib/ui/left-panel/core.js +5 -6
  55. package/lib/ui/left-panel/pdbe-left-panel.d.ts +0 -1
  56. package/lib/ui/left-panel/tabs.d.ts +1 -1
  57. package/lib/ui/left-panel/tabs.js +2 -2
  58. package/lib/ui/overlay.js +3 -4
  59. package/lib/ui/pdbe-screenshot-controls.js +4 -4
  60. package/lib/ui/pdbe-structure-controls.js +3 -3
  61. package/lib/ui/pdbe-viewport-controls.js +3 -4
  62. package/lib/ui/pdbe-viewport.d.ts +5 -2
  63. package/lib/ui/pdbe-viewport.js +24 -3
  64. package/lib/ui/segment-tree.js +40 -45
  65. package/lib/ui/split-ui/components.d.ts +1 -2
  66. package/lib/ui/split-ui/components.js +2 -2
  67. package/lib/ui/split-ui/split-ui.js +6 -7
  68. package/lib/ui/superposition-components.js +16 -21
  69. package/lib/ui/symmetry-annotation-controls.d.ts +4 -4
  70. package/lib/ui/symmetry-annotation-controls.js +18 -25
  71. package/lib/viewer.d.ts +31 -3
  72. package/lib/viewer.js +54 -40
  73. package/package.json +4 -4
@@ -72,34 +72,29 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
72
72
  (_a = customState.events) === null || _a === void 0 ? void 0 : _a.isBusy.next(true);
73
73
  const visualEntites = (type === 'ligands') ? this.state.ligGroups : this.state.carbGroups;
74
74
  setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
75
- var _b, e_1, _c, _d;
76
- var _e;
75
+ var _a, e_1, _b, _c;
76
+ var _d;
77
77
  try {
78
- for (var _f = true, visualEntites_1 = tslib_1.__asyncValues(visualEntites), visualEntites_1_1; visualEntites_1_1 = yield visualEntites_1.next(), _b = visualEntites_1_1.done, !_b;) {
79
- _d = visualEntites_1_1.value;
80
- _f = false;
81
- try {
82
- const visualEntity = _d;
83
- this.plugin.managers.structure.hierarchy.toggleVisibility(visualEntity, action);
84
- }
85
- finally {
86
- _f = true;
87
- }
78
+ for (var _e = true, visualEntites_1 = tslib_1.__asyncValues(visualEntites), visualEntites_1_1; visualEntites_1_1 = yield visualEntites_1.next(), _a = visualEntites_1_1.done, !_a; _e = true) {
79
+ _c = visualEntites_1_1.value;
80
+ _e = false;
81
+ const visualEntity = _c;
82
+ this.plugin.managers.structure.hierarchy.toggleVisibility(visualEntity, action);
88
83
  }
89
84
  }
90
85
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
91
86
  finally {
92
87
  try {
93
- if (!_f && !_b && (_c = visualEntites_1.return)) yield _c.call(visualEntites_1);
88
+ if (!_e && !_a && (_b = visualEntites_1.return)) yield _b.call(visualEntites_1);
94
89
  }
95
90
  finally { if (e_1) throw e_1.error; }
96
91
  }
97
92
  ;
98
- (_e = customState.events) === null || _e === void 0 ? void 0 : _e.isBusy.next(false);
93
+ (_d = customState.events) === null || _d === void 0 ? void 0 : _d.isBusy.next(false);
99
94
  }));
100
95
  };
101
96
  this.showHideAllControls = (type) => {
102
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, Object.assign({ icon: icons_1.CheckSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'show', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Show all ${type}`, disabled: false }, { children: "All" })), (0, jsx_runtime_1.jsx)(common_1.Button, Object.assign({ icon: icons_1.CloseSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'hide', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Hide all ${type}`, disabled: false }, { children: "None" }))] });
97
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CheckSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'show', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Show all ${type}`, disabled: false, children: "All" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: (e) => this.toggleVisible(e, 'hide', type), style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: `Hide all ${type}`, disabled: false, children: "None" })] });
103
98
  };
104
99
  this.clearLigSearch = (e) => {
105
100
  e.preventDefault();
@@ -128,7 +123,7 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
128
123
  const title = (type === 'ligands') ? 'Ligand' : 'Carbohydrates';
129
124
  const visibleVisuals = (type === 'ligands') ? this.state.ligGroups.length : this.state.carbGroups.length;
130
125
  const totalVisuals = (type === 'ligands') ? this.state.componentGroups.ligGroups.length : this.state.componentGroups.carbGroups.length;
131
- return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-flex-row', style: { marginTop: '6px' } }, { children: [(0, jsx_runtime_1.jsxs)("button", Object.assign({ className: 'msp-form-control msp-control-button-label msp-transform-header-brand-gray', style: { textAlign: 'left' }, onClick: (e) => this.collapseSection(e, type) }, { children: [(0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)("strong", { children: title }) }), (0, jsx_runtime_1.jsxs)("small", Object.assign({ style: { color: '#7d91b0' } }, { children: [" ( ", visibleVisuals, visibleVisuals < totalVisuals ? ` / ${totalVisuals}` : '', " )"] }))] })), visibleVisuals > 1 && showHideAllControls] }));
126
+ return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', style: { marginTop: '6px' }, children: [(0, jsx_runtime_1.jsxs)("button", { className: 'msp-form-control msp-control-button-label msp-transform-header-brand-gray', style: { textAlign: 'left' }, onClick: (e) => this.collapseSection(e, type), children: [(0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)("strong", { children: title }) }), (0, jsx_runtime_1.jsxs)("small", { style: { color: '#7d91b0' }, children: [" ( ", visibleVisuals, visibleVisuals < totalVisuals ? ` / ${totalVisuals}` : '', " )"] })] }), visibleVisuals > 1 && showHideAllControls] });
132
127
  };
133
128
  }
134
129
  componentDidMount() {
@@ -200,11 +195,11 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
200
195
  this.setState({ componentGroups: componentGroupsVal, ligGroups: componentGroupsVal.ligGroups, carbGroups: componentGroupsVal.carbGroups, ligSearchText: '', carbSearchText: '' });
201
196
  }
202
197
  render() {
203
- const ligSearchControls = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-mapped-parameter-group', style: { fontSize: '90%' } }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' } }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'msp-control-row-label' }, { children: "Search Ligand" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-row-ctrl' }, { children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.ligInputStream.next(e.target.value), value: this.state.ligSearchText, maxLength: 3 }) }))] })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearLigSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.ligSearchText === '' || this.state.isBusy, toggleState: this.state.ligSearchText !== '', title: 'Clear search input' })] }));
204
- const carbSearchControls = (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-mapped-parameter-group', style: { fontSize: '90%' } }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' } }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'msp-control-row-label' }, { children: "Search Carbohydrate" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-row-ctrl' }, { children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.carbInputStream.next(e.target.value), value: this.state.carbSearchText, maxLength: 3 }) }))] })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearCarbSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.carbSearchText === '' || this.state.isBusy, toggleState: this.state.carbSearchText !== '', title: 'Clear search input' })] }));
198
+ const ligSearchControls = (0, jsx_runtime_1.jsxs)("div", { className: 'msp-mapped-parameter-group', style: { fontSize: '90%' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search Ligand" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.ligInputStream.next(e.target.value), value: this.state.ligSearchText, maxLength: 3 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearLigSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.ligSearchText === '' || this.state.isBusy, toggleState: this.state.ligSearchText !== '', title: 'Clear search input' })] });
199
+ const carbSearchControls = (0, jsx_runtime_1.jsxs)("div", { className: 'msp-mapped-parameter-group', style: { fontSize: '90%' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search Carbohydrate" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: e => this.carbInputStream.next(e.target.value), value: this.state.carbSearchText, maxLength: 3 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearCarbSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.carbSearchText === '' || this.state.isBusy, toggleState: this.state.carbSearchText !== '', title: 'Clear search input' })] });
205
200
  const ligSectionHeader = this.sectionHeader('ligands');
206
201
  const carbSectionHeader = this.sectionHeader('carbohydrates');
207
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(this.state.componentGroups.nonLigGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.nonLigGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true }, g[0].cell.transform.ref)) }), (this.state.componentGroups.alphafold.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.alphafold.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true, type: 'alphafold' }, g[0].cell.transform.ref)) }), (this.state.componentGroups.ligGroups.length > 0) && ligSectionHeader, (!this.state.isLigCollapsed && this.state.componentGroups.ligGroups.length > 5) && ligSearchControls, (this.state.componentGroups.ligGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' } }, { children: !this.state.isLigCollapsed && this.state.ligGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) })), (this.state.componentGroups.carbGroups.length > 0) && carbSectionHeader, (!this.state.isCarbCollapsed && this.state.componentGroups.carbGroups.length > 5) && carbSearchControls, (this.state.componentGroups.carbGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' } }, { children: !this.state.isCarbCollapsed && this.state.carbGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) }))] });
202
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(this.state.componentGroups.nonLigGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.nonLigGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true }, g[0].cell.transform.ref)) }), (this.state.componentGroups.alphafold.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.alphafold.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true, type: 'alphafold' }, g[0].cell.transform.ref)) }), (this.state.componentGroups.ligGroups.length > 0) && ligSectionHeader, (!this.state.isLigCollapsed && this.state.componentGroups.ligGroups.length > 5) && ligSearchControls, (this.state.componentGroups.ligGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' }, children: !this.state.isLigCollapsed && this.state.ligGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) }), (this.state.componentGroups.carbGroups.length > 0) && carbSectionHeader, (!this.state.isCarbCollapsed && this.state.componentGroups.carbGroups.length > 5) && carbSearchControls, (this.state.componentGroups.carbGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' }, children: !this.state.isCarbCollapsed && this.state.carbGroups.map((g) => (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref)) })] });
208
203
  }
209
204
  }
210
205
  class StructureComponentGroup extends base_1.PurePluginUIComponent {
@@ -298,7 +293,7 @@ class StructureComponentGroup extends base_1.PurePluginUIComponent {
298
293
  const cell = component.cell;
299
294
  const label = (_a = cell.obj) === null || _a === void 0 ? void 0 : _a.label;
300
295
  const labelEle = this.props.boldHeader ? (0, jsx_runtime_1.jsx)("strong", { children: label }) : label;
301
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'msp-flex-row' }, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, Object.assign({ noOverflow: true, className: 'msp-control-button-label', title: `${label} - Click to focus.`, onClick: this.focus, style: { textAlign: 'left' }, disabled: this.state.isBusy }, { children: labelEle })), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: `${this.state.isHidden ? 'Show' : 'Hide'} component`, small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: icons_1.MoreHorizSvg, onClick: this.toggleAction, title: 'Actions', toggleState: this.state.action === 'action', className: 'msp-form-control', flex: true })] })), this.state.action === 'action' && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-accent-offset' }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { marginBottom: '6px' } }, { children: component.representations.map(r => (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: this.props.group, representation: r }, r.cell.transform.ref)) })) }))] });
296
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: `${label} - Click to focus.`, onClick: this.focus, style: { textAlign: 'left' }, disabled: this.state.isBusy, children: labelEle }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: `${this.state.isHidden ? 'Show' : 'Hide'} component`, small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: icons_1.MoreHorizSvg, onClick: this.toggleAction, title: 'Actions', toggleState: this.state.action === 'action', className: 'msp-form-control', flex: true })] }), this.state.action === 'action' && (0, jsx_runtime_1.jsx)("div", { className: 'msp-accent-offset', children: (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: '6px' }, children: component.representations.map(r => (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: this.props.group, representation: r }, r.cell.transform.ref)) }) })] });
302
297
  }
303
298
  }
304
299
  class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
@@ -398,6 +393,6 @@ class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
398
393
  if (reprObj.tags && reprObj.tags.indexOf('af-superposition-visual') >= 0)
399
394
  isAlphafold = true;
400
395
  }
401
- return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: repr.parent && (0, jsx_runtime_1.jsxs)("div", { children: [(clusterSelectArr.length > 2 && !isSurrVisual && !isAlphafold) && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: clusterOptions, values: this.state.clusterVal, onChangeValues: this.selectCluster, isDisabled: this.state.isBusy }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { type: (_a = repr.params) === null || _a === void 0 ? void 0 : _a.definition.type }, values: { type: (_b = repr.params) === null || _b === void 0 ? void 0 : _b.values.type }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { colorTheme: (_c = repr.params) === null || _c === void 0 ? void 0 : _c.definition.colorTheme }, values: { colorTheme: (_d = repr.params) === null || _d === void 0 ? void 0 : _d.values.colorTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-representation-entry' }, { children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { sizeTheme: (_e = repr.params) === null || _e === void 0 ? void 0 : _e.definition.sizeTheme }, values: { sizeTheme: (_f = repr.params) === null || _f === void 0 ? void 0 : _f.values.sizeTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }))] }) }));
396
+ return (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: repr.parent && (0, jsx_runtime_1.jsxs)("div", { children: [(clusterSelectArr.length > 2 && !isSurrVisual && !isAlphafold) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: clusterOptions, values: this.state.clusterVal, onChangeValues: this.selectCluster, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { type: (_a = repr.params) === null || _a === void 0 ? void 0 : _a.definition.type }, values: { type: (_b = repr.params) === null || _b === void 0 ? void 0 : _b.values.type }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { colorTheme: (_c = repr.params) === null || _c === void 0 ? void 0 : _c.definition.colorTheme }, values: { colorTheme: (_d = repr.params) === null || _d === void 0 ? void 0 : _d.values.colorTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { sizeTheme: (_e = repr.params) === null || _e === void 0 ? void 0 : _e.definition.sizeTheme }, values: { sizeTheme: (_f = repr.params) === null || _f === void 0 ? void 0 : _f.values.sizeTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })] }) });
402
397
  }
403
398
  }
@@ -9,8 +9,8 @@ declare const DefaultSymmetryParams: {
9
9
  on: PD.BooleanParam;
10
10
  /** Index of the currently selected symmetry (in case there a more symmetries for an assembly), regardless of whether visibility is on of off */
11
11
  symmetryIndex: PD.Select<number>;
12
- /** `true` if symmetry data have been retrieved but do not contain any non-trivial symmetry */
13
- noSymmetries: PD.BooleanParam;
12
+ /** `true` if visibility is on and symmetry data have been retrieved and contain at least one non-trivial symmetry. */
13
+ hasSymmetries: PD.BooleanParam;
14
14
  };
15
15
  type SymmetryParams = typeof DefaultSymmetryParams;
16
16
  type SymmetryProps = PD.ValuesFor<SymmetryParams>;
@@ -25,8 +25,8 @@ export declare class SymmetryAnnotationControls extends PurePluginUIComponent<{}
25
25
  componentDidMount(): void;
26
26
  /** Synchronize parameters and values in UI with real parameters currently applied in `AssemblySymmetryProvider` */
27
27
  syncParams(): void;
28
- /** Return `true` if symmetry data have been retrieved and do not contain any non-trivial symmetry. */
29
- noSymmetriesAvailable(): boolean;
28
+ /** Return `true` if symmetry data have been retrieved and contain at least one non-trivial symmetry. */
29
+ hasSymmetriesAvailable(): boolean;
30
30
  /** Get the first loaded structure, if any. */
31
31
  getPivotStructure(): StructureRef | undefined;
32
32
  /** Get parameters currently applied in `AssemblySymmetryProvider` */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAssemblySymmetryAnnotationApplicable = exports.SymmetryAnnotationControls = void 0;
3
+ exports.SymmetryAnnotationControls = void 0;
4
+ exports.isAssemblySymmetryAnnotationApplicable = isAssemblySymmetryAnnotationApplicable;
4
5
  const tslib_1 = require("tslib");
5
6
  const jsx_runtime_1 = require("react/jsx-runtime");
6
7
  const behavior_1 = require("molstar/lib/extensions/assembly-symmetry/behavior");
@@ -15,8 +16,8 @@ const DefaultSymmetryParams = {
15
16
  on: param_definition_1.ParamDefinition.Boolean(false, { isHidden: true }),
16
17
  /** Index of the currently selected symmetry (in case there a more symmetries for an assembly), regardless of whether visibility is on of off */
17
18
  symmetryIndex: param_definition_1.ParamDefinition.Select(0, [[0, 'Auto']]),
18
- /** `true` if symmetry data have been retrieved but do not contain any non-trivial symmetry */
19
- noSymmetries: param_definition_1.ParamDefinition.Boolean(false, { isHidden: true }),
19
+ /** `true` if visibility is on and symmetry data have been retrieved and contain at least one non-trivial symmetry. */
20
+ hasSymmetries: param_definition_1.ParamDefinition.Boolean(false, { isHidden: true }),
20
21
  };
21
22
  const DefaultSymmetryControlsState = {
22
23
  params: DefaultSymmetryParams,
@@ -54,21 +55,21 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
54
55
  /** Synchronize parameters and values in UI with real parameters currently applied in `AssemblySymmetryProvider` */
55
56
  syncParams() {
56
57
  if (this.hasAssemblySymmetry3D()) {
57
- const noSymmetries = this.noSymmetriesAvailable();
58
+ const hasSymmetries = this.hasSymmetriesAvailable();
58
59
  const realParams = this.getRealParams();
59
60
  const realValues = this.getRealValues();
60
- const options = noSymmetries ?
61
- [[0, 'None']]
62
- : realParams.symmetryIndex.options.filter(([index, label]) => index >= 0); // Removing the 'off' option (having index -1)
61
+ const options = hasSymmetries ?
62
+ realParams.symmetryIndex.options.filter(([index, label]) => index >= 0) // Removing the 'off' option (having index -1)
63
+ : [[0, 'None']];
63
64
  const params = Object.assign(Object.assign({}, this.state.params), { symmetryIndex: param_definition_1.ParamDefinition.Select(0, options) });
64
65
  const values = (realValues.symmetryIndex >= 0) ? {
65
66
  on: true,
66
67
  symmetryIndex: realValues.symmetryIndex,
67
- noSymmetries: noSymmetries,
68
+ hasSymmetries,
68
69
  } : {
69
70
  on: false,
70
71
  symmetryIndex: this.state.values.symmetryIndex,
71
- noSymmetries: noSymmetries,
72
+ hasSymmetries,
72
73
  };
73
74
  this.setState({ params, values });
74
75
  }
@@ -79,12 +80,12 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
79
80
  });
80
81
  }
81
82
  }
82
- /** Return `true` if symmetry data have been retrieved and do not contain any non-trivial symmetry. */
83
- noSymmetriesAvailable() {
83
+ /** Return `true` if symmetry data have been retrieved and contain at least one non-trivial symmetry. */
84
+ hasSymmetriesAvailable() {
84
85
  var _a, _b;
85
86
  const structure = (_b = (_a = this.getPivotStructure()) === null || _a === void 0 ? void 0 : _a.cell.obj) === null || _b === void 0 ? void 0 : _b.data;
86
87
  const symmetryData = structure && prop_1.AssemblySymmetryDataProvider.get(structure).value;
87
- return symmetryData !== undefined && symmetryData.filter(sym => sym.symbol !== 'C1').length === 0;
88
+ return symmetryData !== undefined && symmetryData.filter(sym => sym.symbol !== 'C1').length > 0;
88
89
  }
89
90
  /** Get the first loaded structure, if any. */
90
91
  getPivotStructure() {
@@ -145,8 +146,8 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
145
146
  }
146
147
  /** Run changes needed to change parameter values, and set UI accordingly */
147
148
  changeParamValues(values) {
148
- var _a;
149
149
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
150
+ var _a;
150
151
  const struct = this.getPivotStructure();
151
152
  if (!struct)
152
153
  return;
@@ -201,20 +202,13 @@ class SymmetryAnnotationControls extends base_1.PurePluginUIComponent {
201
202
  });
202
203
  }
203
204
  render() {
204
- const shortTitle = 'Assembly Symmetry' + (this.state.values.noSymmetries ? ' [Not Available]' : '');
205
- const title = 'Assembly Symmetry' + (this.state.values.noSymmetries ? ' [Not Available]\nSymmetry information for this assembly is not available' : '');
206
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(SymmetryAnnotationRowControls, { shortTitle: shortTitle, title: title, applied: this.state.values.on, onChangeApplied: applied => this.apply(applied), params: this.state.params, values: this.state.values, onChangeValues: v => this.changeParamValues(v) }) });
205
+ const notAvailable = this.state.values.on && !this.state.values.hasSymmetries;
206
+ const shortTitle = 'Assembly Symmetry' + (notAvailable ? ' [Not Available]' : '');
207
+ const title = 'Assembly Symmetry' + (notAvailable ? ' [Not Available]\nSymmetry information for this assembly is not available' : '');
208
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(annotation_row_controls_1.AnnotationRowControls, { shortTitle: shortTitle, title: title, applied: this.state.values.on, onChangeApplied: applied => this.apply(applied), params: this.state.params, values: this.state.values, onChangeValues: v => this.changeParamValues(v), errorMessage: !this.state.values.on ? 'First activate annotation to show options' : notAvailable ? 'Symmetry information not available' : undefined }) });
207
209
  }
208
210
  }
209
211
  exports.SymmetryAnnotationControls = SymmetryAnnotationControls;
210
- class SymmetryAnnotationRowControls extends annotation_row_controls_1.AnnotationRowControls {
211
- renderOptions() {
212
- if (this.props.values.noSymmetries) {
213
- return (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'msp-row-text' }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ title: 'Symmetry information for this assembly is not available' }, { children: "Symmetry information not available" })) }));
214
- }
215
- return super.renderOptions();
216
- }
217
- }
218
212
  /** Get the first loaded structure, if any. */
219
213
  function getPivotStructure(plugin) {
220
214
  return plugin.managers.structure.hierarchy.selection.structures[0];
@@ -229,4 +223,3 @@ function isAssemblySymmetryAnnotationApplicable(plugin) {
229
223
  // by `AssemblySymmetry.isApplicable = struct => struct?.units[0].conformation.operator.assembly !== undefined;`
230
224
  // But we cannot easily override the `fetch` function which calls the original `isApplicable`.
231
225
  }
232
- exports.isAssemblySymmetryAnnotationApplicable = isAssemblySymmetryAnnotationApplicable;
package/lib/viewer.d.ts CHANGED
@@ -1,11 +1,15 @@
1
- /// <reference types="react" />
1
+ import { loadMVS } from 'molstar/lib/extensions/mvs/load';
2
+ import { MVSData } from 'molstar/lib/extensions/mvs/mvs-data';
2
3
  import { Canvas3DProps } from 'molstar/lib/mol-canvas3d/canvas3d';
4
+ import { Mat3 } from 'molstar/lib/mol-math/linear-algebra';
3
5
  import { EmptyLoci } from 'molstar/lib/mol-model/loci';
4
6
  import { StructureElement } from 'molstar/lib/mol-model/structure';
5
7
  import { StructureRef } from 'molstar/lib/mol-plugin-state/manager/structure/hierarchy-state';
6
8
  import { PluginContext } from 'molstar/lib/mol-plugin/context';
7
9
  import { Color } from 'molstar/lib/mol-util/color/color';
10
+ import * as Complexes from './extensions/complexes';
8
11
  import * as Foldseek from './extensions/foldseek';
12
+ import * as Interactions from './extensions/interactions';
9
13
  import { StateGalleryManager } from './extensions/state-gallery/manager';
10
14
  import { StateGalleryControls } from './extensions/state-gallery/ui';
11
15
  import { LoadParams, QueryParam } from './helpers';
@@ -37,14 +41,14 @@ export declare class PDBeMolstarPlugin {
37
41
  format: string;
38
42
  isBinary: boolean;
39
43
  };
40
- get state(): import("molstar/lib/mol-state/state").State;
44
+ get state(): import("molstar/lib/mol-state").State;
41
45
  createLigandStructure(isBranched: boolean): Promise<void>;
42
46
  load({ url, format, isBinary, assemblyId, progressMessage, id }: LoadParams, fullLoad?: boolean): Promise<void>;
43
47
  /** Remove loaded structure(s).
44
48
  * `structureNumberOrId` is either index (numbered from 1!) or the ID that was provided when loading the structure.
45
49
  * If `structureNumberOrId` is undefined, remove all structures.
46
50
  * You will likely need to call `await this.visual.reset({ camera: true })` afterwards. */
47
- deleteStructure(structureNumberOrId?: number): Promise<void>;
51
+ deleteStructure(structureNumberOrId?: number | string): Promise<void>;
48
52
  /** Apply representations to structure components based on `styles`, also removing any existing representations.
49
53
  * Components not included in `styles` will keep their representations.
50
54
  * E.g. `styles={polymer:'putty',nonStandard:'ball-and-stick'}` - apply only putty to polymer, only ball-and-stick to non-standard residues, leave other components untouched.
@@ -179,6 +183,9 @@ export declare class PDBeMolstarPlugin {
179
183
  highlightColor?: boolean;
180
184
  selectColor?: boolean;
181
185
  }) => Promise<void>;
186
+ setViewDirection: (view: "front" | "back" | "right" | "left" | "top" | "bottom" | Mat3, options?: {
187
+ durationMs: number;
188
+ }) => Promise<void>;
182
189
  /** Change parameters of the plugin instance.
183
190
  * Can be used to load a different structure.
184
191
  * If `fullLoad`, remove currently loaded structure before loading the new one;
@@ -188,7 +195,27 @@ export declare class PDBeMolstarPlugin {
188
195
  clear(): Promise<void>;
189
196
  /** Helper functions related to specific views or use cases */
190
197
  static extensions: {
198
+ Complexes: typeof Complexes;
191
199
  Foldseek: typeof Foldseek;
200
+ Interactions: typeof Interactions;
201
+ MVS: {
202
+ MVSData: {
203
+ SupportedVersion: number;
204
+ fromMVSJ(mvsjString: string): MVSData;
205
+ toMVSJ(mvsData: MVSData, space?: string | number): string;
206
+ isValid(mvsData: MVSData, options?: {
207
+ noExtra?: boolean;
208
+ }): boolean;
209
+ validationIssues(mvsData: MVSData, options?: {
210
+ noExtra?: boolean;
211
+ }): string[] | undefined;
212
+ toPrettyString(mvsData: MVSData): string;
213
+ createBuilder(): import("molstar/lib/extensions/mvs/tree/mvs/mvs-builder").Root;
214
+ createMultistate(snapshots: import("molstar/lib/extensions/mvs/mvs-data").Snapshot[], metadata?: Pick<import("molstar/lib/extensions/mvs/mvs-data").GlobalMetadata, "title" | "description" | "description_format">): import("molstar/lib/extensions/mvs/mvs-data").MVSData_States;
215
+ stateToStates(state: import("molstar/lib/extensions/mvs/mvs-data").MVSData_State): import("molstar/lib/extensions/mvs/mvs-data").MVSData_States;
216
+ };
217
+ loadMVS: typeof loadMVS;
218
+ };
192
219
  StateGallery: {
193
220
  StateGalleryManager: typeof StateGalleryManager;
194
221
  StateGalleryCustomState: (plugin: PluginContext) => Partial<import("./extensions/state-gallery/behavior").StateGalleryCustomState>;
@@ -206,4 +233,5 @@ export declare class PDBeMolstarPlugin {
206
233
  readonly DefaultLeftPanelControls: import("react").ComponentClass<{}, any>;
207
234
  readonly DefaultRightPanelControls: typeof import("molstar/lib/mol-plugin-ui/plugin").ControlsWrapper;
208
235
  };
236
+ static MAIN_STRUCTURE_ID: string;
209
237
  }
package/lib/viewer.js CHANGED
@@ -8,7 +8,10 @@ const behavior_2 = require("molstar/lib/extensions/model-archive/quality-assessm
8
8
  const mp4_export_1 = require("molstar/lib/extensions/mp4-export");
9
9
  const behavior_3 = require("molstar/lib/extensions/mvs/behavior");
10
10
  const custom_tooltips_prop_1 = require("molstar/lib/extensions/mvs/components/custom-tooltips-prop");
11
+ const load_1 = require("molstar/lib/extensions/mvs/load");
12
+ const mvs_data_1 = require("molstar/lib/extensions/mvs/mvs-data");
11
13
  const pdbe_1 = require("molstar/lib/extensions/pdbe");
14
+ const linear_algebra_1 = require("molstar/lib/mol-math/linear-algebra");
12
15
  const loci_1 = require("molstar/lib/mol-model/loci");
13
16
  const structure_1 = require("molstar/lib/mol-model/structure");
14
17
  const assembly_unwind_1 = require("molstar/lib/mol-plugin-state/animation/built-in/assembly-unwind");
@@ -32,7 +35,6 @@ const structure_focus_representation_1 = require("molstar/lib/mol-plugin/behavio
32
35
  const transformers_1 = require("molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers");
33
36
  const commands_1 = require("molstar/lib/mol-plugin/commands");
34
37
  const config_1 = require("molstar/lib/mol-plugin/config");
35
- const layout_1 = require("molstar/lib/mol-plugin/layout");
36
38
  const spec_1 = require("molstar/lib/mol-plugin/spec");
37
39
  const mol_state_1 = require("molstar/lib/mol-state");
38
40
  const element_symbol_1 = require("molstar/lib/mol-theme/color/element-symbol");
@@ -41,7 +43,9 @@ const color_1 = require("molstar/lib/mol-util/color/color");
41
43
  const rx_event_helper_1 = require("molstar/lib/mol-util/rx-event-helper");
42
44
  const custom_events_1 = require("./custom-events");
43
45
  const behavior_4 = require("./domain-annotations/behavior");
46
+ const Complexes = tslib_1.__importStar(require("./extensions/complexes"));
44
47
  const Foldseek = tslib_1.__importStar(require("./extensions/foldseek"));
48
+ const Interactions = tslib_1.__importStar(require("./extensions/interactions"));
45
49
  const behavior_5 = require("./extensions/state-gallery/behavior");
46
50
  const manager_1 = require("./extensions/state-gallery/manager");
47
51
  const ui_1 = require("./extensions/state-gallery/ui");
@@ -177,8 +181,8 @@ class PDBeMolstarPlugin {
177
181
  * If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1!);
178
182
  * otherwise use the last added structure. */
179
183
  interactivityFocus: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
180
- var _b;
181
- const structureNumberOrId = (_b = params.structureId) !== null && _b !== void 0 ? _b : params.structureNumber;
184
+ var _a;
185
+ const structureNumberOrId = (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber;
182
186
  const loci = this.getLociForParams(params.data, structureNumberOrId);
183
187
  this.plugin.managers.structure.focus.setFromLoci(loci);
184
188
  }),
@@ -187,8 +191,8 @@ class PDBeMolstarPlugin {
187
191
  * If `focus`, also zoom on the highlighted part.
188
192
  * If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1!); otherwise use the last added structure. */
189
193
  highlight: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
190
- var _c;
191
- const loci = this.getLociForParams(params.data, (_c = params.structureId) !== null && _c !== void 0 ? _c : params.structureNumber);
194
+ var _a;
195
+ const loci = this.getLociForParams(params.data, (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber);
192
196
  if (loci_1.Loci.isEmpty(loci))
193
197
  return;
194
198
  if (params.color) {
@@ -211,17 +215,17 @@ class PDBeMolstarPlugin {
211
215
  * If `structureNumber` is provided, apply to the specified structure (numbered from 1!); otherwise apply to all loaded structures.
212
216
  * Remove any previously added coloring and extra representations, unless `keepColors` and/or `keepRepresentations` is set. */
213
217
  select: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
214
- var _d, _e, _f, _g;
215
- const structureNumberOrId = (_d = params.structureId) !== null && _d !== void 0 ? _d : params.structureNumber;
218
+ var _a, _b, _c, _d;
219
+ const structureNumberOrId = (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber;
216
220
  yield this.visual.clearSelection(structureNumberOrId, { keepColors: params.keepColors, keepRepresentations: params.keepRepresentations });
217
221
  // Structure list to apply selection
218
222
  const structures = this.getStructures(structureNumberOrId);
219
223
  // Filter selection items that apply added representations
220
224
  const addedReprParams = {};
221
225
  for (const param of params.data) {
222
- const repr = (_e = param.representation) !== null && _e !== void 0 ? _e : (param.sideChain ? 'ball-and-stick' : undefined);
226
+ const repr = (_b = param.representation) !== null && _b !== void 0 ? _b : (param.sideChain ? 'ball-and-stick' : undefined);
223
227
  if (repr) {
224
- ((_f = addedReprParams[repr]) !== null && _f !== void 0 ? _f : (addedReprParams[repr] = [])).push(param);
228
+ ((_c = addedReprParams[repr]) !== null && _c !== void 0 ? _c : (addedReprParams[repr] = [])).push(param);
225
229
  }
226
230
  }
227
231
  const DefaultSelectColor = color_1.Color.fromRgb(255, 112, 3);
@@ -265,7 +269,7 @@ class PDBeMolstarPlugin {
265
269
  yield this.plugin.build()
266
270
  .to(struct.structureRef.cell)
267
271
  .apply(model_1.StructureComponent, { type: { name: 'bundle', params: bundle }, label: repr }, { tags: helpers_1.Tags.AddedComponent })
268
- .apply(representation_1.StructureRepresentation3D, (0, structure_representation_params_1.createStructureRepresentationParams)(this.plugin, (_g = struct.structureRef.cell.obj) === null || _g === void 0 ? void 0 : _g.data, { type: repr }))
272
+ .apply(representation_1.StructureRepresentation3D, (0, structure_representation_params_1.createStructureRepresentationParams)(this.plugin, (_d = struct.structureRef.cell.obj) === null || _d === void 0 ? void 0 : _d.data, { type: repr }))
269
273
  .apply(transforms_1.StateTransforms.Representation.OverpaintStructureRepresentation3DFromBundle, { layers: overpaintLayers }, { tags: helpers_1.Tags.Overpaint })
270
274
  .commit();
271
275
  // Track that reprs have been added (for later clearSelection)
@@ -309,9 +313,9 @@ class PDBeMolstarPlugin {
309
313
  * `structureNumber` counts from 1; if not provided, tooltips will be applied to all loaded structures.
310
314
  * Example: `await this.visual.tooltips({ data: [{ struct_asym_id: 'A', tooltip: 'Chain A' }, { struct_asym_id: 'B', tooltip: 'Chain B' }] });`. */
311
315
  tooltips: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
312
- var _h;
316
+ var _a;
313
317
  // Structure list to apply tooltips
314
- const structures = this.getStructures((_h = params.structureId) !== null && _h !== void 0 ? _h : params.structureNumber);
318
+ const structures = this.getStructures((_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber);
315
319
  for (const struct of structures) {
316
320
  const selections = this.getSelections(params.data, struct.number);
317
321
  const customTooltipProps = {
@@ -389,6 +393,22 @@ class PDBeMolstarPlugin {
389
393
  yield commands_1.PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: { renderer, marking } });
390
394
  }
391
395
  }),
396
+ setViewDirection: (view, options) => tslib_1.__awaiter(this, void 0, void 0, function* () {
397
+ var _a;
398
+ const visibleSphere = (_a = this.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.boundingSphereVisible;
399
+ if (!visibleSphere)
400
+ return;
401
+ const rot = (0, helpers_1.getRotationMat4)(view);
402
+ const snapshot = this.plugin.canvas3d.camera.getFocus(visibleSphere.center, visibleSphere.radius);
403
+ // Need to force direction and up after getFocus (getFocus sometimes flips direction/up)
404
+ const newDir = linear_algebra_1.Vec3.create(0, 0, -1);
405
+ linear_algebra_1.Vec3.transformMat4(newDir, newDir, rot);
406
+ linear_algebra_1.Vec3.scale(newDir, newDir, linear_algebra_1.Vec3.distance(snapshot.position, snapshot.target));
407
+ snapshot.position = linear_algebra_1.Vec3.sub(newDir, snapshot.target, newDir);
408
+ const newUp = linear_algebra_1.Vec3.create(0, 1, 0);
409
+ snapshot.up = linear_algebra_1.Vec3.transformMat4(newUp, newUp, rot);
410
+ yield commands_1.PluginCommands.Camera.SetSnapshot(this.plugin, { snapshot, durationMs: options === null || options === void 0 ? void 0 : options.durationMs });
411
+ }),
392
412
  /** Change parameters of the plugin instance.
393
413
  * Can be used to load a different structure.
394
414
  * If `fullLoad`, remove currently loaded structure before loading the new one;
@@ -411,7 +431,10 @@ class PDBeMolstarPlugin {
411
431
  if (this.initParams.customData && this.initParams.customData.url && !this.initParams.customData.format)
412
432
  return false;
413
433
  (0, plugin_custom_state_1.PluginCustomState)(this.plugin).initParams = this.initParams;
434
+ // Update layout
435
+ commands_1.PluginCommands.Layout.Update(this.plugin, { state: (0, helpers_1.pluginLayoutStateFromInitParams)(this.initParams) });
414
436
  // Show/hide buttons in the viewport control panel
437
+ this.plugin.config.set(config_1.PluginConfig.Viewport.ShowScreenshotControls, !this.initParams.hideCanvasControls.includes('screenshot'));
415
438
  this.plugin.config.set(config_1.PluginConfig.Viewport.ShowExpand, !this.initParams.hideCanvasControls.includes('expand'));
416
439
  this.plugin.config.set(config_1.PluginConfig.Viewport.ShowControls, !this.initParams.hideCanvasControls.includes('controlToggle'));
417
440
  this.plugin.config.set(config_1.PluginConfig.Viewport.ShowSettings, !this.initParams.hideCanvasControls.includes('controlInfo'));
@@ -436,8 +459,8 @@ class PDBeMolstarPlugin {
436
459
  return (0, spec_from_html_1.initParamsFromHtmlAttributes)(element);
437
460
  }
438
461
  render(target, options) {
439
- var _a, _b;
440
462
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
463
+ var _a, _b;
441
464
  console.debug('Rendering PDBeMolstarPlugin instance with options:', options);
442
465
  // Validate options
443
466
  if (!options) {
@@ -468,17 +491,7 @@ class PDBeMolstarPlugin {
468
491
  pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(superposition_focus_representation_1.SuperpositionFocusRepresentation), spec_1.PluginSpec.Behavior(behavior_2.MAQualityAssessment, { autoAttach: true, showTooltip: true }));
469
492
  }
470
493
  pdbePluginSpec.layout = {
471
- initial: {
472
- isExpanded: this.initParams.expanded,
473
- showControls: !this.initParams.hideControls,
474
- regionState: {
475
- left: this.initParams.leftPanel ? 'full' : 'hidden',
476
- right: this.initParams.rightPanel ? 'full' : 'hidden',
477
- top: this.initParams.sequencePanel ? 'full' : 'hidden',
478
- bottom: this.initParams.logPanel ? 'full' : 'hidden',
479
- },
480
- controlsDisplay: this.initParams.reactive ? 'reactive' : this.initParams.landscape ? 'landscape' : layout_1.PluginLayoutStateParams.controlsDisplay.defaultValue,
481
- },
494
+ initial: (0, helpers_1.pluginLayoutStateFromInitParams)(this.initParams),
482
495
  };
483
496
  pdbePluginSpec.components = {
484
497
  controls: {
@@ -486,7 +499,7 @@ class PDBeMolstarPlugin {
486
499
  },
487
500
  viewport: {
488
501
  controls: pdbe_viewport_controls_1.PDBeViewportControls,
489
- view: pdbe_viewport_1.PDBeViewport,
502
+ view: pdbe_viewport_1.PDBeViewport_NoFullscreen,
490
503
  },
491
504
  remoteState: 'none',
492
505
  structureTools: this.initParams.superposition ? pdbe_structure_controls_1.PDBeSuperpositionStructureTools
@@ -514,6 +527,8 @@ class PDBeMolstarPlugin {
514
527
  pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(mp4_export_1.Mp4Export));
515
528
  pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(geo_export_1.GeometryExport));
516
529
  }
530
+ if (this.initParams.hideCanvasControls.includes('screenshot'))
531
+ pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowScreenshotControls, false]);
517
532
  if (this.initParams.hideCanvasControls.includes('expand'))
518
533
  pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowExpand, false]);
519
534
  if (this.initParams.hideCanvasControls.includes('controlToggle'))
@@ -604,7 +619,7 @@ class PDBeMolstarPlugin {
604
619
  assemblyId: this.initParams.assemblyId,
605
620
  isBinary: dataSource.isBinary,
606
621
  progressMessage: `Loading ${(_b = this.initParams.moleculeId) !== null && _b !== void 0 ? _b : ''} ...`,
607
- id: 'main',
622
+ id: PDBeMolstarPlugin.MAIN_STRUCTURE_ID,
608
623
  });
609
624
  }
610
625
  // Subscribe to events from other PDB Component
@@ -658,22 +673,17 @@ class PDBeMolstarPlugin {
658
673
  return this.plugin.state.data;
659
674
  }
660
675
  createLigandStructure(isBranched) {
661
- var _a, e_1, _b, _c;
662
- var _d, _e;
663
676
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
677
+ var _a, e_1, _b, _c;
678
+ var _d, _e;
664
679
  if (this.assemblyRef === '')
665
680
  return;
666
681
  try {
667
- for (var _f = true, _g = tslib_1.__asyncValues(this.plugin.managers.structure.hierarchy.currentComponentGroups), _h; _h = yield _g.next(), _a = _h.done, !_a;) {
682
+ for (var _f = true, _g = tslib_1.__asyncValues(this.plugin.managers.structure.hierarchy.currentComponentGroups), _h; _h = yield _g.next(), _a = _h.done, !_a; _f = true) {
668
683
  _c = _h.value;
669
684
  _f = false;
670
- try {
671
- const comp = _c;
672
- yield commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: comp[0].cell.parent, ref: comp[0].cell.transform.ref, removeParentGhosts: true });
673
- }
674
- finally {
675
- _f = true;
676
- }
685
+ const comp = _c;
686
+ yield commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: comp[0].cell.parent, ref: comp[0].cell.transform.ref, removeParentGhosts: true });
677
687
  }
678
688
  }
679
689
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -713,8 +723,8 @@ class PDBeMolstarPlugin {
713
723
  }
714
724
  });
715
725
  }
716
- load({ url, format = 'mmcif', isBinary = false, assemblyId = '', progressMessage, id }, fullLoad = true) {
717
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
726
+ load(_a) {
727
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ url, format = 'mmcif', isBinary = false, assemblyId = '', progressMessage, id }, fullLoad = true) {
718
728
  yield (0, helpers_1.runWithProgressMessage)(this.plugin, progressMessage, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
719
729
  var _a, _b;
720
730
  let success = false;
@@ -810,8 +820,8 @@ class PDBeMolstarPlugin {
810
820
  * E.g. `styles={polymer:'putty',nonStandard:'ball-and-stick'}` - apply only putty to polymer, only ball-and-stick to non-standard residues, leave other components untouched.
811
821
  * E.g. `styles='ball-and-stick'` - apply only ball-and-stick to all components. */
812
822
  applyVisualStyles(structureRef, styles) {
813
- var _a, _b;
814
823
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
824
+ var _a, _b;
815
825
  if (styles === undefined)
816
826
  return;
817
827
  const components = this.plugin.state.data.selectQ(q => q.byRef(structureRef).subtree().withTransformer(model_1.StructureComponent));
@@ -850,8 +860,8 @@ class PDBeMolstarPlugin {
850
860
  }
851
861
  /** Remove all structure components of the given structure which correspond to any component type listed in `deleteComponents`. */
852
862
  deleteStructureComponents(structureRef, deleteComponents) {
853
- var _a, _b;
854
863
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
864
+ var _a, _b;
855
865
  if (deleteComponents.length === 0)
856
866
  return;
857
867
  const comps = this.plugin.state.data.selectQ(q => q.byRef(structureRef).subtree().withTransformer(model_1.StructureComponent));
@@ -962,8 +972,12 @@ class PDBeMolstarPlugin {
962
972
  exports.PDBeMolstarPlugin = PDBeMolstarPlugin;
963
973
  /** Helper functions related to specific views or use cases */
964
974
  PDBeMolstarPlugin.extensions = {
975
+ Complexes: Complexes,
965
976
  Foldseek: Foldseek,
977
+ Interactions: Interactions,
978
+ MVS: { MVSData: mvs_data_1.MVSData, loadMVS: load_1.loadMVS },
966
979
  StateGallery: behavior_5.StateGalleryExtensionFunctions,
967
980
  };
968
981
  /** Components for building custom UI layouts */
969
982
  PDBeMolstarPlugin.UIComponents = components_1.UIComponents;
983
+ PDBeMolstarPlugin.MAIN_STRUCTURE_ID = 'main';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdbe-molstar",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "Molstar implementation for PDBe",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "watch-tsc": "tsc --watch --incremental",
17
17
  "watch-extra": "cpx 'src/app/**/*.{scss,html,ico}' lib/ --watch",
18
18
  "watch-webpack": "webpack -w --mode development --stats minimal --config ./webpack.config.development.js",
19
- "serve": "http-server -p 1338 -g -c-1",
19
+ "serve": "http-server -p 1339 -g -c-1",
20
20
  "bundle-webcomponent": "node scripts.js bundle-webcomponent"
21
21
  },
22
22
  "files": [
@@ -65,7 +65,7 @@
65
65
  "sass": "^1.80.4",
66
66
  "sass-loader": "^16.0.2",
67
67
  "style-loader": "^4.0.0",
68
- "typescript": "^4.6.4",
68
+ "typescript": "^5.7.3",
69
69
  "typescript-eslint": "^8.2.0",
70
70
  "webpack": "^5.95.0",
71
71
  "webpack-cli": "^5.1.4"
@@ -78,7 +78,7 @@
78
78
  "d3-scale": "^4.0.2",
79
79
  "d3-selection": "^3.0.0",
80
80
  "lit": "^3.1.1",
81
- "molstar": "4.8.0",
81
+ "molstar": "4.18.0",
82
82
  "path-browserify": "^1.0.1",
83
83
  "stream-browserify": "^3.0.0",
84
84
  "vm-browserify": "^1.1.2"