All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.dalliance-compiled.min.js Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
(function e$$0(u,s,q){function n(t,h){if(!s[t]){if(!u[t]){var B="function"==typeof require&&require;if(!h&&B)return B(t,!0);if(l)return l(t,!0);throw Error("Cannot find module '"+t+"'");}B=s[t]={exports:{}};u[t][0].call(B.exports,function(c){var a=u[t][1][c];return n(a?a:c)},B,B.exports,e$$0,u,s,q)}return s[t].exports}for(var l="function"==typeof require&&require,h=0;hE?w:b).push(new m(A,D));H+=16}else H+=16*C}v=t(r,H);p=null;c=Math.min(c>>14,v-1);g=Math.min(g>>14,v-1);for(v=c;v<=g;++v)(c=a(r,H+4+8*v))&&(!p||c.block=p.block&&g.maxv.offset>=p.offset&&r.push(g);w=r;r=[];for(v=
0;v=f.length)return g(C);if(A){var a=new Uint8Array(A),a=m.readBamRecords(a,f[J].minv.offset,C,c,e,v,r);A=null;++J;return a?g(C):p()}var y=f[J],
a=y.minv.block;m.data.slice(a,y.maxv.block+65536-a).fetch(function(f){A=b(f,y.maxv.block-y.minv.block+1);return p()})}var m=this;r=r||{};var v=this.chrToIndex[a],f;if(void 0===v)f=[];else{if(null===this.indices[v]&&this.indexChunks.chunks[v]){var E=this.indexChunks.chunks[v];return this.bai.slice(E[0],E[1]).fetch(function(f){f=new Uint8Array(f);this.indices[v]=f;return this.fetch(a,c,e,g,r)}.bind(this))}(f=this.blocksForRange(v,c,e))||g(null,"Error in index fetch")}var C=[],J=0,A;p()};var v="=ACxGxxxTxxxxxxN".split(""),
r="MIDNSHP=X???????".split("");q.prototype.readBamRecords=function(a,b,e,g,p,m,w){for(;;){var H=t(a,b),H=b+H+4;if(H>=a.length)return!1;var f=new h,E=t(a,b+4),C=t(a,b+8),J=t(a,b+12),A=(J&65280)>>8,D=J&255,J=t(a,b+16),y=(J&4294901760)>>16,G=J&65535,J=t(a,b+20),k=t(a,b+24),I=t(a,b+28);t(a,b+32);f.segment=this.indexToChr[E];f.flag=y;f.pos=C;f.mq=A;w.light&&(f.seqLength=J);if(!w.light){0<=k&&(f.nextSegment=this.indexToChr[k],f.nextPos=I);A="";for(C=0;C>4)+r[A&15],b+=4;f.cigar=D;G="";D=J+1>>1;for(C=0;C>4],G.length=g)void 0!==m&&E!=m||e.push(f);if(f.pos>p)return!0;b=H}};"undefined"!==typeof u&&(u.exports={makeBam:n,BAM_MAGIC:p,BAI_MAGIC:g,
BamFlags:d})},{"./bin":4,"./lh3utils":24,"./spans":36}],2:[function(d,u,s){function q(a){this.type=a}function n(a,b){this.parser=a;this.sink=b}function l(a,b){this.parser=a;this.sink=b;this.wigState=null}if("undefined"!==typeof d){var h=d("./spans"),t=h.Range,z=h.union,B=h.intersection,h=d("./sourceadapters").registerParserFactory;u=d("./das");var c=u.DASStylesheet,a=u.DASStyle,b=u.DASGroup,e=d("./utils").shallowCopy}q.prototype.createSession=function(a){return"wig"==this.type?new l(this,a):new n(this,
a)};var m=/([^=]+)=(.+)/,p=/\s/,g=/^[0-9]+,[0-9]+,[0-9]+/;n.prototype.parse=function(a){var c=a.split(p);if(!(3>c.length)){var m=parseInt(c[1])+1;a=parseInt(c[2]);a={segment:c[0],min:m,max:a};3l&&(l="+"==a.orientation?new t(l,d+3):new t(l-3,d),l=B(c,l)))for(a.type="translation",l=l.ranges(),m=d=0;ma.length||
(a={segment:a[0],min:parseInt(a[1])+1,max:parseInt(a[2]),score:parseFloat(a[3])},this.sink(a))};l.prototype.flush=function(){};q.prototype.getStyleSheet=function(b){var e=new c;if("wig"==this.type){var g=new a;g.glyph="HISTOGRAM";g.BGCOLOR="blue";g.HEIGHT=30;e.pushStyle({type:"default"},null,g)}else g=new a,g.glyph="BOX",g.FGCOLOR="black",g.BGCOLOR="blue",g.HEIGHT=8,g.BUMP=!0,g.LABEL=!0,g.ZINDEX=20,e.pushStyle({type:"default"},null,g),g=new a,g.glyph="BOX",g.FGCOLOR="black",g.BGCOLOR="red",g.HEIGHT=
10,g.BUMP=!0,g.ZINDEX=20,e.pushStyle({type:"translation"},null,g),g=new a,g.glyph="BOX",g.FGCOLOR="black",g.BGCOLOR="white",g.HEIGHT=10,g.ZINDEX=10,g.BUMP=!0,g.LABEL=!0,e.pushStyle({type:"transcript"},null,g),g=new a,g.glyph="HISTOGRAM",g.COLOR1="white",g.COLOR2="black",g.HEIGHT=30,e.pushStyle({type:"density"},null,g);return b(e)};h("bed",function(a){return new q(a)});h("wig",function(a){return new q(a)})},{"./das":10,"./sourceadapters":34,"./spans":36,"./utils":49}],3:[function(d,u,s){function q(a,
f){return a[f]+a[f+1]*P+a[f+2]*K+a[f+3]*x+a[f+4]*F}function n(){}function l(a,f,b,c){this.bwg=a;this.cirTreeOffset=f;this.cirTreeLength=b;this.isSummary=c}function h(a,f,b){var c=new n;c.data=a;c.name=b;c.data.slice(0,512).salted().fetch(function(a){if(!a)return f(null,"Couldn't fetch file");var A=new Uint8Array(a),b=new Int16Array(a);a=new Int32Array(a);var y=A[0]+P*A[1]+K*A[2]+x*A[3];if(y==v)c.type="bigwig";else if(y==O)c.type="bigbed";else return y==r||y==Q?f(null,"Currently don't support big-endian BBI files"):
f(null,"Not a supported format, magic=0x"+y.toString(16));c.version=b[2];c.numZoomLevels=b[3];c.chromTreeOffset=q(A,8);c.unzoomedDataOffset=q(A,16);c.unzoomedIndexOffset=q(A,24);c.fieldCount=b[16];c.definedFieldCount=b[17];c.asOffset=q(A,36);c.totalSummaryOffset=q(A,44);c.uncompressBufSize=a[13];c.extHeaderOffset=q(A,56);c.zoomLevels=[];for(b=0;ba||k==a)&&A<=b&&c>=f},G=function(f,a){g.bwg.instrument&&console.log("level="+a+"; offset="+
f+"; time="+(Date.now()|0));e+=f.length;if(1==f.length&&48==f[0]-g.cirTreeOffset&&g.cachedCirRoot)I(g.cachedCirRoot,0,a),--e,0==e&&g.fetchFeatures(y,A,c);else{for(var b=4+32*g.cirBlockSize,G,E=0;Ea||Da||C>a||C==a&&p>=f)&&A.push({offset:m,size:g});c+=32}else{for(var w=[],I=0;Ia||Da||C>a||C==a&&p>=f)&&w.push(m),c+=24;0G&&(y=G),g(a,y,G)&&f(a,y,G,{score:L});else console.log("Currently not handling bwgType="+y);else if("bigbed"==this.bwg.type)for(r=0,k=this.bwg.definedFieldCount,I=this.bwg.schema;rk-3&&I)for(L=k-3;Lk)f(a,y+1,G,m);else{var L=v[3]|0,l=v[4]|0,x=v[6]|0,h=v[7].split(","),d=v[8].split(",");m.exonFrames&&(D=m.exonFrames.split(","),m.exonFrames=void 0);m.type="transcript";
var t=new b;for(A in m)t[A]=m[A];t.id=v[0];t.segment=this.bwg.idsToChroms[a];t.min=y+1;t.max=G;t.notes=[];m.groups=[t];if(9L&&(y="+"==m.orientation?new z(L,l+3):new z(L-3,l),y=c(h,y))){m.type="translation";L=y.ranges();
for(h=l=0;L[0].min()>x[h].max();)h++;for(y=0;y=x&&(m.readframe=x,m.readframeExplicit=!0)),x=G.max()-G.min(),l=(l+x)%3,f(a,G.min()+1,G.max(),m)}}}else throw Error("Don't know what to do with "+this.bwg.type);};l.prototype.getFirstAdjacent=function(a,f,b,c){a=this.bwg.chromsToIDs[a];if(void 0===a)return c([]);this.getFirstAdjacentById(a,f,b,c)};l.prototype.getFirstAdjacentById=
function(a,f,b,c){var g=this;if(this.cirHeader){var A=null,e=-1,y=-1,G=0;Date.now();var k=function(k,f){G+=k.length;for(var a=4+32*g.cirBlockSize,A,b=0;bb&&(a!=
g.bwg.maxID||1E9>f)?g.getFirstAdjacentById(g.bwg.maxID,1E9,b,c):c([]);g.fetchFeatures(function(k,A,c,g){return 0>b&&(ka||A>f)},[A],function(k){for(var f=null,a=-1,A=-1,g=0;gb&&(e>a||G>A)||0b?G:I,a=e}return null!=f?c([f]):c([])})}})},p=function(c,I,G){var p=new Uint8Array(c),r=new Int16Array(c);c=new Int32Array(c);var m=p[I],r=r[I/2+1];I+=4;if(0!=m)for(m=0;mb&&(wa||x==a&&l>=f))&&!/_random/.exec(g.bwg.idsToChroms[w])&&(null==A||0>b&&(x>e||x==e&&l>y)||0b?l:v,e=0>b?x:w);I+=32}else{for(var h=p=-1,m=0;mb&&(w=a||0a||x==a&&l>=f)&&w<=a)if(0>p||l>h)p=C,h=0>b?l:v;I+=24}0<=p&&k([p],G+1)}};k([g.cirTreeOffset+48],1)}else this.bwg.data.slice(this.cirTreeOffset,
48).fetch(function(k){g.cirHeader=k;k=new Int32Array(g.cirHeader);g.cirBlockSize=k[1];g.getFirstAdjacentById(a,f,b,c)})};n.prototype.readWigData=function(a,f,b,c){this.getUnzoomedView().readWigData(a,f,b,c)};n.prototype.getUnzoomedView=function(){if(!this.unzoomedView){var a=4E3;this.zoomLevels[0]&&(a=this.zoomLevels[0].dataOffset-this.unzoomedIndexOffset);this.unzoomedView=new l(this,this.unzoomedIndexOffset,a,!1)}return this.unzoomedView};n.prototype.getZoomedView=function(a){a=this.zoomLevels[a];
a.view||(a.view=new l(this,a.indexOffset,4E3,!0));return a.view};n.prototype._tsFetch=function(a,f,b,c,g){var A=this;if(a>=this.zoomLevels.length-1){if(this.topLevelReductionCache){for(var e=[],y=this.topLevelReductionCache,G=0;Ga?this.getUnzoomedView():this.getZoomedView(a)).readWigDataById(f,
b,c,g)};n.prototype.thresholdSearch=function(a,f,b,c,g){function A(){if(0==y.length)return g(null);y.sort(function(k,f){var a=k.zoom-f.zoom;if(0!=a)return a;a=k.chrOrd-f.chrOrd;return 0!=a?a:k.min-f.min*b});var k=y.splice(0,1)[0];e._tsFetch(k.zoom,k.chr,k.min,k.max,function(a){var e=0c)if(0>k.zoom){if(p.min>e)return g(p)}else p.max>e&&y.push({chr:k.chr,chrOrd:k.chrOrd,zoom:k.zoom-
2,min:p.min,max:p.max,fromRef:k.fromRef})}else if(r>c)if(0>k.zoom){if(p.maxb?-1:1;var e=this;a=this.chromsToIDs[a];for(var y=[{chrOrd:0,chr:a,zoom:e.zoomLevels.length-4,min:0,max:3E8,fromRef:!0}],G=1;G<=this.maxID+1;++G){var k=(a+b*G)%(this.maxID+1);0>k&&(k+=this.maxID+1);y.push({chrOrd:G,chr:k,zoom:e.zoomLevels.length-1,min:0,max:3E8})}A()};n.prototype.getAutoSQL=function(a){if(!this.asOffset)return a(null);
this.data.slice(this.asOffset,2048).fetch(function(f){var b=new Uint8Array(f);f="";for(var c=0;cthis.version||0==this.extHeaderOffset||
"bigbed"!=this.type)return a(null);this.data.slice(this.extHeaderOffset,64).fetch(function(b){if(!b)return a(null,"Couldn't fetch extension header");var c=new Uint8Array(b),g=new Int16Array(b);new Int32Array(b);var A=g[1];b=q(c,4);if(0==A)return a(null);f.data.slice(b,20*A).fetch(function(b){if(!b)return a(null,"Couldn't fetch index info");var c=new Uint8Array(b),g=new Int16Array(b);new Int32Array(b);b=[];for(var k=0;ka.localeCompare(D)&&e){g(e);return}e=w}g(e)}else{for(r=0;rb.field-3)return c[b.field-3]==a},[{offset:c,size:A}],f);k+=p}return f([])}})}var A=new Uint8Array(c);new Int16Array(c);c=new Int32Array(c);var e=c[1],y=c[2],p=c[3];q(A,16);g(b.offset+32)})};"undefined"!==typeof u&&(u.exports={makeBwg:h,BIG_BED_MAGIC:O,BIG_WIG_MAGIC:v})},{"./bin":4,"./das":10,"./spans":36,"./utils":49,jszlib:65}],4:[function(d,u,s){function q(a){this.blob=a}function n(a,b,c,e){e||("object"===
typeof b?(e=b,b=void 0):e={});this.url=a;this.start=b||0;c&&(this.end=c);this.opts=e}function l(a){if(!a)return null;for(var b=new Uint8Array(a.length),c=0;ca)throw"Bad slice "+a;var c=this.start,e=this.end,c=c&&a?c+a:a||c;return new n(this.url,c,b&&c?c+b-1:e||b-1,this.opts)};var e=0,m=0<=navigator.userAgent.indexOf("Safari")&&0>navigator.userAgent.indexOf("Chrome");n.prototype.fetchAsText=function(a){try{var c=new XMLHttpRequest,v=this.url;(m||this.opts.salt)&&0>v.indexOf("?")&&(v=v+"?salt="+b(""+Date.now()+","+ ++e));c.open("GET",v,!0);if(this.end){if(1E8x.indexOf("?")&&(x=x+"?salt="+b(""+Date.now()+","+ ++e));t.open("GET",x,!0);t.overrideMimeType("text/plain; charset=x-user-defined");if(this.end){if(1E8k?a:k<=E+0.01?a+E:k<=C+0.01?a+C:a+1)*Math.log(10)-Math.log(c.zoomBase))*c.zoomExpt},A=function(a){g.addLabel(a,
q(Math.exp(a/c.zoomExpt)*c.zoomBase))};this.addViewListener(function(a,k,f,b,y){e.value=a+":"+h(k)+".."+h(f);g.min=y.min|0;g.max=y.max|0;y.isSnapZooming?(g.value=y.alternate,g.value2=y.current,g.active=2):(g.value=y.current,g.value2=y.alternate,g.active=1);y.current==y.min?p.classList.add("disabled"):p.classList.remove("disabled");y.current==y.max?v.classList.add("disabled"):v.classList.remove("disabled");g.removeLabels();a=y.min;y=y.max;k=y-a;A(J(a));A(J(a+1*k/3));A(J(a+2*k/3));A(J(y));c.storeStatus&&
c.storeViewStatus();r.style.display=0a&&(c.setSelectedTier(null),
e.focus())});c.addTierSelectionListener(function(a){"tier"===c.uiMode&&(0==a.length?(c.hideToolPanel(),c.manipulatingTier=null,c.uiMode="none"):(a=c.tiers[a[0]],a!=c.manipulatingTier&&c.openTierPanel(a)))});var y=function(a){if(65==a.keyCode||97==a.keyCode)a.preventDefault(),a.stopPropagation(),c.showTrackAdder();else if(72==a.keyCode||104==a.keyCode)a.stopPropagation(),a.preventDefault(),c.toggleHelpPopup(a);else if(69==a.keyCode||101==a.keyCode)a.stopPropagation(),a.preventDefault(),1==c.selectedTiers.length&&
c.openTierPanel(c.tiers[c.selectedTiers[0]]);else if(88==a.keyCode||120==a.keyCode)a.stopPropagation(),a.preventDefault(),c.openExportPanel();else if(67==a.keyCode||99==a.keyCode)a.stopPropagation(),a.preventDefault(),c.clearHighlights()};d.addEventListener("focus",function(a){d.addEventListener("keydown",y,!1)},!1);d.addEventListener("blur",function(a){d.removeEventListener("keydown",y,!1)},!1);d.addEventListener("keydown",function(a){27===a.keyCode&&"none"!==c.uiMode&&(a.preventDefault(),a.stopPropagation(),
c.setUiMode("none"),c.hideToolPanel(),c.selectedTiers&&0this.prefix.indexOf("//")&&0===this.prefix.indexOf("/")&&(a=window.location.hostname,window.location.port&&(a+=":"+window.location.port),this.prefix="//"+a+this.prefix);0===this.prefix.indexOf("//")&&(a=window.location.protocol,"http:"!=a&&"https:"!=a&&(console.log(window.location.protocol),console.log("WARNING: prefix is set to a protocol-relative URL ("+this.prefix+" when loading from a non-HTTP source"),this.prefix="http:"+this.prefix));if(!this.coordSystem)throw Error("Coordinate system must be configured");
if(void 0===this.chr||void 0===this.viewStart||void 0===this.viewEnd)throw Error("Viewed region (chr:start..end) must be defined");var b=this;if("complete"===document.readyState)b.realInit();else{var e=function(a){window.removeEventListener("load",e,!1);b.realInit()};window.addEventListener("load",e,!1)}}function l(a,f,b){if(b)for(var c=0;c=f&&(!e.minY||
!(be.maxY()))){e.feature?c.push(e.feature):e.group&&c.push(e.group);if(e.glyphs)return h(e.glyphs,f,b,c);if(e.glyph)return h([e.glyph],f,b,c);break}}return c}function t(a,f){var b=this;this.tagSeed=0;this.callbacks={};this.browser=a;this.worker=f;this.worker.onmessage=function(a){var k=b.callbacks[a.data.tag];k&&(k(a.data.result,a.data.error),delete b.callbacks[a.data.tag])}}function z(a){var f=a.resolveURL(a.workerPath);0==f.indexOf("//")&&(f="https:"==window.location.protocol?"https:"+
f:"http:"+f);var b=new Blob(['importScripts("'+f+"?version="+O+'");'],{type:"application/javascript"});return new x(function(f,k){var c=new Worker(URL.createObjectURL(b));c.onmessage=function(k){"init"===k.data.tag&&(console.log("Worker initialized"),f(new t(a,c)))};c.onerror=function(a){k(a.message)}})}function B(){this.sourcesByURI={}}if("undefined"!==typeof d){s=d("./utils");var c=s.Observed,a=s.makeElement,b=s.removeChildren,e=s.miniJSONify,m=s.shallowCopy,p=s.textXHR,g=d("./tier").DasTier,v=
d("./sha1").hex_sha1,r=d("./thub").connectTrackHub,O=d("./version");s=d("./numformats");var Q=s.formatQuantLabel,P=s.formatLongInt,K=d("./chainset").Chainset,x=d("es6-promise").Promise;s=d("./sourcecompare");var F=s.sourcesAreEqual,w=s.sourcesAreEqualModuloStyle,H=s.sourceDataURI}n.prototype.resolveURL=function(a){return a.replace("$$",this.prefix)};n.prototype.destroy=function(){window.removeEventListener("resize",this.resizeListener,!1)};n.prototype.realInit=function(){var f=this;if(this.wasInitialized)console.log("Attemping to call realInit on an already-initialized Dalliance instance");
else{this.wasInitialized=!0;var c=navigator.userAgent||"dummy";0<=c.indexOf("Trident")&&0<=c.indexOf("rv:11")&&(this.disablePinning=!0);this.defaultChr=this.chr;this.defaultStart=this.viewStart;this.defaultEnd=this.viewEnd;this.defaultSources=[];for(c=0;ca||(k=f.tiers[a],a=k.forceHeight||k.subtiers[0].height,40<=a&&k.mergeConfig({height:a-10}));else if(a.ctrlKey||a.metaKey){if(a=f.getSelectedTier(),!(0>a)&&(k=f.tiers[a],k.quantLeapThreshold)){var b=k.subtiers[0].height,c=k.subtiers[0].quant;c&&(a=1*c.min,c=1*c.max,b=(c-a)/b,k.mergeConfig({quantLeapThreshold:a+((Math.round((k.quantLeapThreshold-a)/b)|0)+1)*b}),k.notify("Threshold: "+Q(k.quantLeapThreshold)))}}else if(a.altKey){if(c=f.selectedTiers.length,0!=c){a=f.selectedTiers[0];for(var e=!0,k=
[],b=0;b=a)){for(b=f.selectedTiers.length-1;0<=b;--b)f.tiers.splice(f.selectedTiers[b],1);f.selectedTiers.splice(0,c);a=e?a-1:a;for(b=0;bf.tierHolder.scrollTop+f.tierHolder.offsetHeight)f.tierHolder.scrollTop=k}else f.notifyTierSelectionWrap(-1);else if(40==a.keyCode||83==a.keyCode)if(a.stopPropagation(),a.preventDefault(),a.shiftKey)a=f.getSelectedTier(),0>a||(k=f.tiers[a],a=k.forceHeight||k.subtiers[0].height,k.mergeConfig({height:a+10}));else if(a.ctrlKey||a.metaKey){if(a=f.getSelectedTier(),!(0>a)&&(k=f.tiers[a],k.quantLeapThreshold&&
(b=k.subtiers[0].height,c=k.subtiers[0].quant)))a=1*c.min,c=1*c.max,b=(c-a)/b,c=Math.round((k.quantLeapThreshold-a)/b)|0,1=f.tiers.length)){for(b=f.selectedTiers.length-1;0<=
b;--b)f.tiers.splice(f.selectedTiers[b],1);f.selectedTiers.splice(0,c);a=e?a+1:a+g;for(b=0;bf.tierHolder.scrollTop+f.tierHolder.offsetHeight))f.tierHolder.scrollTop=
Math.min(k,a-f.tierHolder.offsetHeight)}else if(187==a.keyCode||61==a.keyCode)a.stopPropagation(),a.preventDefault(),f.zoomStep(-10);else if(189==a.keyCode||173==a.keyCode)a.stopPropagation(),a.preventDefault(),f.zoomStep(10);else if(73==a.keyCode||105==a.keyCode)a.stopPropagation(),a.preventDefault(),a=f.getSelectedTier(),0>a||(b=f.tiers[a],b.infoVisible?(b.infoElement.style.display="none",b.updateHeight(),b.infoVisible=!1):(b.infoElement.style.display="block",b.updateHeight(),b.infoVisible=!0));
else if(84==a.keyCode||116==a.keyCode)if(a.shiftKey)for(a.stopPropagation(),a.preventDefault(),a=0;aa||(b=f.tiers[a],b.dasSource.collapseSuperGroups&&(void 0===k&&(k=!b.bumped),b.mergeConfig({bumped:k}))));else if(77==a.keyCode||109==a.keyCode)a.stopPropagation(),a.preventDefault(),(a.ctrlKey||
a.metaKey)&&1a||f.addTier(f.tiers[a].dasSource)}else if(80==a.keyCode||112==a.keyCode)if(a.ctrlKey||a.metaKey){k=[];for(a=0;ac[e].height&&e=c.length))return c=c[e].glyphs,a-=(k.glyphCacheOrigin-b.viewStart)*b.scale,h(c,a,f)}},w=function(a){a.preventDefault();a.stopPropagation();a=a.clientX;a!=m&&(b.move(a-m,!0),m=a);b.isDragging=
!0},C=function(a){window.removeEventListener("mousemove",w,!0);window.removeEventListener("mouseup",C,!0);b.move(a.clientX-m)};k.viewport.addEventListener("mousedown",function(a){b.browserHolder.focus();a.preventDefault();k.row.getBoundingClientRect();a=a.clientX;window.addEventListener("mousemove",w,!0);window.addEventListener("mouseup",C,!0);r=m=a;b.isDragging=!1},!1);k.viewport.addEventListener("mousemove",function(a){var f=k.row.getBoundingClientRect(),c=a.clientX-f.left,A=a.clientY-f.top,f=E(c,
A);k.row.style.cursor=f&&0f)){if(cd&&a.clientY>n){b.withPreservedSelection(function(){b.tiers.splice(d,
1);b.tiers.splice(c,0,k);b._ensureTiersGrouped(c>d)});for(f=0;fv.scrollTop+v.offsetHeight&&(v.scrollTop=Math.min(v.scrollTop+(x.offsetTop+x.offsetHeight)-(v.scrollTop+v.offsetHeight),t))},q=function(a){var f=k.label;a.stopPropagation();a.preventDefault();x&&(x.style.cursor="auto",v.removeChild(x),x=null,f.style.visibility=
"visible");document.removeEventListener("mousemove",na,!1);document.removeEventListener("mouseup",q,!1);if(O){for(a=0;a=a?(this.drawnStart=Math.max(e.min,k),this.drawnEnd=
Math.min(e.max,f)):(this.drawnStart=k,this.drawnEnd=f);this.knownSpace.viewFeatures(this.chr,this.drawnStart,this.drawnEnd,c);this.drawOverlays();this.positionRuler()};n.prototype.queryRegistry=function(a,f){if(this.registry){var b,g;a?(b=this.chains[a].coords,this.mappableSources[a]||(this.mappableSources[a]=new c),g=this.mappableSources[a]):(b=this.coordSystem,g=this.availableSources);var k=v(e(b));if(f){var r=localStorage["dalliance.registry."+k+".last_queried"];if(r)try{if(l(g,JSON.parse(localStorage["dalliance.registry."+
k+".sources"]),a),432E5>(Date.now()|0)-(r|0))return}catch(m){console.log("Bad registry cache: "+m)}}r=this.registry;if(0==r.indexOf("//")){var p=window.location.protocol;"https:"!=p&&"http:"!=p&&(r="http:"+r)}(new J(r)).sources(function(f){for(var c=[],e=0;ethis.currentSeqMax&&(k=this.currentSeqMax,c=this.viewEnd-b),1>c&&(c=1,k=c+b));this.setLocation(null,c,k,null,f)};n.prototype.zoomStep=function(a){var f=1*this.zoomSliderValue;a=f+a;athis.zoomMax&&(a=this.zoomMax);a!=f&&(this.zoomSliderValue=a,this.zoom(Math.exp(1*a/this.zoomExpt)))};
n.prototype.zoom=function(a){this.zoomFactor=a;a=Math.round((this.viewStart+this.viewEnd)/2)|0;this.viewStart=a-this.zoomBase*this.zoomFactor/2;this.viewEnd=a+this.zoomBase*this.zoomFactor/2;0this.currentSeqMax+5&&(a=this.viewEnd-this.viewStart+1,this.viewEnd=this.currentSeqMax,this.viewStart=this.viewEnd-a+1);1>this.viewStart&&(a=this.viewEnd-this.viewStart+1,this.viewStart=1,this.viewEnd=this.viewStart+a-1);this.scale=this.featurePanelWidth/(this.viewEnd-this.viewStart);
this.notifyLocation();this.refresh()};n.prototype.spaceCheck=function(a){this.knownSpace&&this.knownSpace.chr===this.chr?(a=100/this.scale|0,((this.drawnStart|0)>Math.max(1,(this.viewStart|0)-a|0)||(this.drawnEnd|0)this.currentSeqMax&&(this.viewEnd=this.currentSeqMax,this.viewStart=this.viewEnd-
f+1),1>this.viewStart&&(this.viewStart=1,this.viewEnd=this.viewStart+f-1),this.positionRuler(),a||this.spaceCheck(),this.notifyLocation());this.fullScreen&&this.setFullScreenHeight()}};n.prototype.setFullScreenHeight=function(){this.browserHolder.style.maxHeight=Math.max(300,window.innerHeight-(document.body.offsetHeight-this.browserHolder.offsetHeight)-20)+"px"};n.prototype.addTier=function(a){a=m(a);a.disabled=!1;a=this.makeTier(a);this.markSelectedTiers();this.positionRuler();this.notifyTier();
return a};n.prototype.removeTier=function(a,f){var b=-1;if("undefined"!==typeof a.index&&0<=a.index&&a.indexb)throw"Couldn't find requested tier";c=this.tiers[b];this.tiers.splice(b,1);for(var k=[],e=0;eb&&k.push(g-1)}this.selectedTiers=k;this.markSelectedTiers();c.destroy();this.knownSpace&&(this.knownSpace.featureCache[c]=
null);this.reorderTiers();this.notifyTier()};n.prototype.removeAllTiers=function(){var a=this;this.selectedTiers=[];this.markSelectedTiers();this.tiers.forEach(function(f){f.destroy();a.knownSpace&&(a.knownSpace.featureCache[f]=null)});this.tiers.length=0;this.reorderTiers();this.notifyTier()};n.prototype.getSequenceSource=function(){void 0===this._sequenceSource&&(this._sequenceSource=this._getSequenceSource());return this._sequenceSource};n.prototype._getSequenceSource=function(){for(var a=0;a<
this.tiers.length;++a)if(this.tiers[a].sequenceSource)return this.tiers[a].sequenceSource;for(a=0;ab){var e=f;f=b;b=e}else f===b&&(b+=1);c||(c=function(a){if(a)throw a;});var g=this;if((!a||a==this.chr)&&0=e&&(e=1E12),1>f&&(f=1,b=f+a-1),b>e&&(b=e,f=Math.max(1,b-a+1)));this.viewStart=f;this.viewEnd=b;f=Math.max(this.featurePanelWidth,50)/(this.viewEnd-this.viewStart);e=1E-6Math.abs(g)&&(this.isSnapZooming=!this.isSnapZooming,this.savedZoom=b)):(this.isSnapZooming=!1,this.savedZoom=null)}else for(g=0;gthis.currentSeqMax&&(f=this.currentSeqMax);for(var b=0;bc&&this.drawOverlays();this.notifyLocation()};n.prototype.clearHighlights=function(){this.highlights=
[];this.drawOverlays();this.notifyLocation()};n.prototype.drawOverlays=function(){for(var a=0;a=f&&c.push(g)}return c};n.prototype.getSelectedTier=function(){return 0document.body.scrollTop&&a+100this.scale?(this.ruler2.style.width="0px",this.ruler2.style.borderRightWidth="0px"):(this.ruler2.style.width=this.scale+"px",this.ruler2.style.borderRightWidth="1px"),this.locSingleBase.style.visibility="visible",this.locSingleBase.style.left=""+(this.featurePanelWidth/2-this.locSingleBase.offsetWidth/
2+this.ruler2.offsetWidth/2|0)+"px"):(this.locSingleBase.style.visibility="hidden",this.ruler2.style.width="1px",this.ruler2.style.borderWidth="0px",this.ruler2.style.display="center"==this.rulerLocation?"none":"block");this.ruler2.style.left=""+(this.featurePanelWidth/2|0)+"px";for(var c=0;cf?a=b.min|0:0.7b&&(c-=1));this.setLocation(null,this.viewStart+c,this.viewEnd+c)}else this.move(a.shiftKey?100*f:25*f)};n.prototype.leap=function(a,f){var b=this,c=(b.viewStart+b.viewEnd+1)/2|0;0=b.viewStart?c-=1E8:0>a&&b.viewEnd>=b.currentSeqMax&&(c+=1E8);var k=b.getSelectedTier();0>k||((k=b.tiers[k])&&(k.featureSource&&this.sourceAdapterIsCapable(k.featureSource,"quantLeap")&&"number"==typeof k.quantLeapThreshold||k.featureSource&&this.sourceAdapterIsCapable(k.featureSource,
"leap"))?k.findNextFeature(b.chr,c,-a,f,function(k){if(k){var e=k.min,g=k.max;f&&(0c+1?g=e:(g++,e=g):g(f||16)?a("img",null,{src:this.resolveURL("$$img/spinner_"+(b?16:32)+".gif"),width:"16",height:"16"}):a("img",null,{src:this.resolveURL("$$img/spinner_"+(b?24:48)+".gif"),width:"24",height:"24"})};n.prototype.canFetchPlainHTTP=function(){var a=this;if(!this._plainHTTPPromise){var f=this.getWorker();this._plainHTTPPromise=f?new x(function(b,c){f.postCommand({command:"textxhr",uri:a.httpCanaryURL},
function(a,f){a?b(!0):b(!1)})}):new x(function(f,b){p(a.httpCanaryURL,function(a,b){a?f(!0):f(!1)},{timeout:2E3})})}return this._plainHTTPPromise};n.prototype.getWorker=function(){if(!this.useFetchWorkers||!this.fetchWorkers||0==this.fetchWorkers.length)return null;this.nextWorker>=this.fetchWorkers.length&&(this.nextWorker=0);return this.fetchWorkers[this.nextWorker++]};t.prototype.postCommand=function(a,f,b){var c="x"+ ++this.tagSeed;a.tag=c;this.callbacks[c]=f;this.worker.postMessage(a,b)};if("undefined"!==
typeof u){u.exports={Browser:n};d("./browser-ui");d("./track-adder");d("./feature-popup");d("./tier-actions");d("./domui");d("./search");u=d("./sourceadapters");var f=u.TwoBitSequenceSource,E=u.DASSequenceSource,C=d("./kspace").KnownSpace,J=d("./das").DASRegistry}B.prototype.get=function(a){var f=this.sourcesByURI[H(a)];if(f)for(var b=0;bc.length)){for(var e=[],g=0;g=g.srcMin&&b<=g.srcMax){var m;m="-"==g.srcOri?g.srcMax-b:b-g.srcMin;for(var p=g.blocks,w=0;w=f&&m<=f+v)return c=m-f,{seq:g.destChr,pos:"-"==g.destOri?g.destMax-E-c:c+E+g.destMin,flipped:g.srcOri!=g.destOri}}}}return null};q.prototype.mapSegment=
function(a,b,c){a=this.chainsBySrc[a]||[];for(var e=[],g=0;g=m.srcMin&&b<=m.srcMax){var p,w;"-"==m.srcOri?(p=m.srcMax-c,w=m.srcMax-b):(p=b-m.srcMin,w=c-m.srcMin);for(var v=m.blocks,f=0;f=C&&p<=C+E){var t={segment:m.destChr,flipped:"-"==m.srcOri^"-"==m.destOri};"-"==m.destOri?(p>=C?t.max=m.destMax-l-p+C:(t.max=m.destMax-l,t.partialMax=C-p),w<=C+E?t.min=m.destMax-l-w+C:(t.min=m.destMax-l-E,t.partialMin=w-C-E)):(p>=C?
t.min=m.destMin+l+p-C:(t.min=m.destMin+l,t.partialMin=C-p),w<=C+E?t.max=m.destMin+l+w-C:(t.max=m.destMin+l+E,t.partialMax=w-C-E));e.push(t)}}}}return e};q.prototype.unmapPoint=function(a,b){for(var c=this.chainsByDest[a]||[],e=0;e=g.destMin&&b<=g.destMax){var m;m="-"==g.srcOri?g.destMax-b:b-g.destMin;for(var p=g.blocks,w=0;w=E&&m<=E+v)return c=m-E,e=c+f+g.srcMin,e="-"==g.destOri?g.srcMax-f-c:c+f+g.srcMin,{seq:g.srcChr,
pos:e,flipped:g.srcOri!=g.destOri}}}}return null};q.prototype.sourceBlocksForRange=function(c,e,g,m){for(var p=this,v=e/this.granularity|0,l=g/this.granularity|0,w=!1,t=v;t<=l;++t){var f=c+"_"+t;2!=this.fetchedTiles[f]&&(w=!0,1!=this.fetchedTiles[f]&&(this.fetchedTiles[f]=1))}if(w)this.postFetchQueues[c]||this.chainFetcher.fetchChains(c,v*this.granularity,(l+1)*this.granularity-1).then(function(a){p.chainsByDest||(p.chainsByDest[c]=[]);for(var f=0;f=E.destMin){var C,h;"-"==E.srcOri?(C=E.destMax-g,h=E.destMax-e):(C=e-E.destMin,h=g-E.destMin);for(var d=E.blocks,n=0;n=k&&C<=k+I&&(y=Math.max(C,k)-k,k=Math.min(h,k+I)-k,"-"==E.destOri?w.push(new a(E.srcChr,E.srcMax-q-k,E.srcMax-q-y)):w.push(new a(E.srcChr,E.srcMin+y+q,E.srcMin+k+q)))}}}m(w)}};
n.prototype.fetchChains=function(a,b,c){var e=this;return new v(function(b,c){e.source.alignments(a,{},function(a){for(var c=[],g=0;g=b[v]&&g<=b[v+1]){var g=(g-b[v])/(b[v+1]-b[v]),r=m[v],v=m[v+1],v=(new q(r.red*(1-g)+v.red*g|0,r.green*(1-g)+v.green*g|0,r.blue*(1-g)+v.blue*g|0)).toSvgString();c.push(v);continue a}throw"Bad step";}return c}function t(a,b,c,m){return m?h(a,[0,0.5,1],[b,c,m]):h(a,[0,1],[b,c])}q.prototype.toSvgString=function(){this.name||(this.name="rgb("+this.red+","+this.green+","+this.blue+")");return this.name};q.prototype.toHexString=
function(){return"#"+n(this.red)+n(this.green)+n(this.blue)};var z={red:new q(255,0,0,"red"),green:new q(0,255,0,"green"),blue:new q(0,0,255,"blue"),yellow:new q(255,255,0,"yellow"),white:new q(255,255,255,"white"),black:new q(0,0,0,"black"),gray:new q(180,180,180,"gray"),grey:new q(180,180,180,"grey"),lightskyblue:new q(135,206,250,"lightskyblue"),lightsalmon:new q(255,160,122,"lightsalmon"),hotpink:new q(255,105,180,"hotpink")},B=/^#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/,c=/rgb\(([0-9]+),([0-9]+),([0-9]+)\)/;
"undefined"!==typeof u&&(u.exports={makeColourSteps:h,makeGradient:t,dasColourForName:l})},{}],10:[function(d,u,s){function q(a,b,f,c){this.name=a;this.start=b;this.end=f;this.description=c}function n(a,b){var f;"string"==typeof a?(this.uri=a,f=b||{}):f=a||{};for(var c in f)"function"!=typeof f[c]&&(this[c]=f[c]);this.coords||(this.coords=[]);this.props||(this.props={});(this.dasBaseURI=this.uri)&&"/"!=this.dasBaseURI.substr(this.uri.length-1)&&(this.dasBaseURI+="/")}function l(){}function h(a,b){return a.taxon==
b.taxon&&a.auth==b.auth&&a.version==b.version}function t(a,b,f,c,e){this.name=a;this.start=b;this.end=f;this.alphabet=c;this.seq=e}function z(){}function B(a){a&&(this.id=a)}function c(a,b){this.desc=a;this.uri=b}function a(a){this.type=a;this.objects={};this.blocks=[]}function b(){this.styles=[]}function e(){}function m(a,b){b=b||{};this.uri=a;this.opts=b}function p(a,b){var f=a.getElementsByTagName(b);if(0(C|0)?(h.min=C|0,h.max=d|0):(h.min=d|0,h.max=C|0);d=l.getElementsByTagName("TYPE");0m.length)){for(var p=m[0],k=p.getElementsByTagName("COORDINATES"),m=[],r=0;rg&&(g=8);g>m-b-32&&
(g=m-b-26);p+=a.clientY-Q;p=Math.max(10,p);v.style.top=""+p+"px";v.style.left=""+Math.min(g,m-b-10)+"px";q=a.clientX;Q=a.clientY};K=function(a){a.stopPropagation();a.preventDefault();window.removeEventListener("mousemove",P,!1);window.removeEventListener("mouseup",K,!1)};h.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();q=a.clientX;Q=a.clientY;window.addEventListener("mousemove",P,!1);window.addEventListener("mouseup",K,!1)},!1);v.appendChild(h)}v.appendChild(l("div",
n,{className:"popover-content"},{padding:"0px"}));this.hPopupHolder.appendChild(v);var x={node:v,displayed:!0};v.addEventListener("DOMNodeRemoved",function(a){a.target==v&&(x.displayed=!1)},!1);return x};"undefined"!==typeof u&&(u.exports={makeTreeTableSection:q})},{"./cbrowser":6,"./utils":49}],12:[function(d,u,s){function q(l,d){0>l.indexOf("?")&&(l+="?soft=true");return new h(function(h,c){var a=new XMLHttpRequest;a.onreadystatechange=function(){if(4==a.readyState)if(300<=a.status)c("Error code "+
a.status);else{var b=JSON.parse(a.response);h(d?b:b.location)}};a.open("GET",l,!0);a.setRequestHeader("Accept","application/json");a.responseType="text";a.send("")})}function n(h){this.rawurl=h}function l(h,l,d,c){c||("object"===typeof l?(c=l,l=void 0):c={});this.url="string"===typeof h?new n(h):h;this.start=l||0;d&&(this.end=d);this.opts=c}if("undefined"!==typeof d)var h=d("es6-promise").Promise;n.prototype.getURLPromise=function(){this.urlPromise&&this.urlPromiseValidity>Date.now()||(this.urlPromise=
q(this.rawurl,!0).then(function(h){return h.location}),this.urlPromiseValidity=Date.now()+432E5);return this.urlPromise};l.prototype.slice=function(h,d){if(0>h)throw"Bad slice "+h;var n=this.start,c=this.end,n=n&&h?n+h:h||n;return new l(this.url,n,d&&n?n+d-1:c||d-1,this.opts)};l.prototype.fetchAsText=function(h){var l=this,d=new XMLHttpRequest;l.url.getURLPromise().then(function(c){d.open("GET",c,!0);if(l.end){if(1E8p.strand?d.orientation="-":0\n  \n