pdbe-molstar 3.11.0 → 3.12.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/build/pdbe-molstar-component.js +2 -2
- package/build/pdbe-molstar-light.css +2 -2
- package/build/pdbe-molstar-plugin.js +2 -2
- package/build/pdbe-molstar-plugin.js.LICENSE.txt +1 -1
- package/build/pdbe-molstar.css +2 -2
- package/lib/styles/pdbe-molstar/_index.scss +0 -9
- package/lib/viewer.d.ts +12 -12
- package/lib/viewer.js +25 -16
- package/package.json +2 -2
package/lib/viewer.js
CHANGED
|
@@ -143,7 +143,7 @@ class PDBeMolstarPlugin {
|
|
|
143
143
|
}
|
|
144
144
|
}),
|
|
145
145
|
/** Change the visibility of a structure.
|
|
146
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
146
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure.
|
|
147
147
|
* If `visibility` is undefined, toggle current visibility state. */
|
|
148
148
|
structureVisibility: (structureNumberOrId, visibility) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
149
149
|
const struct = this.getStructure(structureNumberOrId);
|
|
@@ -173,7 +173,7 @@ class PDBeMolstarPlugin {
|
|
|
173
173
|
}),
|
|
174
174
|
/** Focus (zoom) on the part of the structure defined by `selection`.
|
|
175
175
|
* If `selection` contains more items, focus on the union of those.
|
|
176
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
176
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure;
|
|
177
177
|
* if not provided, will use the last added structure. */
|
|
178
178
|
focus: (selection, structureNumberOrId) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
179
179
|
const loci = this.getLociForParams(selection, structureNumberOrId);
|
|
@@ -183,7 +183,7 @@ class PDBeMolstarPlugin {
|
|
|
183
183
|
* This includes behaviors like "show non-covalent interactions" or "show streamed volume data"
|
|
184
184
|
* but not camera adjustment (call `.visual.focus` for that).
|
|
185
185
|
* If `data` contains more items, focus on the union of those.
|
|
186
|
-
* If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1
|
|
186
|
+
* If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1!; use negative index to count backwards);
|
|
187
187
|
* otherwise use the last added structure. */
|
|
188
188
|
interactivityFocus: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
189
189
|
var _a;
|
|
@@ -194,7 +194,7 @@ class PDBeMolstarPlugin {
|
|
|
194
194
|
/** Trigger highlight on the part of the structure defined by `data`
|
|
195
195
|
* (this will look the same as when the user hovers over a part of the structure).
|
|
196
196
|
* If `focus`, also zoom on the highlighted part.
|
|
197
|
-
* If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1
|
|
197
|
+
* If `structureId` or `structureNumber` is provided, use the specified structure (numbered from 1!; use negative index to count backwards); otherwise use the last added structure. */
|
|
198
198
|
highlight: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
199
199
|
var _a;
|
|
200
200
|
const loci = this.getLociForParams(params.data, (_a = params.structureId) !== null && _a !== void 0 ? _a : params.structureNumber);
|
|
@@ -218,7 +218,7 @@ class PDBeMolstarPlugin {
|
|
|
218
218
|
* If any items in `data` contain `opacity`, set opacity accordingly, set opacity to `nonSelectedOpacity` (or 1) for the rest of the structure.
|
|
219
219
|
* If any items in `data` contain `focus`, zoom to the union of these items.
|
|
220
220
|
* If any items in `data` contain `sideChain` or `representation`, add extra representations to them (colored in `representationColor` if provided).
|
|
221
|
-
* If `structureNumber` is provided, apply to the specified structure (numbered from 1
|
|
221
|
+
* If `structureNumber` is provided, apply to the specified structure (numbered from 1!; use negative index to count backwards); otherwise apply to all loaded structures.
|
|
222
222
|
* Remove any previously added coloring, opacity, and/or extra representations, unless `keepColors`, `keepOpacity`, and/or `keepRepresentations` is set. */
|
|
223
223
|
select: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
224
224
|
var _a, _b, _c, _d;
|
|
@@ -318,7 +318,7 @@ class PDBeMolstarPlugin {
|
|
|
318
318
|
}
|
|
319
319
|
}),
|
|
320
320
|
/** Remove any coloring and extra representations previously added by the `select` method.
|
|
321
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
321
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure;
|
|
322
322
|
* if not provided, will apply to all loaded structures.
|
|
323
323
|
* If `keepColors`, current residue coloring is preserved. If `keepOpacity`, current residue opacity is preserved. If `keepRepresentations`, current added representations are preserved. */
|
|
324
324
|
clearSelection: (structureNumberOrId, options) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -349,7 +349,7 @@ class PDBeMolstarPlugin {
|
|
|
349
349
|
}
|
|
350
350
|
}),
|
|
351
351
|
/** Color the parts of sequence in the sequence panel defined by `data`. Color the rest of the sequence in `nonSelectedColor` if provided.
|
|
352
|
-
* If `structureId` or `structureNumber` is provided, apply to the specified structure (`structureNumber` numbered from 1
|
|
352
|
+
* If `structureId` or `structureNumber` is provided, apply to the specified structure (`structureNumber` numbered from 1!; use negative index to count backwards); otherwise apply to all loaded structures.
|
|
353
353
|
* Remove any previously added coloring, unless `keepColors` is set. */
|
|
354
354
|
sequenceColor: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
355
355
|
var _a, _b;
|
|
@@ -408,7 +408,7 @@ class PDBeMolstarPlugin {
|
|
|
408
408
|
yield update.commit();
|
|
409
409
|
}),
|
|
410
410
|
/** Remove any sequence coloring previously added by the `sequenceColor` method.
|
|
411
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
411
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure;
|
|
412
412
|
* if not provided, will apply to all loaded structures. */
|
|
413
413
|
clearSequenceColor: (structureNumberOrId) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
414
414
|
if (typeof structureNumberOrId === 'number')
|
|
@@ -925,7 +925,7 @@ class PDBeMolstarPlugin {
|
|
|
925
925
|
});
|
|
926
926
|
}
|
|
927
927
|
/** Remove loaded structure(s).
|
|
928
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
928
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure.
|
|
929
929
|
* If `structureNumberOrId` is undefined, remove all structures.
|
|
930
930
|
* You will likely need to call `await this.visual.reset({ camera: true })` afterwards. */
|
|
931
931
|
deleteStructure(structureNumberOrId) {
|
|
@@ -1009,14 +1009,14 @@ class PDBeMolstarPlugin {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
/** Get loci corresponding to a selection within a structure.
|
|
1011
1011
|
* If `params` contains more items, return loci for the union of the selections.
|
|
1012
|
-
* If `structureNumber` is provided, use the specified structure (numbered from 1
|
|
1012
|
+
* If `structureNumber` is provided, use the specified structure (numbered from 1!; use negative index to count backwards); otherwise use the last added structure. */
|
|
1013
1013
|
getLociForParams(params, structureNumberOrId) {
|
|
1014
|
-
var _a, _b, _c, _d;
|
|
1014
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1015
1015
|
const struct = (structureNumberOrId !== undefined) ?
|
|
1016
1016
|
(_b = (_a = this.getStructure(structureNumberOrId)) === null || _a === void 0 ? void 0 : _a.cell.obj) === null || _b === void 0 ? void 0 : _b.data
|
|
1017
1017
|
: this.assemblyRef ?
|
|
1018
1018
|
(_d = (_c = this.plugin.state.data.select(this.assemblyRef)[0]) === null || _c === void 0 ? void 0 : _c.obj) === null || _d === void 0 ? void 0 : _d.data
|
|
1019
|
-
:
|
|
1019
|
+
: (_f = (_e = this.getStructure(-1)) === null || _e === void 0 ? void 0 : _e.cell.obj) === null || _f === void 0 ? void 0 : _f.data;
|
|
1020
1020
|
if (!struct)
|
|
1021
1021
|
return loci_1.EmptyLoci;
|
|
1022
1022
|
return helpers_1.QueryHelper.getInteractivityLoci(params, struct);
|
|
@@ -1055,13 +1055,22 @@ class PDBeMolstarPlugin {
|
|
|
1055
1055
|
return (0, helpers_1.normalizeColor)(colorVal, defaultColor);
|
|
1056
1056
|
}
|
|
1057
1057
|
/** Get structure ref for a structure with given `structureNumberOrId`.
|
|
1058
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
1058
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure.
|
|
1059
1059
|
* If `structureNumberOrId` is undefined, return refs for all loaded structures. */
|
|
1060
1060
|
getStructures(structureNumberOrId) {
|
|
1061
1061
|
const allStructures = this.plugin.managers.structure.hierarchy.current.structures.map((structureRef, i) => ({ structureRef, number: i + 1 }));
|
|
1062
1062
|
if (typeof structureNumberOrId === 'number') {
|
|
1063
|
-
|
|
1064
|
-
|
|
1063
|
+
if (structureNumberOrId > 0) { // count forwards from 1
|
|
1064
|
+
const theStructure = allStructures[structureNumberOrId - 1];
|
|
1065
|
+
return theStructure ? [theStructure] : [];
|
|
1066
|
+
}
|
|
1067
|
+
else if (structureNumberOrId < 0) { // count backwards from -1
|
|
1068
|
+
const theStructure = allStructures[allStructures.length + structureNumberOrId];
|
|
1069
|
+
return theStructure ? [theStructure] : [];
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
throw new Error('0 is not a valid value for structureNumberOrId, as structures are numbered from 1');
|
|
1073
|
+
}
|
|
1065
1074
|
}
|
|
1066
1075
|
else if (typeof structureNumberOrId === 'string') {
|
|
1067
1076
|
const structRef = this.structureRefMap.get(structureNumberOrId);
|
|
@@ -1082,7 +1091,7 @@ class PDBeMolstarPlugin {
|
|
|
1082
1091
|
}
|
|
1083
1092
|
}
|
|
1084
1093
|
/** Get StructureRef for a structure with given `structureNumberOrId`.
|
|
1085
|
-
* `structureNumberOrId` is either index (numbered from 1
|
|
1094
|
+
* `structureNumberOrId` is either index (numbered from 1!; use negative index to count backwards) or the ID that was provided when loading the structure. */
|
|
1086
1095
|
getStructure(structureNumberOrId) {
|
|
1087
1096
|
var _a;
|
|
1088
1097
|
return (_a = this.getStructures(structureNumberOrId)[0]) === null || _a === void 0 ? void 0 : _a.structureRef;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdbe-molstar",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "Molstar implementation for PDBe",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"d3-scale": "^4.0.2",
|
|
81
81
|
"d3-selection": "^3.0.0",
|
|
82
82
|
"lit": "^3.1.1",
|
|
83
|
-
"molstar": "5.
|
|
83
|
+
"molstar": "5.8.0",
|
|
84
84
|
"path-browserify": "^1.0.1",
|
|
85
85
|
"stream-browserify": "^3.0.0",
|
|
86
86
|
"vm-browserify": "^1.1.2"
|