UNPKG

molstar

Version:

A comprehensive macromolecular library.

44 lines (43 loc) 2.3 kB
/** * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { __extends } from "tslib"; import { PluginBehavior } from '../../../behavior'; import { ModelCrossLinkRestraint } from '../../../../../mol-model-props/integrative/cross-link-restraint/format'; import { MmcifFormat } from '../../../../../mol-model-formats/structure/mmcif'; import { CrossLinkRestraintRepresentationProvider } from '../../../../../mol-model-props/integrative/cross-link-restraint/representation'; import { CrossLinkColorThemeProvider } from '../../../../../mol-model-props/integrative/cross-link-restraint/color'; export var CrossLinkRestraint = PluginBehavior.create({ name: 'integrative-cross-link-restraint', category: 'custom-props', display: { name: 'Cross Link Restraint' }, ctor: /** @class */ (function (_super) { __extends(class_1, _super); function class_1() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.provider = ModelCrossLinkRestraint.Provider; return _this; } class_1.prototype.register = function () { this.provider.formatRegistry.add('mmCIF', crossLinkRestraintFromMmcif); this.ctx.representation.structure.themes.colorThemeRegistry.add(CrossLinkColorThemeProvider); this.ctx.representation.structure.registry.add(CrossLinkRestraintRepresentationProvider); }; class_1.prototype.unregister = function () { this.provider.formatRegistry.remove('mmCIF'); this.ctx.representation.structure.themes.colorThemeRegistry.remove(CrossLinkColorThemeProvider); this.ctx.representation.structure.registry.remove(CrossLinkRestraintRepresentationProvider); }; return class_1; }(PluginBehavior.Handler)) }); function crossLinkRestraintFromMmcif(model) { if (!MmcifFormat.is(model.sourceData)) return; var ihm_cross_link_restraint = model.sourceData.data.db.ihm_cross_link_restraint; if (ihm_cross_link_restraint._rowCount === 0) return; return ModelCrossLinkRestraint.fromTable(ihm_cross_link_restraint, model); }