UNPKG

@rcsb/rcsb-saguaro

Version:
54 lines (53 loc) 1.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RcsbVariantDisplay = void 0; const RcsbAbstractDisplay_1 = require("./RcsbAbstractDisplay"); const RcsbD3VariantManager_1 = require("../RcsbD3/RcsbD3DisplayManager/RcsbD3VariantManager"); const RcsbD3ScaleFactory_1 = require("../RcsbD3/RcsbD3ScaleFactory"); class RcsbVariantDisplay extends RcsbAbstractDisplay_1.RcsbAbstractDisplay { constructor() { super(...arguments); this.aaList = ['G', 'A', 'V', 'L', 'I', 'S', 'T', 'C', 'M', 'D', 'N', 'E', 'Q', 'R', 'K', 'H', 'F', 'Y', 'W', 'P', '≡', '⊖']; this.yScale = RcsbD3ScaleFactory_1.RcsbD3ScaleFactory.getPointScale(); this.radius = 5; this.definedScale = false; this.rcsbD3VariantManager = new RcsbD3VariantManager_1.RcsbD3VariantManager(); } setScale() { if (typeof this.height() === "number") { this.yScale .domain(this.aaList) .range([2 * this.radius, this.height() - 2 * this.radius]); this.definedScale = true; } else { throw "FATAL ERROR: d3 scale unknown format"; } } plot(elements) { super.plot(elements); if (!this.definedScale) this.setScale(); const config = { elements: elements, radius: this.radius, xScale: this.xScale, yScale: this.yScale, height: this.height(), color: this._displayColor, trackG: this.g }; this.rcsbD3VariantManager.plot(config); } move() { const config = { elements: this.getElements(), xScale: this.xScale, yScale: this.yScale, height: this.height(), trackG: this.g }; this.rcsbD3VariantManager.move(config); } } exports.RcsbVariantDisplay = RcsbVariantDisplay;