view x/static/js/2645.4b79a04c.chunk.js @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
line wrap: on
line source

"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[2645],{52645:(e,t,r)=>{function s(e){return e.replaceAll(/%([0-9A-Fa-f]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}function i(e){if(!e.length||"."===e)return{};const t={};return e.replace(/\r?\n$/,"").split(";").forEach((e=>{var r;const i=e.split("=",2);if(!(null===(r=i[1])||void 0===r?void 0:r.length))return;i[0]=i[0].trim();let n=t[i[0].trim()];n||(n=[],t[i[0]]=n),n.push(...i[1].split(",").map((e=>e.trim())).map(s))})),t}r.d(t,{g:()=>l});class n{constructor(e){this.seqCallback=e,this.currentSequence=void 0}addLine(e){const t=/^>\s*(\S+)\s*(.*)/.exec(e);t?(this._flush(),this.currentSequence={id:t[1],sequence:""},t[2]&&(this.currentSequence.description=t[2].trim())):this.currentSequence&&/\S/.test(e)&&(this.currentSequence.sequence+=e.replaceAll(/\s/g,""))}_flush(){this.currentSequence&&this.seqCallback(this.currentSequence)}finish(){this._flush()}}class o{constructor(e){this.fastaParser=void 0,this.eof=!1,this.lineNumber=0,this._underConstructionTopLevel=[],this._underConstructionById={},this._completedReferences={},this._underConstructionOrphans={};const t=()=>{};this.featureCallback=e.featureCallback||t,this.endCallback=e.endCallback||t,this.commentCallback=e.commentCallback||t,this.errorCallback=e.errorCallback||t,this.directiveCallback=e.directiveCallback||t,this.sequenceCallback=e.sequenceCallback||t,this.disableDerivesFromReferences=e.disableDerivesFromReferences||!1,this.bufferSize=void 0===e.bufferSize?1e3:e.bufferSize}addLine(e){if(this.fastaParser)return void this.fastaParser.addLine(e);if(this.eof)return;if(this.lineNumber+=1,/^\s*[^#\s>]/.test(e))return void this._bufferLine(e);const t=/^\s*(#+)(.*)/.exec(e);if(t){const[,r]=t;let[,,s]=t;if(3===r.length)this._emitAllUnderConstructionFeatures();else if(2===r.length){const t=function(e){var t,r;const s=/^\s*##\s*(\S+)\s*(.*)/.exec(e);if(!s)return null;const[,i]=s;let[,,n]=s;const o={directive:i};if(n.length&&(n=n.replace(/\r?\n$/,""),o.value=n),"sequence-region"===i){const e=n.split(/\s+/,3);return{...o,seq_id:e[0],start:null===(t=e[1])||void 0===t?void 0:t.replaceAll(/\D/g,""),end:null===(r=e[2])||void 0===r?void 0:r.replaceAll(/\D/g,"")}}if("genome-build"===i){const[e,t]=n.split(/\s+/,2);return{...o,source:e,buildName:t}}return o}(e);t&&("FASTA"===t.directive?(this._emitAllUnderConstructionFeatures(),this.eof=!0,this.fastaParser=new n(this.sequenceCallback)):this._emitItem(t))}else s=s.replace(/\s*/,""),this._emitItem({comment:s})}else if(/^\s*$/.test(e));else{if(!/^\s*>/.test(e)){const t=e.replaceAll(/\r?\n?$/g,"");throw new Error(`GFF3 parse error.  Cannot parse '${t}'.`)}this._emitAllUnderConstructionFeatures(),this.eof=!0,this.fastaParser=new n(this.sequenceCallback),this.fastaParser.addLine(e)}}finish(){this._emitAllUnderConstructionFeatures(),this.fastaParser&&this.fastaParser.finish(),this.endCallback()}_emitItem(e){Array.isArray(e)?this.featureCallback(e):"directive"in e?this.directiveCallback(e):"comment"in e&&this.commentCallback(e)}_enforceBufferSizeLimit(e=0){const t=e=>{var r,s;e&&Array.isArray(e)&&(null===(s=null===(r=e[0].attributes)||void 0===r?void 0:r.ID)||void 0===s?void 0:s[0])&&(e[0].attributes.ID.forEach((e=>{delete this._underConstructionById[e],delete this._completedReferences[e]})),e.forEach((e=>{e.child_features&&e.child_features.forEach((e=>t(e))),e.derived_features&&e.derived_features.forEach((e=>t(e)))})))};for(;this._underConstructionTopLevel.length+e>this.bufferSize;){const e=this._underConstructionTopLevel.shift();e&&(this._emitItem(e),t(e))}}_emitAllUnderConstructionFeatures(){if(this._underConstructionTopLevel.forEach(this._emitItem.bind(this)),this._underConstructionTopLevel=[],this._underConstructionById={},this._completedReferences={},Array.from(Object.values(this._underConstructionOrphans)).length)throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${Object.keys(this._underConstructionOrphans).join(",")}`)}_bufferLine(e){var t,r,n;const o=function(e){const t=e.split("\t").map((e=>"."===e||""===e?null:e));return{seq_id:t[0]&&s(t[0]),source:t[1]&&s(t[1]),type:t[2]&&s(t[2]),start:null===t[3]?null:parseInt(t[3],10),end:null===t[4]?null:parseInt(t[4],10),score:null===t[5]?null:parseFloat(t[5]),strand:t[6],phase:t[7],attributes:null===t[8]?null:i(t[8])}}(e),l={...o,child_features:[],derived_features:[]},a=(null===(t=l.attributes)||void 0===t?void 0:t.ID)||[],c=(null===(r=l.attributes)||void 0===r?void 0:r.Parent)||[],u=this.disableDerivesFromReferences?[]:(null===(n=l.attributes)||void 0===n?void 0:n.Derives_from)||[];if(!a.length&&!c.length&&!u.length)return void this._emitItem([l]);let h;a.forEach((e=>{const t=this._underConstructionById[e];t?(t[t.length-1].type!==l.type&&this._parseError(`multi-line feature "${e}" has inconsistent types: "${l.type}", "${t[t.length-1].type}"`),t.push(l),h=t):(h=[l],this._enforceBufferSizeLimit(1),c.length||u.length||this._underConstructionTopLevel.push(h),this._underConstructionById[e]=h,this._resolveReferencesTo(h,e))})),this._resolveReferencesFrom(h||[l],{Parent:c,Derives_from:u},a)}_resolveReferencesTo(e,t){const r=this._underConstructionOrphans[t];r&&(e.forEach((e=>{e.child_features.push(...r.Parent)})),e.forEach((e=>{e.derived_features.push(...r.Derives_from)})),delete this._underConstructionOrphans[t])}_parseError(e){this.eof=!0,this.errorCallback(`${this.lineNumber}: ${e}`)}_resolveReferencesFrom(e,t,r){function s(e,t,r){let s=e[t];s||(s={},e[t]=s);const i=s[r]||!1;return s[r]=!0,i}t.Parent.forEach((t=>{const i=this._underConstructionById[t];if(i){const n="child_features";r.filter((e=>s(this._completedReferences,e,`Parent,${t}`))).length||i.forEach((t=>{t[n].push(e)}))}else{let r=this._underConstructionOrphans[t];r||(r={Parent:[],Derives_from:[]},this._underConstructionOrphans[t]=r),r.Parent.push(e)}})),t.Derives_from.forEach((t=>{const i=this._underConstructionById[t];if(i){const n="derived_features";r.filter((e=>s(this._completedReferences,e,`Derives_from,${t}`))).length||i.forEach((t=>{t[n].push(e)}))}else{let r=this._underConstructionOrphans[t];r||(r={Parent:[],Derives_from:[]},this._underConstructionOrphans[t]=r),r.Derives_from.push(e)}}))}}function l(e){const t=[],r=new o({featureCallback:e=>t.push(e),disableDerivesFromReferences:!0,errorCallback:e=>{throw e}});for(const t of e.split(/\r?\n/))r.addLine(t);return r.finish(),t}}}]);
//# sourceMappingURL=2645.4b79a04c.chunk.js.map