protvista-coloured-sequence
Advanced tools
Comparing version 2.1.0-alpha.2 to 2.1.0
{ | ||
"name": "protvista-coloured-sequence", | ||
"version": "2.1.0-alpha.2+ebb6e2a", | ||
"version": "2.1.0", | ||
"description": "Track that colors each base by a given function. The default funcion is hidrophobicity", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"dependencies": { | ||
"protvista-sequence": "^2.1.0-alpha.2+ebb6e2a", | ||
"protvista-sequence": "^2.1.0", | ||
"protvista-utils": "^2.0.4" | ||
@@ -25,3 +25,3 @@ }, | ||
}, | ||
"gitHead": "ebb6e2a22389fb7e847e970cbf5a47997b2c42ee" | ||
"gitHead": "85cdbc047a7088159a757bccd2d3c0907c768c7c" | ||
} |
@@ -99,2 +99,12 @@ import { select, scaleLinear } from "d3"; | ||
} | ||
const colorScale = scaleLinear(); | ||
if (this._color_range) { | ||
const customColorScale = ColorScaleParser(this._color_range); | ||
colorScale | ||
.domain(customColorScale.domain) | ||
.range(customColorScale.range); | ||
} else { | ||
colorScale.domain(defaultScale.domain).range(defaultScale.range); | ||
} | ||
const ftWidth = this.getSingleBaseWidth(); | ||
@@ -109,3 +119,11 @@ const first = Math.round(Math.max(0, this._displaystart - 2)); | ||
.map((aa, i) => { | ||
return { start: 1 + first + i, end: 1 + first + i, aa: aa }; | ||
// 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, | ||
end: 1 + first + i, | ||
aa, | ||
value, | ||
colour: colorScale(value) | ||
}; | ||
}); | ||
@@ -117,12 +135,2 @@ | ||
const colorScale = scaleLinear(); | ||
if (this._color_range) { | ||
const customColorScale = ColorScaleParser(this._color_range); | ||
colorScale | ||
.domain(customColorScale.domain) | ||
.range(customColorScale.range); | ||
} else { | ||
colorScale.domain(defaultScale.domain).range(defaultScale.range); | ||
} | ||
this.residues | ||
@@ -137,7 +145,3 @@ .enter() | ||
.attr("width", ftWidth) | ||
.attr("fill", ({ aa }) => { | ||
return colorScale( | ||
aa.toUpperCase() in scale ? scale[aa.toUpperCase()] : 0 // if the base is not in the given scale | ||
); | ||
}) | ||
.attr("fill", ({ colour }) => colour) | ||
.attr("x", ({ start }) => this.getXFromSeqPosition(start)) | ||
@@ -144,0 +148,0 @@ .call(this.bindEvents, this); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9801
264
1
0
Updatedprotvista-sequence@^2.1.0