UNPKG

bio-vis-expression-bar

Version:

Simple barchart to show expression levels across experiments

2 lines 2.78 MB
/*! For license information please see bio-vis-expression-bar.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jQuery")):"function"==typeof define&&define.amd?define(["jQuery"],e):"object"==typeof exports?exports.biovisexpressionbar=e(require("jQuery")):t.biovisexpressionbar=e(t.jQuery)}(window,(function(t){return(()=>{var e={804:(t,e,n)=>{n(145),n(256),n(271);var r=n(684);n(921),n(891);var i=n(851),o=function(t){this.parent=t,this.opt=t.opt};o.prototype.renderScales=function(t){var e;100*this.calculateBarWidth()/this.opt.width<35?r.axisBottom(n).ticks(3):r.axisBottom(n).ticks(5);var n=this.ScaleRangeX();e=r.axisBottom(n).ticks(5);var i=this.parent.svgFootContainer.append("g").call(e).attr("class","x axis").attr("font-size",this.parent.opt.fontSize/1.4),o=(this.parent.opt.width-this.parent.opt.labelWidth)/this.parent.totalRenderedGenes*t+this.parent.opt.labelWidth;i.attr("transform","translate("+o+",0)")},o.prototype.renderGlobalScale=function(){this.parent.svgFootContainer.attr("height",20),$(`#${this.parent.chartSVGidFoot}`).css("display","block"),this._responseToScroll()},o.prototype.calculateBarWidth=function(){return(this.opt.width-this.opt.labelWidth)/this.parent.totalRenderedGenes-10},o.prototype.rangeX=function(){var t=this.calculateBarWidth(),e=r.scaleLinear().range([0,t]);return e.domain([this.parent.data.min,this.parent.maxInData()]),e},o.prototype.ScaleRangeX=function(){var t=this.calculateBarWidth(),e=r.scaleLinear().range([0,t]);return e.domain([this.parent.data.min,this.parent.maxInData()]),e},o.prototype.renderGeneBar=function(t){var e=this.parent,n=this.parent.data.renderedData[t],o=this.opt.barHeight,a=this.opt.labelWidth,s=this.rangeX(),c=(e.opt.sc,(e.opt.width-e.opt.labelWidth)/e.totalRenderedGenes*t+a),f=this,u=e.barGroup.append("g");for(var l in u.attr("transform","translate("+c+","+o+")"),n){var h=n[l],d=o*h.renderIndex;u.append("rect").attr("y",d).attr("height",o-2).attr("fill","white").attr("width",s(0)).on("mouseenter",(function(t,n){r.select(this).position(this).top,e.opt.barHeight;var o=e.opt.renderProperty+": "+i.numberWithCommas(n.value)+"\nsem: "+i.numberWithCommas(n.stdev);e.showTooltip(o,this,f.parent.tooltip,f.parent.tooltipBox,!1),e.showHighlightedFactors(n,this)})).on("mouseleave",(function(){e.hideTooltip(),e.hideHighlightedFactors()})).data([h]),u.append("line").attr("x1",0).attr("y1",d+o/2).attr("x2",0).attr("y2",d+o/2).attr("stroke-width",1).attr("stroke","black")}},o.prototype.refreshBar=function(t,e){var n=this.parent.data.renderedData[e],i=this.rangeX(),o=(this.opt.sc,this.opt.colorFactor),a=null,s=this.opt.barHeight;this.parent.isFactorPresent(o)||(o=this.parent.getDefaultColour());var c=function(t,e){return s*n[e].renderIndex};"renderGroup"!=o&&(a=this.parent.factorColors[o]);var f=this.parent.barGroup.selectAll("g").filter((function(t,n){return n==e}));rects=f.selectAll("rect").transition().duration(1e3).attr("width",(function(t,e){var r=n[e].value;return isNaN(r)&&(r=0),i(r)})).attr("fill",(function(t,e){var r="#222222";return"renderGroup"!=o&&(r=a[n[e].factors[o]]),r})).attr("y",c).each((function(t,e){var i=n[e];r.select(this).data([i])})),f.selectAll("line").transition().duration(1e3).attr("y1",(function(t,e){return c(0,e)+(s-2)/2})).attr("y2",(function(t,e){return c(0,e)+(s-2)/2})).attr("x2",(function(t,e){var r=i(n[e].value+n[e].stdev);return isNaN(r)&&(r=0),r})).attr("x1",(function(t,e){var r=n[e].value-n[e].stdev;return isNaN(r)&&(r=0),r<0&&(r=0),i(r)}))},o.prototype.refreshScale=function(){var t,e=this.parent.x;t=100*this.calculateBarWidth()/this.opt.width<35?r.axisBottom(e).ticks(3):r.axisBottom(e).ticks(5),this.parent.svgFootContainer.selectAll("g.x.axis").transition().duration(1e3).call(t)},o.prototype.showHighithRow=function(){void 0!==this.parent.selectionBox&&this.parent.selectionBox.attr("visibility","visible")},o.prototype.hideHidelightRow=function(){var t=this;void 0!==t.parent.selectionBox&&(t.parent.selectionBox.attr("visibility","hidden"),t.parent.selectionBoxGene.attr("visibility","hidden"),t.parent.selectionBoxTitles.attr("display","none"))},o.prototype._responseToScroll=function(){var t=this.parent.plotContainer,e=this.parent.sortDivId,n=this.parent.chartSVGidHead,r=this.parent.chartSVGidFoot,i=0;$(`#${t}`).on("scroll",(function(){var o=$(`#${t}`).scrollLeft();i!=o&&(i=o,$(`#${n}`).css("position","relative"),$(`#${n}`).css("left",-i),$(`#${r}`).css("position","relative"),$(`#${r}`).css("left",-i),$(`#${e}`).css("left",-i))}))},t.exports.BarPlot=o},851:(t,e,n)=>{var r=n(684);n(608),r.selection.prototype.position=function(){var t=this.node(),e=t.getBoundingClientRect(),n=function t(e){if("svg"===e.parentElement.tagName){var n=e.parentElement.getBoundingClientRect();return n.top=0,n.left=0,n}return t(e.parentElement)}(t);return{top:e.top-n.top,left:e.left-n.left,width:e.width,bottom:e.bottom-n.top,height:e.height,right:e.right-n.left}},t.exports.numberWithCommas=function(t){var e=t.toFixed(2).toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".")}},47:(t,e,n)=>{var r=n(256),o=n(271);n(921);var s=function(t,e){for(var n in t)this[n]="values"==n?this._sortGeneOrder(n,t[n]):t[n];this.opt=e,this.sortOrder=[]};s.prototype.getExpressionValueTypes=function(){var t=Object.keys(this.values);if(0==t.length)return[];var e=this.values[t[0]];return Object.keys(e)},s.prototype.mean=function(t){var e=Object.keys(t).map((function(e){return t[e].value})),n=.1*(e=e.sort()).length;return e.splice(0,n),e.splice(-1*n),r.stats.mean(e)},s.prototype.log2=function(t){var e=t;return e<1?0:Math.log2(e)},s.prototype.calculateLog2=function(){for(g in this.renderedData)for(v in this.renderedData[g]){var t=this.renderedData[g][v];for(d in t.stdev=this.log2(t.stdev),t.value=this.log2(t.value),t.data)t.data[d]=this.log2(t.data[d])}},s.prototype.setAvailableFactors=function(){var t=this.factorOrder,e=this.factorOrder,n=this.selectedFactors,r=this.opt.renderedOrder,i=this.opt.selectedFactors;void 0!==r&&(e=this.opt.renderedOrder),void 0!==i&&(n=this.opt.selectedFactors);var o=0;void 0!==this.renderedOrder&&(o=Object.keys(this.renderedOrder).length),0===o&&(this.renderedOrder=jQuery.extend(!0,{},e)),this.selectedFactors=jQuery.extend(!0,{},n);var a=this.defaultFactorOrder;for(var s in this.factors=new Map,a){var c=a[s];for(var f in t[c])this.factors.has(c)||this.factors.set(c,new Set),this.factors.get(c).add(f)}},s.prototype.prepareColorsForFactors=function(){this.totalColors=8;var t=this,e=[o.Pastel2[this.totalColors],o.Accent[this.totalColors],o.Dark2[this.totalColors],o.Set1[this.totalColors],o.Set2[this.totalColors],o.Paired[this.totalColors],o.Pastel1[this.totalColors],o.Set3[this.totalColors]];this.factorColors=new Map;var n=0;return this.factors.forEach((function(r,i,o){var a=new Map,s=n%t.totalColors,c=e[s],f=0;r.forEach((function(e){a[e]=c[f++%t.totalColors]})),n++,t.factorColors[i]=a})),t.factorColors},s.prototype.isFiltered=function(t){var e=!0;for(var n in t.factors){if(!this.selectedFactors[n])throw new Error("The factor "+n+" is not available ("+this.selectedFactors.keys+")");e&=this.selectedFactors[n][t.factors[n]]}return!e},s.prototype.getSortedKeys=function(t){var e=this.defaultFactorOrder[t],n=this.renderedOrder[e],r=[];for(var i in n)r.push(i);return r.sort((function(t,e){return n[t]-n[e]}))},s.prototype.sortRenderedGroups=function(){var t;if(0!=this.renderedData.length){var e=this.renderedData[0].slice(),n=this.sortOrder,r=this.renderedOrder,i=e.sort((function(e,i){for(t in n){var o=n[t];if(r[o][e.factors[o]]>r[o][i.factors[o]])return 1;if(r[o][e.factors[o]]<r[o][i.factors[o]])return-1}return e.id>i.id?1:-1}));for(t=0;t<i.length;t++)i[t].renderIndex=t;for(t=0;t<this.renderedData.length;t++)for(var o=0;o<i.length;o++)this.renderedData[t][i[o].id].renderIndex=i[o].renderIndex}},s.prototype.hasExpressionValue=function(t){for(var e in this.values)return void 0!==this.values[e][t]},s.prototype.getDefaultProperty=function(){for(var t in this.values){var e=this.values[t];for(var n in e)return n}},s.prototype.getGroupedData=function(t,e){var n=[];for(var r in this.values)if(this.opt.showHomoeologues||r===this.gene||r===this.compare){var i,o=0;if("ungrouped"===e){i=[];var a=this.values[r][t];for(var s in a){var c=a[s],f=this._prepareSingleObject(o,c);f.gene=r,this.isFiltered(f)||(i.push(f),o++)}n.push(i)}else"groups"===e?(i=this._fillGroupByExperiment(o++,r,t),n.push(i)):e.constructor===Array?(i=this._fillGroupByFactor(o++,r,t,e),n.push(i)):console.log("Not yet implemented")}return this.addMissingFactors(n),this.renderedData&&this.renderedData.length>0&&this.setRenderIndexes(n,this.renderedData),this.renderedData=n,this.isLog()&&this.calculateLog2(),this.calculateMinMax(),n},s.prototype.calculateStats=function(t){var e=r.stats.mean(t.data),n=Math.sqrt(r.stats.variance(t.data));t.value=e,t.stdev=n},s.prototype.isLog=function(){return this.opt.calculateLog},s.prototype.calculateMinMax=function(){var t=-1/0,e=1/0,n=this.isLog();for(var r in this.renderedData)for(var i in this.renderedData[r]){var o=this.renderedData[r][i],a=o.value;n||(a+=o.stdev),a>t&&(t=a),a<e&&(e=a)}e=0,this.max=t,this.min=e},s.prototype._prepareSingleObject=function(t,e){var n=JSON.parse(JSON.stringify(e));n.renderIndex=t,n.id=t,n.name=this.experiments[n.experiment].name,n.data=[],n.data.push(e.value),n.value=e.value,n.stdev=0;var r=this.experiments[n.experiment].group;return n.factors=this.groups[r].factors,n},s.prototype._prepareGroupedByExperiment=function(t,e){var n={};return n.renderIndex=t,n.id=t,n.name=this.data.groups[e].description,n.data=[],n.factors=this.data.groups[e].factors,n.value=0,n.stdev=0,n},s.prototype._prepareGroupedByFactor=function(t,e){var n={};return n.renderIndex=t,n.id=t,n.name=e,n.data=[],n.factors={},n.value=0,n.stdev=0,n},s.prototype._fillGroupByExperiment=function(t,e,n){var r,i={},o=[],a=this.values[e][n],s=this.groups,c=this.experiments,f=t;for(r in s)(u=this._prepareGroupedByExperiment(f++,r)).gene=e,i[r]=u;for(r in c)i[c[r].group].data.push(a[r].value);for(r in f=t,i){var u;(u=i[r]).gene=e,this.calculateStats(u),this.isFiltered(u)||(u.renderIndex=f,u.id=f++,o.push(u))}return o},s.prototype._fillGroupByFactor=function(t,e,n,r){var i,o={},a=[],s=this.values[e][n],c=this.groups,f=this.experiments,u=[],l=t;for(i in c){var h=this.getGroupFactorDescription(c[i],r),d=this.getGroupFactorLongDescription(c[i],r);if(-1===u.indexOf(h)){(v=this._prepareGroupedByFactor(l++,h)).gene=e,v.longDescription=d;var p=this.getGroupFactor(c[i],r);v.factors=p,o[h]=v,u.push(h)}}for(i in l=t,f)if(void 0!==s[i]){var g=c[f[s[i].experiment].group];this.isFiltered(g)||o[h=this.getGroupFactorDescription(c[f[i].group],r)].data.push(s[i].value)}for(i in o){var v;0!==(v=o[i]).data.length&&(this.calculateStats(v),this.isFiltered(v)||(v.renderIndex=l,v.id=l++,a.push(v)))}return a},s.prototype.addNames=function(t){var e=t.factors,n=(this.longFactorName,e.length,[]);for(var r in e)n.push(r);t.name=this.getGroupFactorDescription(t,n),t.longDescription=this.getGroupFactorLongDescription(t,n)},s.prototype.getGroupFactorDescription=function(t,e){var n=[],r=this.longFactorName,i=e.length;for(var o in e){var a=r[e[o]],s=t.factors[e[o]];void 0===s&&(console.error(e[o]+" is not present in "+t.factors),console.error(t.factors));var c=a[s];n[o-0]=c,(i>4||c.length>20)&&(n[o-0]=s)}return n.join(", ")},s.prototype.getGroupFactorLongDescription=function(t,e){var n=[],r=this.longFactorName;for(var i in e.length,e){var o=r[e[i]][t.factors[e[i]]];n[i]=o}return n.join(", ")},s.prototype.getGroupFactor=function(t,e){var n={};for(var r in e)n[e[r]]=t.factors[e[r]];return n},s.prototype.setRenderIndexes=function(t,e){for(var n in t){var r=e[n];for(var i in r)t[n][i].renderIndex=e[0][i].renderIndex}},s.prototype._equals=function(t,e){for(a in t)if(t[a]!=e[a])return!1;for(a in e)if(t[a]!=e[a])return!1;return!0},s.prototype._arrayContains=function(t,e){for(i in t)if(this._equals(t[i],e))return i;return-1},s.prototype.addMissingFactors=function(t){var e=[];for(var n in t){var r=t[n];for(var i in r)factors=t[n][i].factors,-1==this._arrayContains(e,factors)&&e.push(factors)}var o=[];for(var n in t){r=t[n];var a=[],s=[],c=[];for(var i in r)a.push(t[n][i].factors),s.push(t[n][i]);for(var i in e){var f=this._arrayContains(a,e[i]);if(i=parseInt(i),f>=0)c.push(s[f]);else{var u=this._prepareGroupedByFactor(i,"");u.gene=r[0].gene,u.factors=e[i],c.push(u)}}for(var i in c)c[i=parseInt(i)].id=i,c[i].renderIndex=i,this.addNames(c[i]);o.push(c)}for(var i in o)t[i]=o[i]},s.prototype.addSortPriority=function(t,e){e=void 0===e||e,this.removeSortPriority(t),!0===e?this.sortOrder.push(t):this.sortOrder.unshift(t)},s.prototype.removeSortPriority=function(t){void 0!==this.sortOrder&&null!==this.sortOrder||(this.sortOrder=[]);var e=this.sortOrder.indexOf(t);e>-1&&this.sortOrder.splice(e,1)},s.prototype._sortGeneOrder=function(t,e){var n,r={};if(void 0===this.tern||$.isEmptyObject(this.tern))return e;for(var i=0;i<Object.keys(this.tooltip_order).length;i++)void 0!==e[n=this.tern[this.tooltip_order[i]]]&&(r[n]=e[n]);return r},t.exports.ExpressionData=s},315:(t,e,n)=>{var r=n(145),i=n(271),o=n(684),a=r,s=n(851);n(921);var c=function(t){this.parent=t,this.data=t.data,this.opt=t.opt};c.prototype.calculateBarWidth=function(){return(this.opt.width-this.opt.labelWidth)/this.parent.totalRenderedGenes},c.prototype.rangeX=function(t){var e=o.scaleLinear().range([0,t]);return e.domain([this.parent.data.min,this.parent.data.max]),e},c.prototype.renderGeneBar=function(t){var e=this.parent,n=this.parent.data.renderedData[t],r=this.calculateBarWidth(),i=this.opt.barHeight,a=this.opt.labelWidth,c=(e.opt.sc,(e.opt.width-e.opt.labelWidth)/e.totalRenderedGenes*t+a),f=this,u=e.barGroup.append("g");for(var l in u.attr("transform","translate("+c+","+i+")"),n){var h=n[l],d=i*h.renderIndex;u.append("rect").attr("y",d).attr("height",i-2).attr("fill","white").attr("width",r).on("mouseenter",(function(t,n){o.select(this).position(this);var r=n.gene+"\n"+e.opt.renderProperty+": "+s.numberWithCommas(n.value)+"\nsem:"+s.numberWithCommas(n.stdev);e.showTooltip(r,this,f.parent.tooltip,f.parent.tooltipBox,!1),e.showHighlightedFactors(n,this)})).on("mouseleave",(function(){e.hideTooltip(),e.hideHighlightedFactors()})).data([h])}},c.prototype.domain=function(){return[this.parent.data.min,(this.parent.data.max+this.parent.data.min)/2,this.parent.data.max]},c.prototype.rangeColor=function(){return this.buckets=9,this.colors=i.YlGnBu[this.buckets],this.colors=[this.colors[0],this.colors[4],this.colors[8]],o.scaleLinear().domain(this.domain()).range(this.colors)},c.prototype.renderScales=function(t){},c.prototype.setGradient=function(){var t=this.parent.svgFootContainer;t.select("#gradient").remove();for(var e=t.append("defs").append("linearGradient").attr("id","gradient").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%").attr("spreadMethod","pad"),n=0;n<this.colors.length;n++){var r=100*n/(this.colors.length-1);e.append("stop").attr("offset",r+"%").attr("stop-color",this.colors[n]).attr("stop-opacity",1)}},c.prototype.renderGlobalScale=function(){var t=this.parent.svgFootContainer;t.attr("height",60),this.rangeColor(),this.scaleWidth=this.parent.getTitleFactorWidth(),this.setGradient(),this.rectScale=t.append("rect").attr("width",this.scaleWidth).attr("height",20).style("fill","url(#gradient)");var e=this.rangeX(this.scaleWidth),n=o.axisBottom(e).ticks(5),r=t.append("g").call(n).attr("class","x axis").attr("font-size",this.parent.opt.fontSize/1.4),i=this.parent.getTitleSetOffset();r.attr("transform","translate("+i+",20)"),this.rectScale.attr("transform","translate("+i+",0)");var a=i+this.scaleWidth/2;this.scaleUnits=t.append("text").attr("y",50).attr("x",a),this.setScaleText(this.opt.renderProperty),this._responseToScroll()},c.prototype.setScaleText=function(t){var e=this.parent.getTitleSetOffset();this.parent.opt.calculateLog&&(t="\nLog₂ ("+t+")"),this.scaleUnits.text(t);var n=this.scaleUnits.node().getBBox().width,r=e+this.scaleWidth/2-n/2;this.scaleUnits.transition().duration(1e3).attr("x",r)},c.prototype.refreshScale=function(){var t=this.rangeX(this.scaleWidth),e=o.axisBottom(t).ticks(5),n=this.parent.svgFootContainer.selectAll("g.x.axis");this.setScaleText(this.opt.renderProperty),this.setGradient(),n.transition().duration(1e3).call(e)},c.prototype.refreshBar=function(t,e){var n=this.parent.data.renderedData[e],r=this.rangeColor(),i=this.opt.barHeight;this.parent.barGroup.selectAll("g").filter((function(t,n){return n==e})).selectAll("rect").transition().duration(1e3).attr("fill",(function(t,e){var i=n[e].value;return isNaN(i)&&(i=0),r(i)})).attr("y",(function(t,e){return i*n[e].renderIndex+0})).each((function(t,e){var r=n[e];o.select(this).data([r])}))},c.prototype.showHighithRow=function(){var t=this;void 0!==t.parent.selectionBox&&(t.parent.selectionBox.attr("visibility","visible"),t.parent.selectionBoxGene.attr("visibility","visible"),t.parent.selectionBoxTitles.attr("display","inline"))},c.prototype.hideHidelightRow=function(){var t=this;void 0!==t.parent.selectionBox&&(t.parent.selectionBox.attr("visibility","hidden"),t.parent.selectionBoxGene.attr("visibility","hidden"),t.parent.selectionBoxTitles.attr("display","none"))},c.prototype._responseToScroll=function(){var t=this.parent.plotContainer,e=this.parent.sortDivId,n=this.parent.chartSVGidHead,r=0;a(`#${t}`).scroll((function(){var i=a(`#${t}`).scrollLeft();r!=i&&(r=i,a(`#${n}`).css("position","relative"),a(`#${n}`).css("left",-r),a(`#${e}`).css("left",-r))}))},t.exports.HeatMap=c},907:(t,e,n)=>{n(256),n(271);var r=n(684);n(921),n(851);var i=n(145),o={width:.6*i(window).width(),height:i(window).height(),side:.5*i(window).height(),margin:{top:100,left:50,bottom:50,right:50},axis_labels:["A","B","C"],axis_ticks:[0,20,40,60,80,100],tickLabelMargin:10,axisLabelMargin:40,ternColors:{left:"#579D1C",right:"#FF950E",bottom:"#4B1F6F"},expressionBiasUnit:["tpm"]},a=function(t){this.parent=t,this.opt=o,this.selector=t.chartSVGid};a.prototype.renderScales=function(t){},a.prototype.renderGlobalScale=function(){this.parent.opt.barHeight;var t=this.parent.opt.labelWidth,e=(this.parent.plotContainer,this.parent.opt.headerOffset,this.parent.data),n=this;i("#bar_expression_viewer_options").height(),o.width=i(document).width()-t,o.height=window.innerHeight,o.side=o.width,i(`#${this.parent.chartSVGidFoot}`).css("display","none"),plotContainer=r.select("#"+this.selector),svg=plotContainer.append("g").attr("id","ternaryPlotSVG").attr("width",i(document).width()).attr("height",i("#"+this.selector).height()).attr("transform",`translate(${t},-20)`).style("font-family",this.parent.opt.fontFamily),void 0!==e.expression_bias&&this._drawBlockDivisions(),ternaryPlotGroup=svg.append("g").attr("id","ternaryPlotGroup"),axes=ternaryPlotGroup.append("g"),this._calculateplotSize(),corners=[[o.margin.left,h+o.margin.top],[w+o.margin.left,h+o.margin.top],[w/2+o.margin.left,o.margin.top]],e.tern_order&&(o.axis_labels=e.tern_order),this._drawCornerLabels(),o.axis_ticks.forEach((function(t){var e=n._getFourCoords(t);n._drawAxis(e[0],e[1],o.ternColors.left),n._drawAxis(e[1],e[2],o.ternColors.right),n._drawAxis(e[2],e[3],o.ternColors.bottom),n._drawTicks(e[0],60,"end",-o.tickLabelMargin,t,o.ternColors.left),n._drawTicks(e[1],-60,"end",-o.tickLabelMargin,100-t,o.ternColors.right),n._drawTicks(e[2],0,"start",o.tickLabelMargin,t,o.ternColors.bottom)}));var a=w/2+o.margin.right/2,s=w/2+o.margin.left/2,c=h/2+o.margin.bottom;this._drawLeftArrows(30,30,o.ternColors.left,s),this._drawRightArrows(30,30,o.ternColors.bottom,a),this._drawBottomArrows(90,30,o.ternColors.right,c),this._adustTernaryHeight(),this._responseToScroll()},a.prototype.calculateBarWidth=function(){},a.prototype.rangeX=function(){},a.prototype.ScaleRangeX=function(){},a.prototype.renderGeneBar=function(t){if(0==t){var e=this.parent.data.renderedData,n=this.parent.data.tern_order,o=-1!=this.opt.expressionBiasUnit.indexOf(this.parent.opt.renderProperty),a=this.parent.data.tern,s=this,c=new Map;n.forEach((function(t){for(var n=0;n<e.length;n++)for(var r in a)e[n][0].gene===a[r]&&r===t&&c.set(t,e[n])}));var f=[],u=r.select("#bar_expression_viewer_chart_svg g").selectAll("text").nodes();for(t=0;t<u.length;t++)f.push(u[t].innerHTML);var l=[];f.forEach((function(t){l.push("circle"+s._generateHash(t))})),r.select("#bar_expression_viewer_chart_svg g").selectAll("text").attr("id",(function(t,e){return l[e]}));var h=[];for(t=0;t<c.values().next().value.length;t++){var d=new Map,p=[],g=0;n.forEach((function(e,r){p.push(c.get(e)[t].value),d.set(e,c.get(e)[t].value),d.set(`expval${e}`,c.get(e)[t].value),d.set("factors",c.get(e)[t].factors),g+=c.get(e)[t].value,2===r&&n.forEach((function(t,e){var n=d.get(t);d.set(t,n/g*100)}))}));var v=s._coord(p);d.set("cx",v[0]),d.set("cy",v[1]),d.set("id",l[t]),0!==g&&h.push(d)}var b=this._calculateCentroid(h),y=this._calculateExpressionBias(h,b);"tpm"===this.parent.opt.renderProperty&&(h=this._removeTPMDataUnderThreshold(h)),o?this._indicateExpressionBias(y):i("#expression-bias").hide(),h.unshift(b),this._loadData(h)}},a.prototype.refreshBar=function(t,e){},a.prototype.refreshScale=function(){},a.prototype.showHighithRow=function(){return 0},a.prototype.hideHidelightRow=function(){var t=this;void 0!==t.parent.selectionBox&&(t.parent.selectionBox.attr("visibility","hidden"),t.parent.selectionBoxGene.attr("visibility","hidden"),t.parent.selectionBoxTitles.attr("display","none"))},a.prototype._lineAttributes=function(t,e){return{x1:t[0],y1:t[1],x2:e[0],y2:e[1]}},a.prototype._coord=function(t){var e,n=t[0],r=t[1],i=t[2],o=[0,0];return 0!==(e=n+r+i)&&(n/=e,r/=e,i/=e,o[0]=corners[0][0]*n+corners[1][0]*r+corners[2][0]*i,o[1]=corners[0][1]*n+corners[1][1]*r+corners[2][1]*i),o},a.prototype._getFourCoords=function(t){var e=[];return e.push(this._coord([t,0,100-t])),e.push(this._coord([t,100-t,0])),e.push(this._coord([0,100-t,t])),e.push(this._coord([100-t,0,t])),e},a.prototype._scale=function(){return[p[0]*factor,p[1]*factor]},a.prototype._loadData=function(t){var e=this,n=this.parent.opt.colorFactor,o=null,a=(this.parent.data.tern_order,this.parent.data.tooltip_order,this.parent.plotContainer);this.parent.isFactorPresent(n)||(n=this.parent.getDefaultColour()),"renderGroup"!=n&&(o=this.parent.factorColors[n]);var s=ternaryPlotGroup.selectAll("circle").data(t);return s.exit().remove(),s.enter().append("circle").attr("r",6).attr("cx",w/2).attr("cy",h/2).merge(s).transition().attr("cx",(function(t){return t.get("cx")})).attr("cy",(function(t){return t.get("cy")})).attr("id",(function(t){return t.get("id")})).attr("display",(function(t){return"centroid"===t.get("id")?"none":"block"})).style("fill",(function(t,e){var r="red";return"renderGroup"!=n&&"centroid"!==t.get("id")&&(r=o[t.get("factors")[n]]),r})).style("stroke","#222222").style("stroke-width",2),s.on("mouseenter",(function(){initialScrollValue=i(`#${a}`).scrollTop();var t=r.select(this);t.attr("id"),r.select(`text#${t.attr("id")}`).style("fill","red"),e._indicateCircle("",t)})),s.on("mouseleave",(function(){var t=r.select(this);r.select(`text#${t.attr("id")}`).style("fill","black"),e._setDefaultStateCircle(t)})),i("#conditions text").on("mouseenter",(function(){try{e.parent.selectionBox.attr("visibility","visible"),e.parent.selectionBox.attr("width",e.parent.opt.labelWidth);var t="circle"+e._generateHash(this.innerHTML),n=r.select("circle#"+t);i("#ternaryPlotGroup").get(0).appendChild(n.node()),e._indicateCircle("",n)}catch(t){console.warn(`${this.innerHTML} has no value`)}})),i("#conditions text").on("mouseleave",(function(){e.parent.selectionBox.attr("visibility","hidden");var t="circle"+e._generateHash(this.innerHTML),n=r.select("circle#"+t);e._setDefaultStateCircle(n)})),this},a.prototype._generateHash=function(t){var e,n=0;if(0===t.length)return n;for(e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return n},a.prototype._drawAxis=function(t,e,n){var r=this._lineAttributes(t,e);axes.append("line").attr("x1",r.x1).attr("x2",r.x2).attr("y1",r.y1).attr("y2",r.y2).style("stroke",n).style("stroke-width",.5)},a.prototype._drawTicks=function(t,e,n,r,i,o){axes.append("g").attr("transform",(function(e){return"translate("+t[0]+","+t[1]+")"})).append("text").attr("transform",`rotate(${e})`).attr("text-anchor",n).attr("x",r).text(i).style("font-weight","lighter").style("font-size","1rem").style("fill",o)},a.prototype._drawBlockDivisions=function(){var t=this.parent.data,e=this.parent.chartSVGidHead,n=this.parent.opt.labelWidth,i=this.parent.opt.headerOffset,o=r.select(`#${e}`).append("g").attr("id","expression-bias"),a=25,s=Object.keys(t.expression_bias).length;o.append("text").text("Homoeolog Expression Bias").attr("x",n).attr("y",i-40*s);for(var c=0;c<s;c++){o.append("text").text(Object.keys(t.expression_bias)[c]).attr("text-anchor","end").attr("x",n).attr("y",i-50-8+c*a);for(var f=o.append("g").attr("id",`block-group-${c}`),u=Object.values(t.expression_bias)[c].length,l=0;l<u;l++)f.append("rect").attr("width",a).attr("height",a).style("stroke-width",2).style("stroke","black").style("fill","white").attr("x",l*a+n+5).attr("y",i-75+c*a);c===Object.keys(t.expression_bias).length-1&&(f.append("text").style("font-size",12).text("Stable").attr("text-anchor","middle").attr("x",n).attr("y",i-a+20),f.append("text").style("font-size",12).text("Dynamic").attr("text-anchor","middle").attr("x",a*u+n).attr("y",i-a+20))}this._renderExpBiasTooltip()},a.prototype._getDegree=function(t){return t/180*Math.PI},a.prototype._drawRightArrows=function(t,e,n,r){var i=this.parent.data,a=o.axis_ticks[o.axis_ticks.length-1]/2,s=this._getFourCoords(a),c=r*Math.cos(this._getDegree(t)),f=-r*Math.sin(this._getDegree(t)),u=10*Math.cos(this._getDegree(e)),l=10*Math.sin(this._getDegree(e)),h=this._lineAttributes(s[0],s[1]),d=axes.append("g").attr("transform",`translate(${c}, ${f})`);d.append("line").attr("x1",h.x1).attr("x2",h.x2).attr("y1",h.y1).attr("y2",h.y2).style("stroke",n),d.append("line").attr("x1",h.x1).attr("x2",h.x1+u).attr("y1",h.y1).attr("y2",h.y1+l).style("stroke",n),u=10*Math.cos(this._getDegree(e+60)),l=10*Math.sin(this._getDegree(e+60)),d.append("line").attr("x1",h.x1).attr("x2",h.x1+u).attr("y1",h.y1).attr("y2",h.y1+l).style("stroke",n),d.append("text").text(i.tern[i.tern_order[2]]).attr("x",h.x1).attr("y",h.y1-20).attr("transform",`rotate(60, ${h.x1}, ${h.y1})`).style("fill",n)},a.prototype._drawLeftArrows=function(t,e,n,r){var i=this.parent.data,a=o.axis_ticks[o.axis_ticks.length-1]/2,s=this._getFourCoords(a),c=-r*Math.cos(this._getDegree(t)),f=-r*Math.sin(this._getDegree(t)),u=10*Math.cos(this._getDegree(e)),l=10*Math.sin(this._getDegree(e)),h=this._lineAttributes(s[1],s[2]),d=axes.append("g").attr("transform",`translate(${c}, ${f})`);d.append("line").attr("x1",h.x1).attr("x2",h.x2).attr("y1",h.y1).attr("y2",h.y2).style("stroke",n),d.append("line").attr("x1",h.x1).attr("x2",h.x1+u).attr("y1",h.y1).attr("y2",h.y1-l).style("stroke",n),u=10*Math.cos(this._getDegree(e+60)),l=10*Math.sin(this._getDegree(e+60)),d.append("line").attr("x1",h.x1).attr("x2",h.x1+u).attr("y1",h.y1).attr("y2",h.y1-l).style("stroke",n),d.append("text").text(i.tern[i.tern_order[0]]).attr("x",h.x1).attr("y",h.y1-20).attr("transform",`rotate(-60, ${h.x1}, ${h.y1})`).style("fill",n)},a.prototype._drawBottomArrows=function(t,e,n,r){var i=this.parent.data,a=o.axis_ticks[o.axis_ticks.length-1]/2,s=this._getFourCoords(a),c=r*Math.cos(this._getDegree(t)),f=r*Math.sin(this._getDegree(t)),u=10*Math.cos(this._getDegree(e)),l=10*Math.sin(this._getDegree(e)),h=this._lineAttributes(s[2],s[3]),d=axes.append("g").attr("transform",`translate(${c}, ${f})`);d.append("line").attr("x1",h.x1).attr("x2",h.x2).attr("y1",h.y1).attr("y2",h.y2).style("stroke",n),d.append("line").attr("x1",h.x1).attr("x2",h.x1-u).attr("y1",h.y1).attr("y2",h.y1+l).style("stroke",n),d.append("line").attr("x1",h.x1).attr("x2",h.x1-u).attr("y1",h.y1).attr("y2",h.y1-l).style("stroke",n),d.append("text").text(i.tern[i.tern_order[1]]).attr("x",h.x2).attr("y",h.y2+20).style("fill",n)},a.prototype._drawCornerLabels=function(){console.log(o),axes.selectAll(".axis-title").data(o.axis_labels).enter().append("g").attr("transform",(function(t,e){return"translate("+corners[e][0]+","+corners[e][1]+")"})).style("font-size","1.3rem").append("text").text((function(t){return t})).style("fill",(function(t,e){return 0===e?o.ternColors.left:1===e?o.ternColors.right:2===e?o.ternColors.bottom:void 0})).attr("text-anchor",(function(t,e){return 0===e?"end":2===e?"middle":"start"})).attr("transform",(function(t,e){var n=0;return 0===e&&(n=120),1===e&&(n=60),2===e&&(n=-90),`translate(${o.axisLabelMargin*Math.cos(.0174532925*n)},${o.axisLabelMargin*Math.sin(.0174532925*n)})`}))},a.prototype._responseToScroll=function(){var t=this.parent.plotContainer,e=this.parent.opt.labelWidth,n=this.parent.sortDivId,o=this.parent.chartSVGidHead,a=0;"undefined"==typeof scrollValue&&(scrollValue=i(`#${t}`).scrollTop()),i(`#${t}`).scroll((function(){"undefined"==typeof initialScrollValue&&(initialScrollValue=0),scrollValue=i(`#${t}`).scrollTop();var s=scrollValue-initialScrollValue,c=i(`#${t}`).scrollLeft();r.select("#ternaryPlotSVG").attr("transform",`translate(${e},${-20+scrollValue})`),i("#toolTipRect").attr("transform",`translate(0,${s})`),i("#toolTipText").attr("transform",`translate(0,${s})`),i(".tempTextElement").attr("transform",`translate(0,${s})`),a!=c&&(a=c,i(`#${o}`).css("position","relative"),i(`#${o}`).css("left",-a),i(`#${n}`).css("left",-a))})),"undefined"!=typeof scrollValue&&r.select("#ternaryPlotSVG").attr("transform",`translate(${e},${-20+scrollValue})`)},a.prototype._calculateCentroid=function(t){var e=0,n=0,r=0,i=new Map;for(var o in t)e+=t[o].get("A"),n+=t[o].get("B"),r+=t[o].get("D");e/=t.length,n/=t.length,r/=t.length;var a=this._coord([e,r,n]);return i.set("id","centroid"),i.set("A",e),i.set("B",n),i.set("D",r),i.set("cx",a[0]),i.set("cy",a[1]),i},a.prototype._calculateExpressionBias=function(t,e){var n=0,r=[],i=[],o=[];for(var a in t){var s=t[a].get("A")-e.get("A"),c=t[a].get("B")-e.get("B"),f=t[a].get("D")-e.get("D");n+=Math.sqrt(Math.pow(s,2)+Math.pow(c,2)+Math.pow(f,2)),r.push(s),i.push(c),o.push(f)}return n/t.length},a.prototype._indicateExpressionBias=function(t){var e=this.parent.data,n=Object.keys(e.expression_bias).length,o=Object.keys(e.expression_bias),a=this,s=[],c=e.expression_bias_colors;i("#expression-bias").show();for(var f=0;f<n;f++){var u=Object.values(e.expression_bias[o[f]]);u.unshift(0);var l=0;for(var h in u)if(u[h]-t/100>0){l=u.indexOf(u[h]);break}s[f]=`Average distance from centroid: ${t.toFixed(2)}`,s[f]+=`\nHomoeolog Expression bias decile: ${l}`,s[f]+=`\nHomoeolog Expression bias range: ${(100*u[l-1]).toFixed(2)} - ${(100*u[l]).toFixed(2)}`,void 0!==c?r.select(`#block-group-${f} rect:nth-child(${l})`).style("fill",c[Object.keys(c)[f]][l-1]):r.select(`#block-group-${f} rect:nth-child(${l})`).style("fill","red"),i(`#block-group-${f}`).on("mouseenter",(function(){var t=Number(i(this).attr("id").slice(-1)),e=r.select("#centroid");a._indicateCircle("Centroid: \n",e),a.parent.showTooltip(s[t],this,a.tooltip,a.tooltipBox,!0),e.attr("display","block"),a._renderLinesToCentroid()})),i(`#block-group-${f}`).on("mouseleave",(function(){var t=r.select("#centroid");a._setDefaultStateCircle(t),a._hideExpBiasTooltip(),t.attr("display","none"),a._hideLinesToCentroid()}))}},a.prototype._renderExpBiasTooltip=function(){var t=this.parent.opt.barHeight,e=this.parent.opt.fontSize,n=r.select("#expression-bias");this.tooltipBox=n.append("rect").attr("id","expBiasTooltipRect"),this.tooltip=n.append("text").attr("id","expBiasTooltipText"),this.tooltip.attr("x",0).attr("y",0).attr("height",t-2).attr("fill","white").attr("font-size",e/1.4).attr("visibility","hidden")},a.prototype._hideExpBiasTooltip=function(){this.tooltip.attr("visibility","hidden"),this.tooltipBox.attr("visibility","hidden"),r.selectAll(".tempTextElement").remove()},a.prototype._indicateCircle=function(t,e){var n=e.data(),r=this.parent.data.tooltip_order,o=this;e.attr("r",10),r.forEach((function(a,s){"centroid"===n[0].get("id")?(t+=`${a} : ${n[0].get(a).toFixed(2)}%`,i("#ternaryPlotGroup").get(0).appendChild(e.node())):t+=`${a} : ${n[0].get(a).toFixed(2)}% ${o.parent.opt.renderProperty}: ${n[0].get(`expval${a}`).toFixed(2)}`,s!==r.length-1&&(t+="\n")})),this.parent.showTooltip(t,e.node(),o.parent.tooltip,o.parent.tooltipBox)},a.prototype._setDefaultStateCircle=function(t){t.attr("r",6),this.parent.hideTooltip()},a.prototype._renderLinesToCentroid=function(){var t=ternaryPlotGroup.selectAll("circle").data(),e=r.select("#centroid").data(),n=[],i=this;n.push(e[0].get("cx")),n.push(e[0].get("cy")),t.forEach((function(t,e){var r=[];r.push(t.get("cx")),r.push(t.get("cy"));var o=i._lineAttributes(r,n);ternaryPlotGroup.append("line").attr("class","centroidLine").attr("x1",o.x1).attr("x2",o.x2).attr("y1",o.y1).attr("y2",o.y2).style("stroke","#f49090").style("stroke-width",1)}))},a.prototype._hideLinesToCentroid=function(){r.selectAll(".centroidLine").remove()},a.prototype._calculateplotSize=function(){var t=this.parent.opt.labelWidth,e=i(`#${this.parent.plotContainer}`).outerHeight()-20,n=i(`#${this.parent.chartSVGid}`).width()-t;i(`#${this.parent.opt.target}`).parent().width()-20<900||e<n?(h=e-150,w=Math.sqrt(4/3*(h*h))):(w=n-150,h=Math.sqrt(w*w-w/2*(w/2)))},a.prototype._adustTernaryHeight=function(){var t=i(`#${this.parent.plotContainer}`).height();i(`#${this.parent.chartSVGid}`).height()<=t?i(`#${this.parent.chartSVGid}`).height(t):i(`#${this.parent.chartSVGid}`).height("auto")},a.prototype._removeTPMDataUnderThreshold=function(t){var e=this.parent.data.tooltip_order,n=0,r=this.parent.data.opt.tpmThreshold;return t.filter((function(t,i){if(n=0,e.forEach((function(e,r){ternValue=t.get(`expval${e}`),n+=ternValue})),n>r)return t}))},t.exports.TernaryPlot=a},271:(t,e,n)=>{var r,i;void 0===(i="function"==typeof(r={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#