UNPKG

molstar

Version:

A comprehensive macromolecular library.

75 lines 3.88 kB
"use strict"; /** * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PDBeStructureQualityReport = void 0; var tslib_1 = require("tslib"); var int_1 = require("../../../mol-data/int"); var prop_1 = require("./prop"); var color_1 = require("./color"); var structure_1 = require("../../../mol-model/structure"); var param_definition_1 = require("../../../mol-util/param-definition"); var behavior_1 = require("../../../mol-plugin/behavior/behavior"); exports.PDBeStructureQualityReport = behavior_1.PluginBehavior.create({ name: 'pdbe-structure-quality-report-prop', category: 'custom-props', display: { name: 'Structure Quality Report', description: 'Data from wwPDB Validation Report, obtained via PDBe.' }, ctor: /** @class */ (function (_super) { (0, tslib_1.__extends)(class_1, _super); function class_1() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.provider = prop_1.StructureQualityReportProvider; _this.labelPDBeValidation = { label: function (loci) { if (!_this.params.showTooltip) return void 0; switch (loci.kind) { case 'element-loci': if (loci.elements.length === 0) return void 0; var e = loci.elements[0]; var u = e.unit; if (!u.model.customProperties.hasReference(prop_1.StructureQualityReportProvider.descriptor)) return void 0; var se = structure_1.StructureElement.Location.create(loci.structure, u, u.elements[int_1.OrderedSet.getAt(e.indices, 0)]); var issues = prop_1.StructureQualityReport.getIssues(se); if (issues.length === 0) return 'Validation: No Issues'; return "Validation: " + issues.join(', '); default: return void 0; } } }; return _this; } class_1.prototype.register = function () { this.ctx.customModelProperties.register(this.provider, this.params.autoAttach); this.ctx.managers.lociLabels.addProvider(this.labelPDBeValidation); this.ctx.representation.structure.themes.colorThemeRegistry.add(color_1.StructureQualityReportColorThemeProvider); }; class_1.prototype.update = function (p) { var updated = this.params.autoAttach !== p.autoAttach; this.params.autoAttach = p.autoAttach; this.params.showTooltip = p.showTooltip; this.ctx.customModelProperties.setDefaultAutoAttach(this.provider.descriptor.name, this.params.autoAttach); return updated; }; class_1.prototype.unregister = function () { this.ctx.customModelProperties.unregister(prop_1.StructureQualityReportProvider.descriptor.name); this.ctx.managers.lociLabels.removeProvider(this.labelPDBeValidation); this.ctx.representation.structure.themes.colorThemeRegistry.remove(color_1.StructureQualityReportColorThemeProvider); }; return class_1; }(behavior_1.PluginBehavior.Handler)), params: function () { return ({ autoAttach: param_definition_1.ParamDefinition.Boolean(false), showTooltip: param_definition_1.ParamDefinition.Boolean(true) }); } }); //# sourceMappingURL=behavior.js.map