UNPKG

molstar

Version:

A comprehensive macromolecular library.

60 lines 3.17 kB
/** * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Sebastian Bittrich <sebastian.bittrich@rcsb.org> * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { __assign, __awaiter, __generator } from "tslib"; import { ParamDefinition as PD } from '../../mol-util/param-definition'; import { ShrakeRupleyComputationParams, AccessibleSurfaceArea } from './accessible-surface-area/shrake-rupley'; import { Unit } from '../../mol-model/structure'; import { CustomStructureProperty } from '../common/custom-structure-property'; import { QuerySymbolRuntime } from '../../mol-script/runtime/query/compiler'; import { CustomPropSymbol } from '../../mol-script/language/symbol'; import { Type } from '../../mol-script/language/type'; import { CustomPropertyDescriptor } from '../../mol-model/custom-property'; export var AccessibleSurfaceAreaParams = __assign({}, ShrakeRupleyComputationParams); export var AccessibleSurfaceAreaSymbols = { isBuried: QuerySymbolRuntime.Dynamic(CustomPropSymbol('computed', 'accessible-surface-area.is-buried', Type.Bool), function (ctx) { if (!Unit.isAtomic(ctx.element.unit)) return false; var accessibleSurfaceArea = AccessibleSurfaceAreaProvider.get(ctx.element.structure).value; if (!accessibleSurfaceArea) return false; return AccessibleSurfaceArea.getFlag(ctx.element, accessibleSurfaceArea) === 1 /* Buried */; }), isAccessible: QuerySymbolRuntime.Dynamic(CustomPropSymbol('computed', 'accessible-surface-area.is-accessible', Type.Bool), function (ctx) { if (!Unit.isAtomic(ctx.element.unit)) return false; var accessibleSurfaceArea = AccessibleSurfaceAreaProvider.get(ctx.element.structure).value; if (!accessibleSurfaceArea) return false; return AccessibleSurfaceArea.getFlag(ctx.element, accessibleSurfaceArea) === 2 /* Accessible */; }), }; export var AccessibleSurfaceAreaProvider = CustomStructureProperty.createProvider({ label: 'Accessible Surface Area', descriptor: CustomPropertyDescriptor({ name: 'molstar_accessible_surface_area', symbols: AccessibleSurfaceAreaSymbols, // TODO `cifExport` }), type: 'root', defaultParams: AccessibleSurfaceAreaParams, getParams: function (data) { return AccessibleSurfaceAreaParams; }, isApplicable: function (data) { return true; }, obtain: function (ctx, data, props) { return __awaiter(void 0, void 0, void 0, function () { var p; var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: p = __assign(__assign({}, PD.getDefaultValues(AccessibleSurfaceAreaParams)), props); _a = {}; return [4 /*yield*/, AccessibleSurfaceArea.compute(data, p).runInContext(ctx.runtime)]; case 1: return [2 /*return*/, (_a.value = _b.sent(), _a)]; } }); }); } }); //# sourceMappingURL=accessible-surface-area.js.map