Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
refresh() {
if (this.seq_g) {
const scale = this.getScaleFromAttribute();
if (scale === null) {
console.error("The attribute scale is not valid.");
return;
}
const colorScale = scaleLinear();
this.colorScale = defaultScale;
if (this._color_range) {
this.colorScale = ColorScaleParser(this._color_range);
}
colorScale.domain(this.colorScale.domain).range(this.colorScale.range);
const ftWidth = this.getSingleBaseWidth();
const first = Math.round(Math.max(0, this._displaystart - 2));
const last = Math.round(
Math.min(this.sequence.length, this._displayend + 1)
);
const bases = this.sequence
.slice(first, last)
.split("")
.map((aa, i) => {
// use 0 if the base is not in the given scale
const value = aa.toUpperCase() in scale ? scale[aa.toUpperCase()] : 0;
return {
start: 1 + first + i,