@oncojs/lolliplot
Advanced tools
Comparing version 0.5.12 to 0.7.0
@@ -53,2 +53,6 @@ import invariant from 'invariant'; | ||
animate = _ref$animate === undefined ? true : _ref$animate, | ||
_ref$hasCustomMutatio = _ref.hasCustomMutationColor, | ||
hasCustomMutationColor = _ref$hasCustomMutatio === undefined ? false : _ref$hasCustomMutatio, | ||
_ref$getMutationColor = _ref.getMutationColor, | ||
getMutationColor = _ref$getMutationColor === undefined ? function () {} : _ref$getMutationColor, | ||
_ref$onMutationClick = _ref.onMutationClick, | ||
@@ -85,8 +89,8 @@ onMutationClick = _ref$onMutationClick === undefined ? function () {} : _ref$onMutationClick, | ||
var consequences = groupByType('consequence', data.mutations); | ||
var impacts = groupByType('impact', data.mutations); | ||
var consequences = hasCustomMutationColor ? {} : groupByType('consequence', data.mutations); | ||
var impacts = hasCustomMutationColor ? {} : groupByType('impact', data.mutations); | ||
var colorScale = d3.schemeCategory20 ? d3.scaleOrdinal(d3.schemeCategory20).domain(d3.range(20)) : d3.scale.category20().domain(d3.range(20)); | ||
var consequenceColors = Object.keys(consequences).reduce(function (acc, type, i) { | ||
var consequenceColors = hasCustomMutationColor ? {} : Object.keys(consequences).reduce(function (acc, type, i) { | ||
var _Object$assign; | ||
@@ -216,2 +220,4 @@ | ||
scaleLinearY: scaleLinearY, | ||
hasCustomMutationColor: hasCustomMutationColor, | ||
getMutationColor: getMutationColor, | ||
onMutationClick: onMutationClick, | ||
@@ -288,3 +294,3 @@ onMutationMouseover: onMutationMouseover, | ||
var _setupStats = setupStats({ | ||
var _ref2 = hideStats ? {} : setupStats({ | ||
d3: d3, | ||
@@ -311,6 +317,6 @@ d3Root: d3Root, | ||
}), | ||
stats = _setupStats.stats, | ||
consequencesCheckboxContainers = _setupStats.consequencesCheckboxContainers, | ||
impactsCheckboxContainers = _setupStats.impactsCheckboxContainers, | ||
mutationCount = _setupStats.mutationCount; | ||
stats = _ref2.stats, | ||
consequencesCheckboxContainers = _ref2.consequencesCheckboxContainers, | ||
impactsCheckboxContainers = _ref2.impactsCheckboxContainers, | ||
mutationCount = _ref2.mutationCount; | ||
@@ -422,3 +428,3 @@ var draw = animator({ | ||
svg.remove(); | ||
stats.remove(); | ||
if (!hideStats) stats.remove(); | ||
}; | ||
@@ -425,0 +431,0 @@ |
@@ -8,2 +8,4 @@ import { halfPixel } from './spatial'; | ||
scaleLinearY = _ref.scaleLinearY, | ||
hasCustomMutationColor = _ref.hasCustomMutationColor, | ||
getMutationColor = _ref.getMutationColor, | ||
onMutationClick = _ref.onMutationClick, | ||
@@ -54,3 +56,3 @@ onMutationMouseover = _ref.onMutationMouseover, | ||
fill: function fill(d) { | ||
return consequenceColors[d.consequence]; | ||
return hasCustomMutationColor ? getMutationColor(d) : consequenceColors[d.consequence]; | ||
} | ||
@@ -57,0 +59,0 @@ }).on('mouseover', function (d) { |
@@ -98,2 +98,6 @@ 'use strict'; | ||
animate = _ref$animate === undefined ? true : _ref$animate, | ||
_ref$hasCustomMutatio = _ref.hasCustomMutationColor, | ||
hasCustomMutationColor = _ref$hasCustomMutatio === undefined ? false : _ref$hasCustomMutatio, | ||
_ref$getMutationColor = _ref.getMutationColor, | ||
getMutationColor = _ref$getMutationColor === undefined ? function () {} : _ref$getMutationColor, | ||
_ref$onMutationClick = _ref.onMutationClick, | ||
@@ -130,8 +134,8 @@ onMutationClick = _ref$onMutationClick === undefined ? function () {} : _ref$onMutationClick, | ||
var consequences = (0, _groupByType2.default)('consequence', data.mutations); | ||
var impacts = (0, _groupByType2.default)('impact', data.mutations); | ||
var consequences = hasCustomMutationColor ? {} : (0, _groupByType2.default)('consequence', data.mutations); | ||
var impacts = hasCustomMutationColor ? {} : (0, _groupByType2.default)('impact', data.mutations); | ||
var colorScale = d3.schemeCategory20 ? d3.scaleOrdinal(d3.schemeCategory20).domain(d3.range(20)) : d3.scale.category20().domain(d3.range(20)); | ||
var consequenceColors = Object.keys(consequences).reduce(function (acc, type, i) { | ||
var consequenceColors = hasCustomMutationColor ? {} : Object.keys(consequences).reduce(function (acc, type, i) { | ||
var _Object$assign; | ||
@@ -261,2 +265,4 @@ | ||
scaleLinearY: scaleLinearY, | ||
hasCustomMutationColor: hasCustomMutationColor, | ||
getMutationColor: getMutationColor, | ||
onMutationClick: onMutationClick, | ||
@@ -333,3 +339,3 @@ onMutationMouseover: onMutationMouseover, | ||
var _setupStats = (0, _stats.setupStats)({ | ||
var _ref2 = hideStats ? {} : (0, _stats.setupStats)({ | ||
d3: d3, | ||
@@ -356,6 +362,6 @@ d3Root: d3Root, | ||
}), | ||
stats = _setupStats.stats, | ||
consequencesCheckboxContainers = _setupStats.consequencesCheckboxContainers, | ||
impactsCheckboxContainers = _setupStats.impactsCheckboxContainers, | ||
mutationCount = _setupStats.mutationCount; | ||
stats = _ref2.stats, | ||
consequencesCheckboxContainers = _ref2.consequencesCheckboxContainers, | ||
impactsCheckboxContainers = _ref2.impactsCheckboxContainers, | ||
mutationCount = _ref2.mutationCount; | ||
@@ -467,3 +473,3 @@ var draw = (0, _animator2.default)({ | ||
svg.remove(); | ||
stats.remove(); | ||
if (!hideStats) stats.remove(); | ||
}; | ||
@@ -470,0 +476,0 @@ |
@@ -18,2 +18,4 @@ 'use strict'; | ||
scaleLinearY = _ref.scaleLinearY, | ||
hasCustomMutationColor = _ref.hasCustomMutationColor, | ||
getMutationColor = _ref.getMutationColor, | ||
onMutationClick = _ref.onMutationClick, | ||
@@ -64,3 +66,3 @@ onMutationMouseover = _ref.onMutationMouseover, | ||
fill: function fill(d) { | ||
return consequenceColors[d.consequence]; | ||
return hasCustomMutationColor ? getMutationColor(d) : consequenceColors[d.consequence]; | ||
} | ||
@@ -67,0 +69,0 @@ }).on('mouseover', function (d) { |
16
index.js
@@ -41,2 +41,4 @@ // @flow | ||
animate?: bool, | ||
hasCustomMutationColor?: bool, | ||
getMutationColor?: Function, | ||
onMutationClick?: Function, | ||
@@ -77,2 +79,4 @@ onMutationMouseover?: Function, | ||
animate = true, | ||
hasCustomMutationColor = false, | ||
getMutationColor = () => {}, | ||
onMutationClick = () => {}, | ||
@@ -104,4 +108,4 @@ onMutationMouseover = () => {}, | ||
let consequences = groupByType(`consequence`, data.mutations) | ||
let impacts = groupByType(`impact`, data.mutations) | ||
let consequences = hasCustomMutationColor ? {} : groupByType(`consequence`, data.mutations) | ||
let impacts = hasCustomMutationColor ? {} : groupByType(`impact`, data.mutations) | ||
@@ -112,3 +116,3 @@ let colorScale = d3.schemeCategory20 | ||
let consequenceColors = Object.keys(consequences).reduce((acc, type, i) => ({ | ||
let consequenceColors = hasCustomMutationColor ? {} : Object.keys(consequences).reduce((acc, type, i) => ({ | ||
...acc, | ||
@@ -264,2 +268,4 @@ [type]: colorScale(i * 3), | ||
scaleLinearY, | ||
hasCustomMutationColor, | ||
getMutationColor, | ||
onMutationClick, | ||
@@ -342,3 +348,3 @@ onMutationMouseover, | ||
mutationCount, | ||
} = setupStats({ | ||
} = hideStats ? {} : setupStats({ | ||
d3, | ||
@@ -473,3 +479,3 @@ d3Root, | ||
svg.remove() | ||
stats.remove() | ||
if (!hideStats) stats.remove() | ||
} | ||
@@ -476,0 +482,0 @@ |
@@ -10,2 +10,4 @@ // @flow | ||
scaleLinearY: Function, | ||
hasCustomMutationColor: bool, | ||
getMutationColor: Function, | ||
onMutationClick: Function, | ||
@@ -31,2 +33,4 @@ onMutationMouseover: ?Function, | ||
scaleLinearY, | ||
hasCustomMutationColor, | ||
getMutationColor, | ||
onMutationClick, | ||
@@ -74,3 +78,3 @@ onMutationMouseover, | ||
r: theme.mutationRadius, | ||
fill: d => consequenceColors[d.consequence], | ||
fill: d => hasCustomMutationColor ? getMutationColor(d) : consequenceColors[d.consequence], | ||
}) | ||
@@ -77,0 +81,0 @@ .on(`mouseover`, d => { |
@@ -29,3 +29,3 @@ { | ||
"name": "@oncojs/lolliplot", | ||
"version": "0.5.12", | ||
"version": "0.7.0", | ||
"description": "A protein viewer built with d3", | ||
@@ -32,0 +32,0 @@ "browser": "dist/umd/index.min.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
1838650
53
16802