PageSourceSearch

https://re-solute.eu/assets/HtsgetBamAdapter-657ce395.js

js re-solute.eu collected 2026-10-02 05:05:38 UTC 2,312 bytes, 1 lines download raw bytes

1import"./long-bdeb9694.js";import{aT as g}from"./index-e5563a9c.js";import"./index-659cd045.js";import{B as b,a as k,p as I,b as T}from"./BamAdapter-17f15781.js";import"./scrollTo-11ba06b1.js";import"./CardOutput-b9dc0baa.js";import"./schedule-37e6e233.js";import"./react-4b64b242.js";import"./index-349217dc.js";import"./DownloadTableData-64f79c1b.js";import"./use-text-value-3b70c47d.js";async function w(h,t){const r=await Promise.all(h.map(async e=>{const{url:a,headers:n}=e;if(a.startsWith("data:"))return Buffer.from(a.split(",")[1],"base64");{const{referer:c,...o}=n,s=await fetch(a,{...t,headers:{...t.headers,...o}});if(!s.ok)throw new Error(`Failed to fetch ${s.statusText}`);return Buffer.from(await s.arrayBuffer())}}));return Buffer.concat(await Promise.all(r.map(e=>g(e))))}class A extends b{constructor(t){super({bamFilehandle:"?",baiFilehandle:"?"}),this.baseUrl=t.baseUrl,this.trackId=t.trackId}async*streamRecordsForRange(t,r,e,a={viewAsPairs:!1,pairAcrossChr:!1,maxInsertSize:2e5}){const c=`${`${this.baseUrl}/${this.trackId}`}?referenceName=${t}&start=${r}&end=${e}&format=BAM`,o=this.chrToIndex&&this.chrToIndex[t],s=await fetch(c,{...a});if(!s.ok)throw new Error(s.statusText);const i=await s.json(),f={buffer:await w(i.htsget.urls.slice(1),a),chunk:{minv:{dataPosition:0}},toString(){return`${t}_${r}_${e}`}};yield*this._fetchChunkFeatures([f],o,r,e,a)}async _readChunk(t){const{chunk:r}=t,{buffer:e,chunk:a}=r;return{data:e,cpositions:null,dpositions:null,chunk:a}}async getHeader(t={}){const r=`${this.baseUrl}/${this.trackId}?referenceName=na&class=header`,e=await fetch(r,t);if(!e.ok)throw new Error(`Failed to fetch ${e.statusText}`);const a=await e.json(),n=await w(a.htsget.urls,t);if(n.readInt32LE(0)!==k)throw new Error("Not a BAM file");const c=n.readInt32LE(4),o=n.toString("utf8",8,8+c),s=I(o),i=[],d={};return s.filter(u=>u.tag==="SQ").forEach((u,l)=>{u.data.forEach(m=>{if(m.tag==="SN"){const p=m.value;d[p]=l,i[l]=p}})}),this.chrToIndex=d,this.indexToChr=i,s}}class P extends T{async configurePre(){const t=this.getConf("htsgetBase"),r=this.getConf("htsgetTrackId"),e=new A({baseUrl:t,trackId:r}),a=this.getConf("sequenceAdapter");
1if(a&&this.getSubAdapter){const n=await this.getSubAdapter(a);return{bam:e,sequenceAdapter:n.dataAdapter}}return{bam:e}}}export{P as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.