Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_setXScale(width, newList = undefined) {
if(newList !== undefined){
this.xList = newList
}
else {
this.xList = nest()
.key((d) => d.x)
.entries(this.data)
.map((d) => d.key);
}
this.xScale = scaleBand()
.domain(this.xList)
.range([0, width])
.padding(.05); // TODO: eliminate hard-coded value
}
_setXScale(dim={w:600}, xList=undefined){
if (xList === undefined){
xList = nest()
.key((d) => d.x) // group this.data by d.x
.entries(this.data)
.map((d) => d.key) // then return the unique list of d.x
.sort((a, b) => {return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;});
}
this.xScale = scaleBand() // reference: https://github.com/d3/d3-scale#scaleBand
.domain(xList) // perhaps it isn't necessary to store xList, it could be retrieved by xScale.domain
// .range([dim.left, dim.left+(dim.w/Math.sqrt(2))])
.range([0, dim.w/Math.sqrt(2)])
.padding(.05); // temporarily hard-coded value
}
_getCountsByGeo(tiles, geos) {
const counts = nest()
.key((d) => d.id)
.rollup((values) => values.length)
.entries(tiles)
const countHash = hashFromData(counts)
return geos.map((geo) => {
return {
key: geo,
value: countHash[geo] || 0,
}
}).sort((a, b) => a.key - b.key)
}
function buildVariantLookupTables(bmap){
bmap.rsLookUp = {};
bmap.varLookUp = {};
nest()
.key((d)=>d.x)
.entries(bmap.data)
.forEach((d)=> {
let v = d.values[0];
if(v.hasOwnProperty('snpId') === undefined) throw 'Input Error: RS ID lookup table is not built.';
if(v.hasOwnProperty('displayX') === undefined) throw 'Input Error: display label lookup table is not built.';
bmap.rsLookUp[d.key] = d.values[0].snpId;
bmap.varLookUp[d.key] = d.values[0].displayX;
});
}
.map(d => {
d[3] = nest()
.key(d => d.inBundleCount)
.rollup(leaves => sum(leaves, l => l.count))
.entries(Object.values(d[1]))
.map(d => {
d.key = parseInt(d.key, 10);
return d;
})
.sort((a, b) => b.key - a.key);
return d;
});