@rcsb/rcsb-saguaro
Version:
RCSB 1D Feature Viewer
50 lines (49 loc) • 1.71 kB
JavaScript
import { RcsbAbstractDisplay } from "./RcsbAbstractDisplay";
import { RcsbD3VariantManager } from "../RcsbD3/RcsbD3DisplayManager/RcsbD3VariantManager";
import { RcsbD3ScaleFactory } from "../RcsbD3/RcsbD3ScaleFactory";
export class RcsbVariantDisplay extends 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.getPointScale();
this.radius = 5;
this.definedScale = false;
this.rcsbD3VariantManager = new 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);
}
}