drugflow-molstar 0.1.0 → 0.1.2
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/drugflow-molstar-0.1.2.css +1 -0
- package/build/drugflow-molstar-component-0.1.2.js +25 -0
- package/build/drugflow-molstar-plugin-0.1.2.js +2 -0
- package/build/drugflow-molstar-plugin-0.1.2.js.LICENSE.txt +39 -0
- package/lib/drugflow-molstar-component-build-0.1.2.js +4268 -0
- package/lib/drugflow-molstar-component-build-0.1.2.js.LICENSE.txt +24 -0
- package/lib/drugflow-molstar-component-build-0.1.2.js.map +1 -0
- package/lib/helpers.d.ts +1 -0
- package/lib/index.js +50 -37
- package/lib/spec.d.ts +1 -0
- package/package.json +1 -1
package/lib/helpers.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var subscribe_events_1 = require("./subscribe-events");
|
|
|
18
18
|
var pdbe_left_panel_1 = require("./ui/pdbe-left-panel");
|
|
19
19
|
var superposition_1 = require("./superposition");
|
|
20
20
|
var custom_events_1 = require("./custom-events");
|
|
21
|
-
|
|
21
|
+
// import { Asset } from 'Molstar/mol-util/assets';
|
|
22
22
|
var config_1 = require("Molstar/mol-plugin/config");
|
|
23
23
|
var color_1 = require("Molstar/mol-util/color/color");
|
|
24
24
|
var component_1 = require("Molstar/mol-plugin-state/manager/structure/component");
|
|
@@ -610,7 +610,7 @@ var PDBeMolstarPlugin = /** @class */ (function () {
|
|
|
610
610
|
this.plugin.behaviors.layout.leftPanelTabName.next('none');
|
|
611
611
|
dataSource = this.getMoleculeSrcUrl();
|
|
612
612
|
if (dataSource) {
|
|
613
|
-
this.load({ url: dataSource.url, format: dataSource.format, assemblyId: this.initParams.assemblyId, isBinary: dataSource.isBinary });
|
|
613
|
+
this.load({ url: dataSource.url, format: dataSource.format, assemblyId: this.initParams.assemblyId, isBinary: dataSource.isBinary, pdb_string: dataSource.pdb_string });
|
|
614
614
|
}
|
|
615
615
|
// Binding to other PDB Component events
|
|
616
616
|
if (this.initParams.subscribeEvents) {
|
|
@@ -650,8 +650,13 @@ var PDBeMolstarPlugin = /** @class */ (function () {
|
|
|
650
650
|
var url = "".concat(this.initParams.pdbeUrl, "model-server/v1/").concat(id, "/").concat(query).concat(sep, "encoding=").concat(this.initParams.encoding).concat(this.initParams.lowPrecisionCoords ? '&lowPrecisionCoords=1' : '');
|
|
651
651
|
var isBinary = this.initParams.encoding === 'bcif' ? true : false;
|
|
652
652
|
var format = 'mmcif';
|
|
653
|
+
var pdb_string = undefined;
|
|
654
|
+
console.log('drugflow_test');
|
|
653
655
|
if (this.initParams.customData) {
|
|
654
|
-
if (!this.initParams.customData.url
|
|
656
|
+
if (!this.initParams.customData.url && !this.initParams.customData.pdb_string) {
|
|
657
|
+
throw new Error("Provide all custom data parameters");
|
|
658
|
+
}
|
|
659
|
+
if (!this.initParams.customData.format) {
|
|
655
660
|
throw new Error("Provide all custom data parameters");
|
|
656
661
|
}
|
|
657
662
|
url = this.initParams.customData.url;
|
|
@@ -662,12 +667,14 @@ var PDBeMolstarPlugin = /** @class */ (function () {
|
|
|
662
667
|
if (supportedFormats.indexOf(format) === -1) {
|
|
663
668
|
throw new Error("".concat(format, " not supported."));
|
|
664
669
|
}
|
|
670
|
+
pdb_string = this.initParams.customData.pdb_string;
|
|
665
671
|
isBinary = this.initParams.customData.binary ? this.initParams.customData.binary : false;
|
|
666
672
|
}
|
|
667
673
|
return {
|
|
668
674
|
url: url,
|
|
669
675
|
format: format,
|
|
670
|
-
isBinary: isBinary
|
|
676
|
+
isBinary: isBinary,
|
|
677
|
+
pdb_string: pdb_string
|
|
671
678
|
};
|
|
672
679
|
};
|
|
673
680
|
Object.defineProperty(PDBeMolstarPlugin.prototype, "state", {
|
|
@@ -765,48 +772,54 @@ var PDBeMolstarPlugin = /** @class */ (function () {
|
|
|
765
772
|
});
|
|
766
773
|
};
|
|
767
774
|
PDBeMolstarPlugin.prototype.load = function (_a, fullLoad) {
|
|
768
|
-
var url = _a.url, _b = _a.format, format = _b === void 0 ? 'mmcif' : _b, _c = _a.isBinary, isBinary = _c === void 0 ? false : _c, _d = _a.assemblyId, assemblyId = _d === void 0 ? '' : _d;
|
|
775
|
+
var url = _a.url, _b = _a.format, format = _b === void 0 ? 'mmcif' : _b, _c = _a.isBinary, isBinary = _c === void 0 ? false : _c, _d = _a.assemblyId, assemblyId = _d === void 0 ? '' : _d, _e = _a.pdb_string, pdb_string = _e === void 0 ? '' : _e;
|
|
769
776
|
if (fullLoad === void 0) { fullLoad = true; }
|
|
770
777
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
771
|
-
var isHetView,
|
|
772
|
-
return tslib_1.__generator(this, function (
|
|
773
|
-
switch (
|
|
778
|
+
var isHetView, isBranchedView, data, trajectory, model, pivotIndex, pivot, asm, defaultMapParams, pdbeMapParams;
|
|
779
|
+
return tslib_1.__generator(this, function (_f) {
|
|
780
|
+
switch (_f.label) {
|
|
774
781
|
case 0:
|
|
775
782
|
if (fullLoad)
|
|
776
783
|
this.clear();
|
|
777
784
|
isHetView = this.initParams.ligandView ? true : false;
|
|
778
|
-
downloadOptions = void 0;
|
|
779
785
|
isBranchedView = false;
|
|
780
786
|
if (this.initParams.ligandView && this.initParams.ligandView.label_comp_id_list) {
|
|
781
787
|
isBranchedView = true;
|
|
782
|
-
downloadOptions = { body: JSON.stringify(this.initParams.ligandView
|
|
788
|
+
// downloadOptions = { body: JSON.stringify(this.initParams.ligandView!.label_comp_id_list), headers: [['Content-type', 'application/json']]};
|
|
783
789
|
}
|
|
784
|
-
|
|
790
|
+
data = null;
|
|
791
|
+
if (!pdb_string) return [3 /*break*/, 2];
|
|
792
|
+
return [4 /*yield*/, this.plugin.builders.data.rawData({ data: pdb_string }, { state: { isGhost: true } })];
|
|
785
793
|
case 1:
|
|
786
|
-
data =
|
|
787
|
-
return [
|
|
788
|
-
case 2:
|
|
789
|
-
|
|
790
|
-
|
|
794
|
+
data = _f.sent();
|
|
795
|
+
return [3 /*break*/, 4];
|
|
796
|
+
case 2: return [4 /*yield*/, this.plugin.builders.data.download({ url: url }, { state: { isGhost: true } })];
|
|
797
|
+
case 3:
|
|
798
|
+
data = _f.sent();
|
|
799
|
+
_f.label = 4;
|
|
800
|
+
case 4: return [4 /*yield*/, this.plugin.builders.structure.parseTrajectory(data, format)];
|
|
801
|
+
case 5:
|
|
802
|
+
trajectory = _f.sent();
|
|
803
|
+
if (!!isHetView) return [3 /*break*/, 7];
|
|
791
804
|
return [4 /*yield*/, this.plugin.builders.structure.hierarchy.applyPreset(trajectory, this.initParams.defaultPreset, {
|
|
792
805
|
structure: assemblyId ? (assemblyId === 'preferred') ? void 0 : { name: 'assembly', params: { id: assemblyId } } : { name: 'model', params: {} },
|
|
793
806
|
showUnitcell: false,
|
|
794
807
|
representationPreset: 'auto'
|
|
795
808
|
})];
|
|
796
|
-
case
|
|
797
|
-
|
|
809
|
+
case 6:
|
|
810
|
+
_f.sent();
|
|
798
811
|
if (this.initParams.hideStructure || this.initParams.visualStyle) {
|
|
799
812
|
this.applyVisualParams();
|
|
800
813
|
}
|
|
801
|
-
return [3 /*break*/,
|
|
802
|
-
case
|
|
803
|
-
case
|
|
804
|
-
model =
|
|
814
|
+
return [3 /*break*/, 10];
|
|
815
|
+
case 7: return [4 /*yield*/, this.plugin.builders.structure.createModel(trajectory)];
|
|
816
|
+
case 8:
|
|
817
|
+
model = _f.sent();
|
|
805
818
|
return [4 /*yield*/, this.plugin.builders.structure.createStructure(model, { name: 'model', params: {} })];
|
|
806
|
-
case
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
case
|
|
819
|
+
case 9:
|
|
820
|
+
_f.sent();
|
|
821
|
+
_f.label = 10;
|
|
822
|
+
case 10:
|
|
810
823
|
// show selection if param is set
|
|
811
824
|
if (this.initParams.selection) {
|
|
812
825
|
this.visual.select(this.initParams.selection);
|
|
@@ -815,26 +828,26 @@ var PDBeMolstarPlugin = /** @class */ (function () {
|
|
|
815
828
|
pivot = this.plugin.managers.structure.hierarchy.selection.structures[pivotIndex];
|
|
816
829
|
if (pivot && pivot.cell.parent)
|
|
817
830
|
this.assemblyRef = pivot.cell.transform.ref;
|
|
818
|
-
if (!this.initParams.loadMaps) return [3 /*break*/,
|
|
831
|
+
if (!this.initParams.loadMaps) return [3 /*break*/, 12];
|
|
819
832
|
if (this.assemblyRef === '')
|
|
820
833
|
return [2 /*return*/];
|
|
821
834
|
asm = this.state.select(this.assemblyRef)[0].obj;
|
|
822
835
|
defaultMapParams = transformers_1.InitVolumeStreaming.createDefaultParams(asm, this.plugin);
|
|
823
836
|
pdbeMapParams = helpers_1.PDBeVolumes.mapParams(defaultMapParams, this.initParams.mapSettings, '');
|
|
824
|
-
if (!pdbeMapParams) return [3 /*break*/,
|
|
837
|
+
if (!pdbeMapParams) return [3 /*break*/, 12];
|
|
825
838
|
return [4 /*yield*/, this.plugin.runTask(this.state.applyAction(transformers_1.InitVolumeStreaming, pdbeMapParams, this.assemblyRef))];
|
|
826
|
-
case
|
|
827
|
-
|
|
839
|
+
case 11:
|
|
840
|
+
_f.sent();
|
|
828
841
|
if (pdbeMapParams.method !== 'em' && !this.initParams.ligandView)
|
|
829
842
|
helpers_1.PDBeVolumes.displayUsibilityMessage(this.plugin);
|
|
830
|
-
|
|
831
|
-
case
|
|
832
|
-
if (!isHetView) return [3 /*break*/,
|
|
843
|
+
_f.label = 12;
|
|
844
|
+
case 12:
|
|
845
|
+
if (!isHetView) return [3 /*break*/, 14];
|
|
833
846
|
return [4 /*yield*/, this.createLigandStructure(isBranchedView)];
|
|
834
|
-
case
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
case
|
|
847
|
+
case 13:
|
|
848
|
+
_f.sent();
|
|
849
|
+
_f.label = 14;
|
|
850
|
+
case 14:
|
|
838
851
|
this.events.loadComplete.next(true);
|
|
839
852
|
return [2 /*return*/];
|
|
840
853
|
}
|
package/lib/spec.d.ts
CHANGED