pdbe-molstar 3.5.0 → 3.7.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 (40) 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 +1 -1
  5. package/build/pdbe-molstar.css +2 -2
  6. package/lib/alphafold-transparency.js +7 -8
  7. package/lib/extensions/complexes/coloring.d.ts +55 -0
  8. package/lib/extensions/complexes/coloring.js +129 -0
  9. package/lib/extensions/complexes/index.d.ts +70 -0
  10. package/lib/extensions/complexes/index.js +99 -0
  11. package/lib/extensions/complexes/superpose-by-biggest-chain.d.ts +15 -0
  12. package/lib/extensions/complexes/superpose-by-biggest-chain.js +141 -0
  13. package/lib/extensions/complexes/superpose-by-sequence-alignment.d.ts +10 -0
  14. package/lib/extensions/complexes/superpose-by-sequence-alignment.js +181 -0
  15. package/lib/helpers.d.ts +15 -1
  16. package/lib/helpers.js +119 -68
  17. package/lib/plugin-custom-state.d.ts +0 -2
  18. package/lib/sequence-color/behavior.d.ts +5 -0
  19. package/lib/sequence-color/behavior.js +54 -0
  20. package/lib/sequence-color/color.d.ts +11 -0
  21. package/lib/sequence-color/color.js +58 -0
  22. package/lib/sequence-color/prop.d.ts +38 -0
  23. package/lib/sequence-color/prop.js +38 -0
  24. package/lib/spec.d.ts +1 -1
  25. package/lib/styles/pdbe-molstar/_index.scss +7 -7
  26. package/lib/styles/pdbe-molstar-dark.scss +2 -2
  27. package/lib/styles/pdbe-molstar-light.scss +2 -2
  28. package/lib/superposition.d.ts +2 -2
  29. package/lib/superposition.js +41 -60
  30. package/lib/ui/alphafold-superposition.js +2 -2
  31. package/lib/ui/pdbe-viewport-controls.js +3 -4
  32. package/lib/ui/pdbe-viewport.d.ts +5 -1
  33. package/lib/ui/pdbe-viewport.js +23 -2
  34. package/lib/ui/split-ui/components.d.ts +1 -1
  35. package/lib/ui/split-ui/components.js +2 -2
  36. package/lib/viewer.d.ts +7 -1
  37. package/lib/viewer.js +27 -14
  38. package/package.json +3 -3
  39. package/lib/superposition-sifts-mapping.d.ts +0 -22
  40. package/lib/superposition-sifts-mapping.js +0 -153
@@ -10,6 +10,7 @@ exports.transform = transform;
10
10
  const tslib_1 = require("tslib");
11
11
  const linear_algebra_1 = require("molstar/lib/mol-math/linear-algebra");
12
12
  const structure_1 = require("molstar/lib/mol-model/structure");
13
+ const superposition_sifts_mapping_1 = require("molstar/lib/mol-model/structure/structure/util/superposition-sifts-mapping");
13
14
  const transforms_1 = require("molstar/lib/mol-plugin-state/transforms");
14
15
  const builder_1 = require("molstar/lib/mol-script/language/builder");
15
16
  const script_1 = require("molstar/lib/mol-script/script");
@@ -20,7 +21,6 @@ const lists_1 = require("molstar/lib/mol-util/color/lists");
20
21
  const alphafold_transparency_1 = require("./alphafold-transparency");
21
22
  const helpers_1 = require("./helpers");
22
23
  const plugin_custom_state_1 = require("./plugin-custom-state");
23
- const superposition_sifts_mapping_1 = require("./superposition-sifts-mapping");
24
24
  function combinedColorPalette(palettes) {
25
25
  return palettes.flatMap(paletteName => lists_1.ColorLists[paletteName].list);
26
26
  }
@@ -67,7 +67,6 @@ function initSuperposition(plugin, completeSubject) {
67
67
  visibility: [],
68
68
  transforms: [],
69
69
  rmsds: [],
70
- coordinateSystems: [],
71
70
  },
72
71
  };
73
72
  // Get segment and cluster information for the given uniprot accession
@@ -158,7 +157,7 @@ function loadAfStructure(plugin) {
158
157
  const { structure } = yield loadStructure(plugin, url, 'mmcif', isBinary);
159
158
  const strInstance = structure;
160
159
  if (!strInstance)
161
- return false;
160
+ return undefined;
162
161
  // Store Refs in state
163
162
  const spState = customState.superpositionState;
164
163
  spState.alphafold.ref = strInstance === null || strInstance === void 0 ? void 0 : strInstance.ref;
@@ -170,79 +169,65 @@ function loadAfStructure(plugin) {
170
169
  yield plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'putty', color: 'plddt-confidence', size: 'uniform', sizeParams: { value: 1.5 } }, { tag: `af-superposition-visual` });
171
170
  return strInstance === null || strInstance === void 0 ? void 0 : strInstance.ref;
172
171
  }
173
- return false;
172
+ return undefined;
174
173
  });
175
174
  }
176
- function superposeAf(plugin, traceOnly, segmentIndex) {
175
+ function superposeAf(plugin, traceOnly) {
177
176
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
178
177
  const customState = (0, plugin_custom_state_1.PluginCustomState)(plugin);
179
178
  const spState = customState.superpositionState;
180
179
  if (!(spState === null || spState === void 0 ? void 0 : spState.segmentData))
181
- return;
180
+ return false;
182
181
  // Load AF structure
183
- const afStrRef = spState.alphafold.ref || (yield loadAfStructure(plugin));
184
- if (!afStrRef)
185
- return;
186
- const afStr = plugin.managers.structure.hierarchy.current.refs.get(afStrRef);
187
- const segmentNum = segmentIndex ? segmentIndex : spState.activeSegment - 1;
182
+ const afStructRefString = spState.alphafold.ref || (yield loadAfStructure(plugin));
183
+ if (!afStructRefString)
184
+ return false;
185
+ const afStructRef = plugin.managers.structure.hierarchy.current.refs.get(afStructRefString);
186
+ if ((afStructRef === null || afStructRef === void 0 ? void 0 : afStructRef.kind) !== 'structure')
187
+ return false;
188
+ const segmentNum = spState.activeSegment - 1;
188
189
  if (!spState.alphafold.transforms[segmentNum]) {
189
190
  // Create representative list
190
191
  const mappingResult = [];
191
- const coordinateSystems = [];
192
- const failedPairsResult = [];
193
- const zeroOverlapPairsResult = [];
194
- let minRmsd = 0;
192
+ let minRmsd = Infinity;
195
193
  let minIndex = 0;
196
194
  const rmsdList = [];
197
195
  const segmentClusters = spState.segmentData[segmentNum].clusters;
198
- segmentClusters.forEach((cluster) => {
199
- var _a, _b, _c;
200
- const modelRef = spState.models[`${cluster[0].pdb_id}_${cluster[0].struct_asym_id}`];
201
- if (modelRef) {
202
- const structHierarchy = plugin.managers.structure.hierarchy.current.refs.get(modelRef);
203
- if (structHierarchy) {
204
- const input = [structHierarchy.components[0], afStr];
205
- const structures = input.map(s => { var _a; return (_a = s.cell.obj) === null || _a === void 0 ? void 0 : _a.data; });
206
- let { entries, failedPairs, zeroOverlapPairs } = (0, superposition_sifts_mapping_1.alignAndSuperposeWithSIFTSMapping)(structures, {
207
- traceOnly,
208
- includeResidueTest: loc => structure_1.StructureProperties.atom.B_iso_or_equiv(loc) > 70,
209
- applyTestIndex: [1],
210
- });
211
- if (entries.length === 0 || (entries && entries[0] && entries[0].transform.rmsd.toFixed(1) === '0.0')) {
212
- const alignWithoutPlddt = (0, superposition_sifts_mapping_1.alignAndSuperposeWithSIFTSMapping)(structures, { traceOnly });
213
- entries = alignWithoutPlddt.entries;
214
- }
215
- if (entries && entries[0]) {
216
- mappingResult.push(entries[0]);
217
- coordinateSystems.push((_c = (_b = (_a = input[0]) === null || _a === void 0 ? void 0 : _a.transform) === null || _b === void 0 ? void 0 : _b.cell.obj) === null || _c === void 0 ? void 0 : _c.data.coordinateSystem);
218
- const totalMappings = mappingResult.length;
219
- if (totalMappings === 1 || entries[0].transform.rmsd < minRmsd) {
220
- minRmsd = entries[0].transform.rmsd;
221
- minIndex = totalMappings === 1 ? 0 : mappingResult.length - 1;
222
- }
223
- rmsdList.push(`${cluster[0].pdb_id} chain ${cluster[0].struct_asym_id}:${entries[0].transform.rmsd.toFixed(2)}`);
224
- }
225
- else {
226
- if (failedPairs.length > 0)
227
- failedPairsResult.push(failedPairs);
228
- if (zeroOverlapPairs.length > 0)
229
- zeroOverlapPairsResult.push(zeroOverlapPairs);
230
- // rmsdList.push(`${cluster[0].pdb_id} ${cluster[0].struct_asym_id}:-`)
231
- }
196
+ for (const cluster of segmentClusters) {
197
+ const representative = cluster[0];
198
+ const structRefString = spState.models[`${representative.pdb_id}_${representative.struct_asym_id}`];
199
+ if (!structRefString)
200
+ continue;
201
+ const structRef = plugin.managers.structure.hierarchy.current.refs.get(structRefString);
202
+ if ((structRef === null || structRef === void 0 ? void 0 : structRef.kind) !== 'structure')
203
+ continue;
204
+ const structComponentRef = structRef.components[0];
205
+ const structures = [structComponentRef.cell.obj.data, afStructRef.cell.obj.data];
206
+ let { entries } = (0, superposition_sifts_mapping_1.alignAndSuperposeWithSIFTSMapping)(structures, {
207
+ traceOnly,
208
+ includeResidueTest: loc => !(loc.structure === structures[1] && structure_1.StructureProperties.atom.B_iso_or_equiv(loc) <= 70), // exclude AlphaFold residues with pLDDT <= 70
209
+ });
210
+ if (entries.length === 0 || (entries[0] && entries[0].transform.rmsd.toFixed(1) === '0.0')) {
211
+ const alignWithoutPlddt = (0, superposition_sifts_mapping_1.alignAndSuperposeWithSIFTSMapping)(structures, { traceOnly });
212
+ entries = alignWithoutPlddt.entries;
213
+ }
214
+ if (entries[0]) {
215
+ mappingResult.push(entries[0]);
216
+ if (entries[0].transform.rmsd < minRmsd) {
217
+ minRmsd = entries[0].transform.rmsd;
218
+ minIndex = mappingResult.length - 1;
232
219
  }
220
+ rmsdList.push(`${representative.pdb_id} chain ${representative.struct_asym_id}:${entries[0].transform.rmsd.toFixed(2)}`);
233
221
  }
234
- });
235
- // console.log(failedPairsResult);
236
- // console.log(zeroOverlapPairsResult);
222
+ }
237
223
  if (mappingResult.length > 0) {
238
224
  spState.alphafold.visibility[segmentNum] = true;
239
225
  spState.alphafold.transforms[segmentNum] = mappingResult[minIndex].transform.bTransform;
240
- spState.alphafold.coordinateSystems[segmentNum] = coordinateSystems[minIndex];
241
226
  spState.alphafold.rmsds[segmentNum] = rmsdList.sort((a, b) => parseFloat(a.split(':')[1]) - parseFloat(b.split(':')[1]));
242
227
  }
243
228
  }
244
- yield afTransform(plugin, afStr.cell, spState.alphafold.transforms[segmentNum], spState.alphafold.coordinateSystems[segmentNum]);
245
- (0, alphafold_transparency_1.applyAFTransparency)(plugin, afStr, 0.8, 70);
229
+ yield afTransform(plugin, afStructRef.cell, spState.alphafold.transforms[segmentNum]);
230
+ yield (0, alphafold_transparency_1.applyAFTransparency)(plugin, afStructRef, 0.8, 70);
246
231
  return true;
247
232
  });
248
233
  }
@@ -325,10 +310,6 @@ function renderSuperposition(plugin, segmentIndex, entryList) {
325
310
  yield plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'putty', color: 'uniform', colorParams: { value: uniformColor2 }, size: 'uniform' }, { tag: `superposition-visual` });
326
311
  spState.refMaps[chainSel.ref] = `${s.pdb_id}_${s.struct_asym_id}`;
327
312
  }
328
- // // const addTooltipUpdate = plugin.state.behaviors.build().to(BestDatabaseSequenceMapping.id).update(BestDatabaseSequenceMapping, (old: any) => { old.showTooltip = true; });
329
- // // await plugin.runTask(plugin.state.behaviors.updateTree(addTooltipUpdate));
330
- // BestDatabaseSequenceMapping
331
- // console.log(plugin.state.data.select(modelRef)[0])
332
313
  }
333
314
  let invalidStruct = chainSel ? false : true;
334
315
  if (superpositionParams && superpositionParams.ligandView) {
@@ -391,7 +372,7 @@ function renderSuperposition(plugin, segmentIndex, entryList) {
391
372
  0: polymerChainWithSurroundings,
392
373
  by: carbEntityChain,
393
374
  });
394
- const data = (plugin.state.data.select(strInstance.ref)[0].obj).data;
375
+ const data = plugin.state.data.select(strInstance.ref)[0].obj.data;
395
376
  const carbChainSel = script_1.Script.getStructureSelection(carbEntityChainInVicinity, data);
396
377
  if (carbChainSel && carbChainSel.kind === 'sequence') {
397
378
  // console.log(carbEntityChainId + ' chain present in 5 A radius');
@@ -148,10 +148,10 @@ class AfSuperpositionControls extends base_1.PurePluginUIComponent {
148
148
  return (0, plugin_custom_state_1.PluginCustomState)(this.plugin);
149
149
  }
150
150
  superposeByDbMapping() {
151
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.SuperposeChainsSvg, title: 'Superpose AlphaFold structure using intersection of residues from SIFTS UNIPROT mapping.', className: 'msp-btn msp-btn-block', onClick: this.superposeDb, style: { marginTop: '1px', textAlign: 'left' }, disabled: this.state.isBusy, children: "Load AlphaFold structure" }) });
151
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.AddSvg, title: 'Superpose AlphaFold structure using intersection of residues from SIFTS UNIPROT mapping.', className: 'msp-btn msp-btn-block', onClick: this.superposeDb, style: { marginTop: '1px', textAlign: 'left' }, disabled: this.state.isBusy, children: "Load AlphaFold structure" }) });
152
152
  }
153
153
  render() {
154
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: { backgroundColor: '#dce54e', fontWeight: 500, padding: '5px 12px' }, children: "New Feature!" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-help-text', style: { margin: '2px 0' }, children: (0, jsx_runtime_1.jsxs)("div", { className: 'msp-help-description', children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { svg: icons_2.InfoIconSvg, inline: true }), "Load and superpose AlphaFold structure against representative chains."] }) }), (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [this.state.canUseDb && this.superposeByDbMapping(), (0, jsx_runtime_1.jsx)(common_1.ToggleButton, { icon: icons_1.TuneSvg, label: '', title: 'Options', toggle: this.toggleOptions, isSelected: this.state.action === 'options', disabled: this.state.isBusy, style: { flex: '0 0 40px', padding: 0 } })] }), this.state.action === 'options' && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: exports.AlphafoldSuperpositionParams, values: this.state.options, onChangeValues: this.setOptions, isDisabled: this.state.isBusy }) })] });
154
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-help-text', style: { margin: '2px 0' }, children: (0, jsx_runtime_1.jsxs)("div", { className: 'msp-help-description', children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { svg: icons_2.InfoIconSvg, inline: true }), "Load and superpose AlphaFold structure against representative chains."] }) }), (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [this.state.canUseDb && this.superposeByDbMapping(), (0, jsx_runtime_1.jsx)(common_1.ToggleButton, { icon: icons_1.TuneSvg, label: '', title: 'Options', toggle: this.toggleOptions, isSelected: this.state.action === 'options', disabled: this.state.isBusy, style: { flex: '0 0 40px', padding: 0 } })] }), this.state.action === 'options' && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: exports.AlphafoldSuperpositionParams, values: this.state.options, onChangeValues: this.setOptions, isDisabled: this.state.isBusy }) })] });
155
155
  }
156
156
  }
157
157
  exports.AfSuperpositionControls = AfSuperpositionControls;
@@ -17,9 +17,8 @@ class PDBeViewportControls extends viewport_1.ViewportControls {
17
17
  const showPDBeLink = (initParams === null || initParams === void 0 ? void 0 : initParams.moleculeId) && (initParams === null || initParams === void 0 ? void 0 : initParams.pdbeLink) && !(initParams === null || initParams === void 0 ? void 0 : initParams.superposition);
18
18
  const pdbeLinkColor = this.isBlack() ? '#fff' : '#555';
19
19
  const pdbeLink = {
20
- parentStyle: { width: 'auto' },
21
- bgStyle: { position: 'absolute', height: '27px', width: '54px', marginLeft: '-33px' },
22
- containerStyle: { position: 'absolute', right: '10px', top: '10px', padding: '3px 3px 3px 18px' },
20
+ containerStyle: { position: 'absolute', right: '10px', top: '10px', padding: '6px', paddingRight: '3px', paddingLeft: '18px' },
21
+ bgStyle: { position: 'absolute', height: '32px', width: '54px', marginLeft: '-33px' },
23
22
  style: { display: 'inline-block', fontSize: '14px', color: pdbeLinkColor, borderBottom: 'none', cursor: 'pointer', textDecoration: 'none', position: 'absolute', right: '5px' },
24
23
  pdbeImg: {
25
24
  src: 'https://www.ebi.ac.uk/pdbe/entry/static/images/logos/PDBe/logo_T_64.png',
@@ -27,7 +26,7 @@ class PDBeViewportControls extends viewport_1.ViewportControls {
27
26
  style: { height: '12px', width: '12px', border: 0, position: 'absolute', margin: '4px 0 0 -13px' },
28
27
  },
29
28
  };
30
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showPDBeLink && (0, jsx_runtime_1.jsxs)("div", { className: 'msp-viewport-controls-buttons', style: pdbeLink.containerStyle, children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-semi-transparent-background', style: pdbeLink.bgStyle }), (0, jsx_runtime_1.jsxs)("a", { className: 'msp-pdbe-link', style: pdbeLink.style, target: "_blank", href: `https://pdbe.org/${initParams.moleculeId}`, children: [(0, jsx_runtime_1.jsx)("img", { src: pdbeLink.pdbeImg.src, alt: pdbeLink.pdbeImg.alt, style: pdbeLink.pdbeImg.style }), initParams.moleculeId] })] }), (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', top: showPDBeLink ? (27 + 4) : 0, right: 0 }, children: super.render() })] });
29
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showPDBeLink && (0, jsx_runtime_1.jsxs)("div", { className: 'msp-viewport-controls-buttons', style: pdbeLink.containerStyle, children: [(0, jsx_runtime_1.jsx)("div", { className: 'msp-semi-transparent-background', style: pdbeLink.bgStyle }), (0, jsx_runtime_1.jsxs)("a", { className: 'msp-pdbe-link', style: pdbeLink.style, target: "_blank", href: `https://pdbe.org/${initParams.moleculeId}`, children: [(0, jsx_runtime_1.jsx)("img", { src: pdbeLink.pdbeImg.src, alt: pdbeLink.pdbeImg.alt, style: pdbeLink.pdbeImg.style }), initParams.moleculeId] })] }), (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', top: showPDBeLink ? (32 + 4) : 0, right: 0 }, children: super.render() })] });
31
30
  }
32
31
  }
33
32
  exports.PDBeViewportControls = PDBeViewportControls;
@@ -1,6 +1,10 @@
1
1
  import { DefaultViewport } from 'molstar/lib/mol-plugin-ui/plugin';
2
+ import { ComponentClass } from 'react';
2
3
  /** A modified copy of DefaultViewport */
3
4
  export declare class CustomizableDefaultViewport extends DefaultViewport {
4
5
  render(): import("react/jsx-runtime").JSX.Element;
5
6
  }
6
- export declare const PDBeViewport: import("react").ComponentClass<{}, any>;
7
+ /** Version of `PDBeViewport` to use as part of other components. Does not expand to fullscreen individually. */
8
+ export declare const PDBeViewport_NoFullscreen: ComponentClass<{}, any>;
9
+ /** Component containing 3D canvas, button in top left and top right corners, and tooltip box (center panel in default layout). Changes to fullscreen view by "Toggle Expanded Viewport" button, or "expanded" option. */
10
+ export declare const PDBeViewport: ComponentClass<{}, any>;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PDBeViewport = exports.CustomizableDefaultViewport = void 0;
3
+ exports.PDBeViewport = exports.PDBeViewport_NoFullscreen = exports.CustomizableDefaultViewport = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const base_1 = require("molstar/lib/mol-plugin-ui/base");
5
6
  const controls_1 = require("molstar/lib/mol-plugin-ui/controls");
6
7
  const plugin_1 = require("molstar/lib/mol-plugin-ui/plugin");
7
8
  const task_1 = require("molstar/lib/mol-plugin-ui/task");
@@ -19,4 +20,24 @@ class CustomizableDefaultViewport extends plugin_1.DefaultViewport {
19
20
  }
20
21
  }
21
22
  exports.CustomizableDefaultViewport = CustomizableDefaultViewport;
22
- exports.PDBeViewport = (0, overlay_1.WithLoadingOverlay)(CustomizableDefaultViewport);
23
+ /** Return a React component with MainContent, expanded to whole browser window whenever `this.plugin.layout.state.isExpanded === true`. */
24
+ function Fullscreenable(MainContent) {
25
+ return class _Fullscreenable extends base_1.PurePluginUIComponent {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.state = { fullscreen: this.plugin.layout.state.isExpanded };
29
+ }
30
+ componentDidMount() {
31
+ this.subscribe(this.plugin.layout.events.updated, () => {
32
+ this.setState({ fullscreen: this.plugin.layout.state.isExpanded });
33
+ });
34
+ }
35
+ render() {
36
+ return (0, jsx_runtime_1.jsxs)("div", { className: this.state.fullscreen ? 'msp-layout-expanded msp-viewport-expanded' : undefined, children: [(0, jsx_runtime_1.jsx)(MainContent, {}), ";"] });
37
+ }
38
+ };
39
+ }
40
+ /** Version of `PDBeViewport` to use as part of other components. Does not expand to fullscreen individually. */
41
+ exports.PDBeViewport_NoFullscreen = (0, overlay_1.WithLoadingOverlay)(CustomizableDefaultViewport);
42
+ /** Component containing 3D canvas, button in top left and top right corners, and tooltip box (center panel in default layout). Changes to fullscreen view by "Toggle Expanded Viewport" button, or "expanded" option. */
43
+ exports.PDBeViewport = Fullscreenable(exports.PDBeViewport_NoFullscreen);
@@ -1,7 +1,7 @@
1
1
  import { ControlsWrapper, Log } from 'molstar/lib/mol-plugin-ui/plugin';
2
2
  import { SequenceView } from 'molstar/lib/mol-plugin-ui/sequence';
3
3
  export declare const UIComponents: {
4
- /** Component containing 3D canvas, button in top left and top right corners, and tooltip box (center panel in default layout) */
4
+ /** Component containing 3D canvas, button in top left and top right corners, and tooltip box (center panel in default layout). Changes to fullscreen view by "Toggle Expanded Viewport" button, or "expanded" option. */
5
5
  readonly PDBeViewport: import("react").ComponentClass<{}, any>;
6
6
  /** Component containing 1D view of the sequences (top panel in default layout) */
7
7
  readonly SequenceView: typeof SequenceView;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UIComponents = void 0;
4
4
  const plugin_1 = require("molstar/lib/mol-plugin-ui/plugin");
5
5
  const sequence_1 = require("molstar/lib/mol-plugin-ui/sequence");
6
- const pdbe_viewport_1 = require("../pdbe-viewport");
7
6
  const pdbe_left_panel_1 = require("../left-panel/pdbe-left-panel");
7
+ const pdbe_viewport_1 = require("../pdbe-viewport");
8
8
  exports.UIComponents = {
9
- /** Component containing 3D canvas, button in top left and top right corners, and tooltip box (center panel in default layout) */
9
+ /** Component containing 3D canvas, button in top left and top right corners, and tooltip box (center panel in default layout). Changes to fullscreen view by "Toggle Expanded Viewport" button, or "expanded" option. */
10
10
  PDBeViewport: pdbe_viewport_1.PDBeViewport,
11
11
  /** Component containing 1D view of the sequences (top panel in default layout) */
12
12
  SequenceView: sequence_1.SequenceView,
package/lib/viewer.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { loadMVS } from 'molstar/lib/extensions/mvs/load';
2
2
  import { MVSData } from 'molstar/lib/extensions/mvs/mvs-data';
3
3
  import { Canvas3DProps } from 'molstar/lib/mol-canvas3d/canvas3d';
4
+ import { Mat3 } from 'molstar/lib/mol-math/linear-algebra';
4
5
  import { EmptyLoci } from 'molstar/lib/mol-model/loci';
5
6
  import { StructureElement } from 'molstar/lib/mol-model/structure';
6
7
  import { StructureRef } from 'molstar/lib/mol-plugin-state/manager/structure/hierarchy-state';
7
8
  import { PluginContext } from 'molstar/lib/mol-plugin/context';
8
9
  import { Color } from 'molstar/lib/mol-util/color/color';
10
+ import * as Complexes from './extensions/complexes';
9
11
  import * as Foldseek from './extensions/foldseek';
10
12
  import * as Interactions from './extensions/interactions';
11
13
  import { StateGalleryManager } from './extensions/state-gallery/manager';
@@ -46,7 +48,7 @@ export declare class PDBeMolstarPlugin {
46
48
  * `structureNumberOrId` is either index (numbered from 1!) or the ID that was provided when loading the structure.
47
49
  * If `structureNumberOrId` is undefined, remove all structures.
48
50
  * You will likely need to call `await this.visual.reset({ camera: true })` afterwards. */
49
- deleteStructure(structureNumberOrId?: number): Promise<void>;
51
+ deleteStructure(structureNumberOrId?: number | string): Promise<void>;
50
52
  /** Apply representations to structure components based on `styles`, also removing any existing representations.
51
53
  * Components not included in `styles` will keep their representations.
52
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.
@@ -181,6 +183,9 @@ export declare class PDBeMolstarPlugin {
181
183
  highlightColor?: boolean;
182
184
  selectColor?: boolean;
183
185
  }) => Promise<void>;
186
+ setViewDirection: (view: "front" | "back" | "right" | "left" | "top" | "bottom" | Mat3, options?: {
187
+ durationMs: number;
188
+ }) => Promise<void>;
184
189
  /** Change parameters of the plugin instance.
185
190
  * Can be used to load a different structure.
186
191
  * If `fullLoad`, remove currently loaded structure before loading the new one;
@@ -190,6 +195,7 @@ export declare class PDBeMolstarPlugin {
190
195
  clear(): Promise<void>;
191
196
  /** Helper functions related to specific views or use cases */
192
197
  static extensions: {
198
+ Complexes: typeof Complexes;
193
199
  Foldseek: typeof Foldseek;
194
200
  Interactions: typeof Interactions;
195
201
  MVS: {
package/lib/viewer.js CHANGED
@@ -11,6 +11,7 @@ const custom_tooltips_prop_1 = require("molstar/lib/extensions/mvs/components/cu
11
11
  const load_1 = require("molstar/lib/extensions/mvs/load");
12
12
  const mvs_data_1 = require("molstar/lib/extensions/mvs/mvs-data");
13
13
  const pdbe_1 = require("molstar/lib/extensions/pdbe");
14
+ const linear_algebra_1 = require("molstar/lib/mol-math/linear-algebra");
14
15
  const loci_1 = require("molstar/lib/mol-model/loci");
15
16
  const structure_1 = require("molstar/lib/mol-model/structure");
16
17
  const assembly_unwind_1 = require("molstar/lib/mol-plugin-state/animation/built-in/assembly-unwind");
@@ -34,7 +35,6 @@ const structure_focus_representation_1 = require("molstar/lib/mol-plugin/behavio
34
35
  const transformers_1 = require("molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers");
35
36
  const commands_1 = require("molstar/lib/mol-plugin/commands");
36
37
  const config_1 = require("molstar/lib/mol-plugin/config");
37
- const layout_1 = require("molstar/lib/mol-plugin/layout");
38
38
  const spec_1 = require("molstar/lib/mol-plugin/spec");
39
39
  const mol_state_1 = require("molstar/lib/mol-state");
40
40
  const element_symbol_1 = require("molstar/lib/mol-theme/color/element-symbol");
@@ -43,6 +43,7 @@ const color_1 = require("molstar/lib/mol-util/color/color");
43
43
  const rx_event_helper_1 = require("molstar/lib/mol-util/rx-event-helper");
44
44
  const custom_events_1 = require("./custom-events");
45
45
  const behavior_4 = require("./domain-annotations/behavior");
46
+ const Complexes = tslib_1.__importStar(require("./extensions/complexes"));
46
47
  const Foldseek = tslib_1.__importStar(require("./extensions/foldseek"));
47
48
  const Interactions = tslib_1.__importStar(require("./extensions/interactions"));
48
49
  const behavior_5 = require("./extensions/state-gallery/behavior");
@@ -392,6 +393,22 @@ class PDBeMolstarPlugin {
392
393
  yield commands_1.PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: { renderer, marking } });
393
394
  }
394
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
+ }),
395
412
  /** Change parameters of the plugin instance.
396
413
  * Can be used to load a different structure.
397
414
  * If `fullLoad`, remove currently loaded structure before loading the new one;
@@ -414,7 +431,10 @@ class PDBeMolstarPlugin {
414
431
  if (this.initParams.customData && this.initParams.customData.url && !this.initParams.customData.format)
415
432
  return false;
416
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) });
417
436
  // Show/hide buttons in the viewport control panel
437
+ this.plugin.config.set(config_1.PluginConfig.Viewport.ShowScreenshotControls, !this.initParams.hideCanvasControls.includes('screenshot'));
418
438
  this.plugin.config.set(config_1.PluginConfig.Viewport.ShowExpand, !this.initParams.hideCanvasControls.includes('expand'));
419
439
  this.plugin.config.set(config_1.PluginConfig.Viewport.ShowControls, !this.initParams.hideCanvasControls.includes('controlToggle'));
420
440
  this.plugin.config.set(config_1.PluginConfig.Viewport.ShowSettings, !this.initParams.hideCanvasControls.includes('controlInfo'));
@@ -471,17 +491,7 @@ class PDBeMolstarPlugin {
471
491
  pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(superposition_focus_representation_1.SuperpositionFocusRepresentation), spec_1.PluginSpec.Behavior(behavior_2.MAQualityAssessment, { autoAttach: true, showTooltip: true }));
472
492
  }
473
493
  pdbePluginSpec.layout = {
474
- initial: {
475
- isExpanded: this.initParams.expanded,
476
- showControls: !this.initParams.hideControls,
477
- regionState: {
478
- left: this.initParams.leftPanel ? 'full' : 'hidden',
479
- right: this.initParams.rightPanel ? 'full' : 'hidden',
480
- top: this.initParams.sequencePanel ? 'full' : 'hidden',
481
- bottom: this.initParams.logPanel ? 'full' : 'hidden',
482
- },
483
- controlsDisplay: this.initParams.reactive ? 'reactive' : this.initParams.landscape ? 'landscape' : layout_1.PluginLayoutStateParams.controlsDisplay.defaultValue,
484
- },
494
+ initial: (0, helpers_1.pluginLayoutStateFromInitParams)(this.initParams),
485
495
  };
486
496
  pdbePluginSpec.components = {
487
497
  controls: {
@@ -489,7 +499,7 @@ class PDBeMolstarPlugin {
489
499
  },
490
500
  viewport: {
491
501
  controls: pdbe_viewport_controls_1.PDBeViewportControls,
492
- view: pdbe_viewport_1.PDBeViewport,
502
+ view: pdbe_viewport_1.PDBeViewport_NoFullscreen,
493
503
  },
494
504
  remoteState: 'none',
495
505
  structureTools: this.initParams.superposition ? pdbe_structure_controls_1.PDBeSuperpositionStructureTools
@@ -517,6 +527,8 @@ class PDBeMolstarPlugin {
517
527
  pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(mp4_export_1.Mp4Export));
518
528
  pdbePluginSpec.behaviors.push(spec_1.PluginSpec.Behavior(geo_export_1.GeometryExport));
519
529
  }
530
+ if (this.initParams.hideCanvasControls.includes('screenshot'))
531
+ pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowScreenshotControls, false]);
520
532
  if (this.initParams.hideCanvasControls.includes('expand'))
521
533
  pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowExpand, false]);
522
534
  if (this.initParams.hideCanvasControls.includes('controlToggle'))
@@ -764,7 +776,7 @@ class PDBeMolstarPlugin {
764
776
  return;
765
777
  const asm = this.state.select(this.assemblyRef)[0].obj;
766
778
  const defaultMapParams = transformers_1.InitVolumeStreaming.createDefaultParams(asm, this.plugin);
767
- const pdbeMapParams = helpers_1.PDBeVolumes.mapParams(defaultMapParams, this.initParams.mapSettings, '');
779
+ const pdbeMapParams = helpers_1.PDBeVolumes.mapParams(defaultMapParams, this.initParams.mapSettings);
768
780
  if (pdbeMapParams) {
769
781
  yield this.plugin.runTask(this.state.applyAction(transformers_1.InitVolumeStreaming, pdbeMapParams, this.assemblyRef));
770
782
  if (pdbeMapParams.method !== 'em' && !this.initParams.ligandView)
@@ -960,6 +972,7 @@ class PDBeMolstarPlugin {
960
972
  exports.PDBeMolstarPlugin = PDBeMolstarPlugin;
961
973
  /** Helper functions related to specific views or use cases */
962
974
  PDBeMolstarPlugin.extensions = {
975
+ Complexes: Complexes,
963
976
  Foldseek: Foldseek,
964
977
  Interactions: Interactions,
965
978
  MVS: { MVSData: mvs_data_1.MVSData, loadMVS: load_1.loadMVS },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdbe-molstar",
3
- "version": "3.5.0",
3
+ "version": "3.7.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": [
@@ -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.17.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"
@@ -1,22 +0,0 @@
1
- import { MinimizeRmsd } from 'molstar/lib/mol-math/linear-algebra/3d/minimize-rmsd';
2
- import { Structure } from 'molstar/lib/mol-model/structure';
3
- import { ElementIndex, ResidueIndex } from 'molstar/lib/mol-model/structure/model/indexing';
4
- import { StructureElement } from 'molstar/lib/mol-model/structure/structure/element';
5
- import { Unit } from 'molstar/lib/mol-model/structure/structure/unit';
6
- export interface AlignmentResultEntry {
7
- transform: MinimizeRmsd.Result;
8
- pivot: number;
9
- other: number;
10
- }
11
- export interface AlignmentResult {
12
- entries: AlignmentResultEntry[];
13
- zeroOverlapPairs: [number, number][];
14
- failedPairs: [number, number][];
15
- }
16
- type IncludeResidueTest = (traceElementOrFirstAtom: StructureElement.Location<Unit.Atomic>, residueIndex: ResidueIndex, startIndex: ElementIndex, endIndex: ElementIndex) => boolean;
17
- export declare function alignAndSuperposeWithSIFTSMapping(structures: Structure[], options?: {
18
- traceOnly?: boolean;
19
- includeResidueTest?: IncludeResidueTest;
20
- applyTestIndex?: number[];
21
- }): AlignmentResult;
22
- export {};