-
-
Notifications
You must be signed in to change notification settings - Fork 193
/
async-needle.js
2 lines (2 loc) · 14.7 KB
/
async-needle.js
1
2
"use strict";(self.webpackChunkdash_bio=self.webpackChunkdash_bio||[]).push([[412],{8390:function(t,n,r){r.r(n),r.d(n,{default:function(){return it}});var e=r(9196),o=r.n(e),a=r(8660),i=r(1353);function u(t){return"[object Number]"===Object.prototype.toString.call(t)}var c=(0,i.Z)((function(t,n){if(!u(t)||!u(n))throw new TypeError("Both arguments to range must be numbers");for(var r=[],e=t;e<n;)r.push(e),e+=1;return r})),l=r(3993),s=(0,l.Z)((function(t){return function(){return t}})),f=(0,i.Z)((function(t,n){var r,e=Number(n),o=0;if(e<0||isNaN(e))throw new RangeError("n must be a non-negative number");for(r=new Array(e);o<e;)r[o]=t(o),o+=1;return r})),p=(0,i.Z)((function(t,n){return f(s(t),n)})),h=r(6508);function y(t){return function n(r,e,o){switch(arguments.length){case 0:return n;case 1:return(0,h.Z)(r)?n:(0,i.Z)((function(n,e){return t(r,n,e)}));case 2:return(0,h.Z)(r)&&(0,h.Z)(e)?n:(0,h.Z)(r)?(0,i.Z)((function(n,r){return t(n,e,r)})):(0,h.Z)(e)?(0,i.Z)((function(n,e){return t(r,n,e)})):(0,l.Z)((function(n){return t(r,e,n)}));default:return(0,h.Z)(r)&&(0,h.Z)(e)&&(0,h.Z)(o)?n:(0,h.Z)(r)&&(0,h.Z)(e)?(0,i.Z)((function(n,r){return t(n,r,o)})):(0,h.Z)(r)&&(0,h.Z)(o)?(0,i.Z)((function(n,r){return t(n,e,r)})):(0,h.Z)(e)&&(0,h.Z)(o)?(0,i.Z)((function(n,e){return t(r,n,e)})):(0,h.Z)(r)?(0,l.Z)((function(n){return t(n,e,o)})):(0,h.Z)(e)?(0,l.Z)((function(n){return t(r,n,o)})):(0,h.Z)(o)?(0,l.Z)((function(n){return t(r,e,n)})):t(r,e,o)}}}var d=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)},m=(0,l.Z)((function(t){return!!d(t)||!!t&&"object"==typeof t&&!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1))})),b=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,n){return this.f(t,n)},t}(),g=(0,i.Z)((function(t,n){return function(t,n){switch(t){case 0:return function(){return n.apply(this,arguments)};case 1:return function(t){return n.apply(this,arguments)};case 2:return function(t,r){return n.apply(this,arguments)};case 3:return function(t,r,e){return n.apply(this,arguments)};case 4:return function(t,r,e,o){return n.apply(this,arguments)};case 5:return function(t,r,e,o,a){return n.apply(this,arguments)};case 6:return function(t,r,e,o,a,i){return n.apply(this,arguments)};case 7:return function(t,r,e,o,a,i,u){return n.apply(this,arguments)};case 8:return function(t,r,e,o,a,i,u,c){return n.apply(this,arguments)};case 9:return function(t,r,e,o,a,i,u,c,l){return n.apply(this,arguments)};case 10:return function(t,r,e,o,a,i,u,c,l,s){return n.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}(t.length,(function(){return t.apply(n,arguments)}))})),v=g;function x(t,n,r){for(var e=r.next();!e.done;){if((n=t["@@transducer/step"](n,e.value))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}e=r.next()}return t["@@transducer/result"](n)}function w(t,n,r,e){return t["@@transducer/result"](r[e](v(t["@@transducer/step"],t),n))}var Z="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function O(t,n,r){if("function"==typeof t&&(t=function(t){return new b(t)}(t)),m(r))return function(t,n,r){for(var e=0,o=r.length;e<o;){if((n=t["@@transducer/step"](n,r[e]))&&n["@@transducer/reduced"]){n=n["@@transducer/value"];break}e+=1}return t["@@transducer/result"](n)}(t,n,r);if("function"==typeof r["fantasy-land/reduce"])return w(t,n,r,"fantasy-land/reduce");if(null!=r[Z])return x(t,n,r[Z]());if("function"==typeof r.next)return x(t,n,r);if("function"==typeof r.reduce)return w(t,n,r,"reduce");throw new TypeError("reduce: list must be array or iterable")}var S=y(O),j=(0,i.Z)((function(t,n){return n>t?n:t})),k=r(9278);function A(t,n){return function(t,n,r){var e,o;if("function"==typeof t.indexOf)switch(typeof n){case"number":if(0===n){for(e=1/n;r<t.length;){if(0===(o=t[r])&&1/o===e)return r;r+=1}return-1}if(n!=n){for(;r<t.length;){if("number"==typeof(o=t[r])&&o!=o)return r;r+=1}return-1}return t.indexOf(n,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(n,r);case"object":if(null===n)return t.indexOf(n,r)}for(;r<t.length;){if((0,k.Z)(t[r],n))return r;r+=1}return-1}(n,t,0)>=0}var E=(0,i.Z)(A),P=r(5596);function N(t){return null!=t&&"function"==typeof t["@@transducer/step"]}function C(t,n,r){return function(){if(0===arguments.length)return r();var e=Array.prototype.slice.call(arguments,0),o=e.pop();if(!d(o)){for(var a=0;a<t.length;){if("function"==typeof o[t[a]])return o[t[a]].apply(o,e);a+=1}if(N(o)){var i=n.apply(null,e);return i(o)}}return r.apply(this,arguments)}}function _(t){return"[object Object]"===Object.prototype.toString.call(t)}var T=function(){return this.xf["@@transducer/init"]()},M=function(t){return this.xf["@@transducer/result"](t)},B=function(){function t(t,n){this.xf=n,this.f=t}return t.prototype["@@transducer/init"]=T,t.prototype["@@transducer/result"]=M,t.prototype["@@transducer/step"]=function(t,n){return this.f(n)?this.xf["@@transducer/step"](t,n):t},t}(),R=(0,i.Z)((function(t,n){return new B(t,n)})),z=r(9619),I=(0,i.Z)(C(["filter"],R,(function(t,n){return _(n)?O((function(r,e){return t(n[e])&&(r[e]=n[e]),r}),{},(0,z.Z)(n)):function(t,n){for(var r=0,e=n.length,o=[];r<e;)t(n[r])&&(o[o.length]=n[r]),r+=1;return o}(t,n)}))),D=r(6943),F=r(5537),G=(0,i.Z)((function(t,n){if(0===t.length)return!1;for(var r=n,e=0;e<t.length;){if(!(0,F.Z)(t[e],r))return!1;r=r[t[e]],e+=1}return!0})),L=(0,i.Z)((function(t,n){return G([t],n)})),U=y((function(t,n,r){var e,o={};for(e in n)(0,F.Z)(e,n)&&(o[e]=(0,F.Z)(e,r)?t(e,n[e],r[e]):n[e]);for(e in r)(0,F.Z)(e,r)&&!(0,F.Z)(e,o)&&(o[e]=r[e]);return o})),W=y((function t(n,r,e){return U((function(r,e,o){return _(e)&&_(o)?t(n,e,o):n(r,e,o)}),r,e)})),H=(0,i.Z)((function(t,n){return W((function(t,n,r){return r}),t,n)})),X=r(7584),$=r(7761);function q(t){return function(t){if(Array.isArray(t))return Q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||K(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var e,o,a,i,u=[],c=!0,l=!1;try{if(a=(r=r.call(t)).next,0===n){if(Object(r)!==r)return;c=!1}else for(;!(c=(e=a.call(r)).done)&&(u.push(e.value),u.length!==n);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(t,n)||K(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(t,n){if(t){if("string"==typeof t)return Q(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Q(t,n):void 0}}function Q(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function V(){return V=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},V.apply(this,arguments)}function Y(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,(void 0,"symbol"==typeof(o=function(t,n){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e.key))?o:String(o)),e)}var o}function tt(t,n){return tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},tt(t,n)}function nt(t,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return rt(t)}function rt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function et(t){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},et(t)}function ot(t){return!isNaN(parseFloat(t))&&isFinite(t)}function at(t,n,r,e){var o=(n-t)/e,a=Math.max(2,e);return[c(0,a).map((function(n){return t+n*o})),p(r,a)]}var it=function(t){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&tt(t,n)}(c,t);var n,r,e,i,u=(e=c,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=et(e);if(i){var r=et(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return nt(this,t)});function c(){var t;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.call(this)).gd=o().createRef(),t.state={xStart:null,xEnd:null},t.handleChange=t.handleChange.bind(rt(t)),t.handleClick=t.handleClick.bind(rt(t)),t}return n=c,(r=[{key:"UNSAFE_componentWillMount",value:function(){this.props=H(c.defaultProps,this.props)}},{key:"handleChange",value:function(t){t["xaxis.range[0]"]||t["xaxis.range"]?this.setState({xStart:t["xaxis.range[0]"]||t["xaxis.range"][0],xEnd:t["xaxis.range[1]"]||t["xaxis.range"][1]}):!0===t["xaxis.autorange"]&&this.setState({xStart:null,xEnd:null})}},{key:"handleClick",value:function(t){var n=function(t,n,r){var e;if(E(r,["click","hover","selected"])){var o=[];if((0,P.Z)(n))return null;for(var a=t.props.data,i=0;i<n.points.length;i++){var u=n.points[i],c=I((function(t){return!E((0,D.Z)(t),["Object","Array"])}),u);L("curveNumber",u)&&L("pointNumber",u)&&L("customdata",a[c.curveNumber])&&(c.customdata=a[c.curveNumber].customdata[u.pointNumber]),L("pointNumbers",u)&&(c.pointNumbers=u.pointNumbers),o[i]=c}e={points:o}}return L("range",n)&&(e.range=n.range),L("lassoPoints",n)&&(e.lassoPoints=n.lassoPoints),e}(this.gd.current,t,"click");(0,P.Z)(n)||this.props.setProps({clickData:n})}},{key:"render",value:function(){var t=this.props,n=t.id,r=t.width,e=t.height,i=t.loading_state,u=this.prepareTraces(),c=u.data,l=u.globalAnnotation,s=u.domainAnnotations,f=this.prepareLayout({data:c,globalAnnotation:l,domainAnnotations:s}),p={width:r,height:e};return o().createElement("div",{id:n,style:p,"data-dash-is-loading":i&&i.is_loading||void 0},o().createElement(a.default,V({style:p,ref:this.gd,data:c,layout:f,onClick:this.handleClick,onRelayout:this.handleChange},(0,X.Z)(["setProps","loading_state"],this.props))))}},{key:"prepareTraces",value:function(){var t=H(c.defaultProps,this.props),n=t.mutationData,r=n.x,e=n.y,o=n.mutationGroups,a=n.domains,i=t.domainStyle,u=i.domainColor,l=i.displayMinorDomains,s=i.textangle,f=t.needleStyle,p=f.stemColor,h=f.stemThickness,y=f.stemConstHeight,d=f.headSize,m=f.headColor,b=f.headSymbol,g=function(t){var n=[],r=[],e=[],o=[];return t.forEach((function(t,a){if(t.indexOf("-")>-1){var i=t.split("-");ot(i[0])||ot(i[1])?o.push(a):r.push(t)}else e.push(a),n.push(t)})),[n,r,e,o]}(r),v=J(g,3),x=v[0],w=v[1],Z=v[2],O=Array.isArray(m)?m:o.map((function(){return m})),k=Array.isArray(b)?b:o.map((function(){return b})),A=u,E=Math.min.apply(null,x),P=Math.max.apply(null,x),N=!0===y?1:S(j,-1/0,function(t){return t.filter((function(t){return Number(ot(t))}))}(e)),C=this.state.xStart||E,_=(this.state.xEnd||P)-C,T=!0===y?.5:N/10,M=!0===y?2:N+T,B=[],R=[],z=[],I=[];Z.forEach((function(t){y?I=I.concat([1]):(z=z.concat(["("+r[t]+","+e[t]+")"]),I=I.concat([e[t]]))}));var D=!0===y?"x+name+text":"name+text";a.forEach((function(t,n){var r=t.coord.split("-"),e=Number(r[0]),o=Number(r[1]),a=o-e;B.push({x:[o,e],y:[M,M],xaxis:"x1",name:t.name,fill:"tozeroy",mode:"lines",opacity:.5,visible:"legendonly",legendgroup:t.name,marker:{color:A[n]}});var i=J(at(e,o,-T,o-e),2),u=i[0],c=i[1];B.push({type:"scatter",mode:"lines",fill:"tozeroy",fillcolor:A[n],hoveron:"points+fills",x:u,y:c,xaxis:"x2",showlegend:!1,hoverinfo:"name",name:"[".concat(e,"->").concat(o,"] ").concat(t.name),marker:{color:A[n]},line:{width:2}}),R.push({x:(e+o)/2,y:0===s?-T/2:-T/2-(1.2+.001*Math.abs(s)),showarrow:!1,text:t.name,width:a,align:a<.1*_?"right":"center",textangle:s})})),!0===l&&w.forEach((function(t){var n=Number(t.split("-")[0]),e=Number(t.split("-")[1]),a=o[r.indexOf(t)],i=J(at(n,e,-T/2,e-n),2),u=i[0],c=i[1];B.push({type:"scatter",mode:"lines",x:u,y:c,fill:"tozeroy",fillcolor:O[q(new Set(o)).indexOf(a)],hoveron:"points+fills",xaxis:"x2",hoverinfo:"name+text",name:a,text:"[".concat(n,"->").concat(e,"] "),showlegend:!1,marker:{color:O[q(new Set(o)).indexOf(a)]},line:{width:33}})}));var F=[{text:"<b>".concat(x.length+w.length," Mutations</b>"),x:.01,xref:"paper",y:1.1,yref:"paper",showarrow:!1,align:"left"}];return{data:[{type:"scatter",mode:"markers",x:x,y:I,xaxis:"x1",hoverinfo:D,text:z,error_y:{type:"data",symmetric:!1,array:0,arrayminus:I,thickness:h,width:0,color:p},transforms:[{type:"groupby",groups:o,nameformat:"%{group}",styles:q(new Set(o)).map((function(t,n){return{target:t,value:{marker:{size:d,symbol:k[n],color:O[n]}}}}))}]}].concat(B),globalAnnotation:F,domainAnnotations:R}}},{key:"prepareLayout",value:function(t){var n=t.data,r=t.globalAnnotation,e=t.domainAnnotations,o=H(c.defaultProps,this.props),a=o.xlabel,i=o.ylabel,u=o.rangeSlider,l=o.margin,s=this.state,f=s.xStart,p=s.xEnd,h=!1;(Boolean(!f)||Boolean(!p))&&(h=!0,n.forEach((function(t){var n=Math.min.apply(null,t.x),r=Math.max.apply(null,t.x);(f>n||Boolean(!f))&&(f=n),(p<r||Boolean(!p))&&(p=r)})));var y={legend:{orientation:"v",x:1,y:1.05,bgcolor:"rgba(255, 255, 255, 0)"},hovermode:"closest",xaxis:{title:a,showgrid:!1,zeroline:!1,autorange:Boolean(!f),range:[f,p],anchor:"y"},xaxis2:{scaleanchor:"x",autorange:Boolean(!f),range:[f,p],anchor:"y",overlaying:"x"},yaxis:{title:i,showgrid:!1,ticks:"inside"},margin:l,annotations:e.concat(r)};return!0===u&&(y.xaxis.rangeslider=!0===h?{range:[.98*f,1.02*p]}:{}),y}}])&&Y(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),c}(e.Component);it.propTypes=$.iG,it.defaultProps=$.lG}}]);
//# sourceMappingURL=async-needle.js.map