Mercurial > repos > fubar > jbrowse2
view x/static/js/5904.240caa72.chunk.js @ 133:cec274db51c0 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7d28252954cae9f8db5f8a85d8f29cb2865b504b-dirty
author | fubar |
---|---|
date | Fri, 18 Oct 2024 11:57:55 +0000 |
parents | 49f3d3878413 |
children |
line wrap: on
line source
"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5904,7706],{35904:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var r=n(46377),a=n(32595),s=n(99834),o=n(66885),i=n(99546),c=n(68584),l=n(7706),h=n(82727),d=n(72147),u=n(78054);function f(e){const[t,n]=e.reduce((([e,t],[n,r])=>[e+n*r,t+r]),[0,0]);return t/n}const{parseCigar:m}=h.aF;class p extends r.BaseFeatureDataAdapter{static capabilities=["getFeatures","getRefNames"];async setup(e){return this.setupP||(this.setupP=this.setupPre(e).catch((e=>{throw this.setupP=void 0,e}))),this.setupP}async setupPre(e){const t=this.pluginManager,n=(0,s.openLocation)(this.getConf("pafLocation"),t),r=await n.readFile(e),a=(0,i.isGzip)(r)?await(0,l.unzip)(r):r;return(0,u.PX)(a,u.xI)}async hasDataForRefName(){return!0}getAssemblyNames(){const e=this.getConf("assemblyNames");return 0===e.length?[this.getConf("queryAssembly"),this.getConf("targetAssembly")]:e}async getRefNames(e={}){const t=e.regions?.[0].assemblyName,n=await this.setup(e),r=this.getAssemblyNames().indexOf(t);if(-1!==r){const e=new Set;for(const t of n)e.add(0===r?t.qname:t.tname);return[...e]}return console.warn("Unable to do ref renaming on adapter"),[]}getFeatures(e,t={}){return(0,o.ObservableCreate)((async n=>{let r=await this.setup(t);const{config:s}=t;s&&"meanQueryIdentity"===(0,c.readConfObject)(s,"colorBy")&&(r=function(e){const t={};for(const n of e){const e=`${n.qname}-${n.tname}`;t[e]||(t[e]={quals:[],len:[]}),t[e].quals.push(n.extra.mappingQual),t[e].len.push(n.extra.blockLen||1)}const n=Object.fromEntries(Object.entries(t).map((([e,t])=>[e,f((0,u.yU)(t.quals,t.len))])));for(const t of e){const e=`${t.qname}-${t.tname}`;t.extra.meanScore=n[e]}let r=1e4,a=0;for(const t of e)r=Math.min(t.extra.meanScore||0,r),a=Math.max(t.extra.meanScore||0,a);for(const t of e){const e=t.extra.meanScore||0;t.extra.meanScore=(e-r)/(a-r)}return e}(r));const o=this.getAssemblyNames(),{start:i,end:l,refName:h,assemblyName:p}=e,g=o.indexOf(p),w=0===g;-1===g&&(console.warn(`${p} not found in this adapter`),n.complete());for(let e=0;e<r.length;e++){const t=r[e];let s=0,c=0,f="",g="",b=0,y=0;w?(s=t.qstart,c=t.qend,f=t.qname,g=t.tname,b=t.tstart,y=t.tend):(s=t.tstart,c=t.tend,f=t.tname,g=t.qname,b=t.qstart,y=t.qend);const{extra:x,strand:k}=t;if(f===h&&(0,a.R6)(i,l,s,c)){const{numMatches:t=0,blockLen:r=1,cg:a,...i}=x;let l=x.cg;x.cg&&(w&&-1===k?l=(0,u.qm)(m(x.cg)).join(""):w&&(l=(0,u.gJ)(x.cg))),n.next(new d.A({uniqueId:e+p,assemblyName:p,start:s,end:c,type:"match",refName:f,strand:k,...i,CIGAR:l,syntenyId:e,identity:t/r,numMatches:t,blockLen:r,mate:{start:b,end:y,refName:g,assemblyName:o[+w]}}))}}n.complete()}))}freeResources(){}}},72147:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(99546),a=n(82727);const{getMismatches:s}=a.aF;class o extends r.SimpleFeature{get(e){return"mismatches"===e?s(this.get("CIGAR")):super.get(e)}}},78054:(e,t,n)=>{n.d(t,{PX:()=>l,TA:()=>o,fY:()=>s,gJ:()=>u,qm:()=>d,xI:()=>h,yU:()=>i});var r=n(7706),a=n(99546);function s(e){return new Map(e.split(/\n|\r\n|\r/).filter((e=>!!e||e.startsWith("#"))).map((e=>{const[t,n,r,a,s,o]=e.split("\t");return[a,{refName:t,start:+n,end:+r,score:+s,name:a,strand:"-"===o?-1:1}]})))}async function o(e,t){const n=await e.readFile(t);return new TextDecoder("utf8",{fatal:!0}).decode((0,a.isGzip)(n)?await(0,r.unzip)(n):n)}function i(e,t){return e.map(((e,n)=>[e,t[n]]))}const c="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function l(e,t){let n=0;const r=[];for(;n<e.length;){const a=e.indexOf("\n",n);if(-1===a)break;const s=e.subarray(n,a),o=(c?.decode(s)||s.toString()).trim();o&&r.push(t(o)),n=a+1}return r}function h(e){const[t,,n,r,a,s,,o,i,c,l,h,...d]=e.split("\t");return{tname:s,tstart:+o,tend:+i,qname:t,qstart:+n,qend:+r,strand:"-"===a?-1:1,extra:{numMatches:+c,blockLen:+l,mappingQual:+h,...Object.fromEntries(d.map((e=>{const t=e.indexOf(":");return[e.slice(0,t),e.slice(t+3)]})))}}}function d(e){const t=[];for(let n=e.length-2;n>=0;n-=2){t.push(e[n]);const r=e[n+1];"D"===r?t.push("I"):"I"===r?t.push("D"):t.push(r)}return t}function u(e){return e.replaceAll("D","K").replaceAll("I","D").replaceAll("K","I")}},7706:(e,t,n)=>{n.d(t,{sG:()=>d,unzip:()=>o,i2:()=>i});var r=n(35451),a=n(45834),s=n(57864);async function o(e){try{let t,n=0,a=0;const o=[];let i,c=0;do{const r=e.subarray(n);if(i=new s.Inflate,({strm:t}=i),i.push(r,s.Z_SYNC_FLUSH),i.err)throw new Error(i.msg);n+=t.next_in,o[a]=i.result,c+=o[a].length,a+=1}while(t.avail_in);const l=new Uint8Array(c);for(let e=0,t=0;e<o.length;e++)l.set(o[e],t),t+=o[e].length;return r.hp.from(l)}catch(e){if(`${e}`.match(/incorrect header check/))throw new Error("problem decompressing block: incorrect gzip header check");throw e}}async function i(e,t){try{let n;const{minv:a,maxv:o}=t;let i=a.blockPosition,c=a.dataPosition;const l=[],h=[],d=[];let u=0,f=0;do{const t=e.subarray(i-a.blockPosition),r=new s.Inflate;if(({strm:n}=r),r.push(t,s.Z_SYNC_FLUSH),r.err)throw new Error(r.msg);const m=r.result;l.push(m);let p=m.length;h.push(i),d.push(c),1===l.length&&a.dataPosition&&(l[0]=l[0].subarray(a.dataPosition),p=l[0].length);const g=i;if(i+=n.next_in,c+=p,g>=o.blockPosition){l[f]=l[f].subarray(0,o.blockPosition===a.blockPosition?o.dataPosition-a.dataPosition+1:o.dataPosition+1),h.push(i),d.push(c),u+=l[f].length;break}u+=l[f].length,f++}while(n.avail_in);const m=new Uint8Array(u);for(let e=0,t=0;e<l.length;e++)m.set(l[e],t),t+=l[e].length;return{buffer:r.hp.from(m),cpositions:h,dpositions:d}}catch(e){if(`${e}`.match(/incorrect header check/))throw new Error("problem decompressing block: incorrect gzip header check");throw e}}var c=n(59086),l=n.n(c);class h{constructor({filehandle:e,path:t}){if(e)this.filehandle=e;else{if(!t)throw new TypeError("either filehandle or path must be defined");this.filehandle=new a.EY(t)}}_readLongWithOverflow(e,t=0,n=!0){const r=l().fromBytesLE(e.slice(t,t+8),n);if(r.greaterThan(Number.MAX_SAFE_INTEGER)||r.lessThan(Number.MIN_SAFE_INTEGER))throw new TypeError("integer overflow");return r.toNumber()}_getIndex(){return this.index||(this.index=this._readIndex()),this.index}async _readIndex(){let e=r.hp.allocUnsafe(8);await this.filehandle.read(e,0,8,0);const t=this._readLongWithOverflow(e,0,!0);if(!t)return[[0,0]];const n=new Array(t+1);n[0]=[0,0];const a=16*t;if(a>Number.MAX_SAFE_INTEGER)throw new TypeError("integer overflow");e=r.hp.allocUnsafe(a),await this.filehandle.read(e,0,a,8);for(let r=0;r<t;r+=1){const t=this._readLongWithOverflow(e,16*r),a=this._readLongWithOverflow(e,16*r+8);n[r+1]=[t,a]}return n}async getLastBlock(){const e=await this._getIndex();if(e.length)return e[e.length-1]}async getRelevantBlocksForRead(e,t){const n=t+e;if(0===e)return[];const r=await this._getIndex(),a=[],s=(e,n)=>{const r=e[1],a=n?n[1]:1/0;return r<=t&&a>t?0:r<t?-1:1};let o=0,i=r.length-1,c=Math.floor(r.length/2),l=s(r[c],r[c+1]);for(;0!==l;)l>0?i=c-1:l<0&&(o=c+1),c=Math.ceil((i-o)/2)+o,l=s(r[c],r[c+1]);a.push(r[c]);let h=c+1;for(;h<r.length&&(a.push(r[h]),!(r[h][1]>=n));h+=1);return a[a.length-1][1]<n&&a.push([]),a}}class d{constructor({filehandle:e,path:t,gziFilehandle:n,gziPath:r}){if(e)this.filehandle=e;else{if(!t)throw new TypeError("either filehandle or path must be defined");this.filehandle=new a.EY(t)}if(!n&&!r&&!t)throw new TypeError("either gziFilehandle or gziPath must be defined");this.gzi=new h({filehandle:n,path:n||r||!t?`${t}.gzi`:r})}async stat(){const e=await this.filehandle.stat();return Object.assign(e,{size:await this.getUncompressedFileSize(),blocks:void 0,blksize:void 0})}async getUncompressedFileSize(){const[,e]=await this.gzi.getLastBlock(),{size:t}=await this.filehandle.stat(),n=r.hp.allocUnsafe(4),{bytesRead:a}=await this.filehandle.read(n,0,4,t-28-4);if(4!==a)throw new Error("read error");return e+n.readUInt32LE(0)}async _readAndUncompressBlock(e,[t],[n]){let r=n;r||(r=(await this.filehandle.stat()).size);const a=r-t;return await this.filehandle.read(e,0,a,t),await o(e.slice(0,a))}async read(e,t,n,a){const s=await this.gzi.getRelevantBlocksForRead(n,a),o=r.hp.allocUnsafe(65536);let i=t,c=0;for(let t=0;t<s.length-1;t+=1){const r=await this._readAndUncompressBlock(o,s[t],s[t+1]),[,l]=s[t],h=l>=a?0:a-l,d=Math.min(a+n,l+r.length)-l;h>=0&&h<r.length&&(r.copy(e,i,h,d),i+=d-h,c+=d-h)}return{bytesRead:c,buffer:e}}}}}]); //# sourceMappingURL=5904.240caa72.chunk.js.map