gensplore 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,4 +49,4 @@ ${e.sequence}
49
49
  `,f+=(u.match(/.{1,80}/g)||[]).join(`
50
50
  `),f}X(QS,`jsonToFasta`);function $S(e,t={}){let{name:n,features:r,size:i,description:a,circular:o}=t.featuresOnly?e:z_(e),s=``;s+=`${n||`Untitled Sequence`}|`,s+=`|`+i,s+=a?`|`+a:``,s+=`|`+(o?`circular`:`linear`);let c=t.sequenceName||s,l=``;return l+=`track name="${c}" description="${n} Annotations" itemRgb="On"
51
51
  `,r.forEach(function(e){let{start:t,end:n,name:r,type:i,forward:a,strand:o}=e,s=r||i,u;u=a||o===1?`+`:!a||o===-1?`-`:`.`;let d=i===`CDS`?`230,88,0`:``;l+=`${c} ${t} ${n+1} ${s} ${u} ${d}
52
- `}),l}X($S,`jsonToBed`);function eC(e){let t=wm(e);return t&&(delete t.cutsites,delete t.orfs,Bh(t.translations,e=>{delete e.aminoAcids}),t)}X(eC,`cleanUpTeselagenJsonForExport`);function tC(e,t=[]){return e.replace(/u/gi,(e,n)=>(t.push({type:`misc_feature`,name:`tg_uracil`,strand:1,start:n,end:n}),e===`U`?`T`:`t`))}X(tC,`parseUracilFeatures`);function nC(e){return JSON.stringify(ig(eC(z_(e,{annotationsAsObjects:!1})),[`sequenceFragments`,`sequenceFeatures`,`cutsites`,`orfs`,`filteredParts`,`filteredFeatures`]))}X(nC,`jsonToJsonString`);var rC=function(){},iC=typeof window<`u`,aC=iC?l.useLayoutEffect:l.useEffect,oC={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function sC(){var e=(0,l.useState)(null),t=e[0],n=e[1],r=(0,l.useState)(oC),i=r[0],a=r[1],o=(0,l.useMemo)(function(){return new window.ResizeObserver(function(e){if(e[0]){var t=e[0].contentRect,n=t.x,r=t.y,i=t.width,o=t.height,s=t.top,c=t.left,l=t.bottom,u=t.right;a({x:n,y:r,width:i,height:o,top:s,left:c,bottom:l,right:u})}})},[]);return aC(function(){if(t)return o.observe(t),function(){o.disconnect()}},[t]),[n,i]}var cC=iC&&window.ResizeObserver!==void 0?sC:(function(){return[rC,oC]});function lC(e){return T({tag:`svg`,attr:{fill:`currentColor`,viewBox:`0 0 16 16`},child:[{tag:`path`,attr:{d:`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z`},child:[]}]})(e)}function uC(e){return T({tag:`svg`,attr:{fill:`currentColor`,viewBox:`0 0 16 16`},child:[{tag:`path`,attr:{d:`M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0m3.5 7.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5z`},child:[]}]})(e)}function dC({value:e,onChange:t,...n}){let[r,i]=(0,u.useState)(e??``),a=(0,u.useRef)();return(0,u.useEffect)(()=>{clearTimeout(a.current),i(e??``)},[e]),(0,u.useEffect)(()=>()=>clearTimeout(a.current),[]),(0,d.jsx)(`input`,{...n,value:r,onChange:e=>{let n=e.target.value;i(n),clearTimeout(a.current),a.current=setTimeout(()=>t({target:{value:n}}),300)}})}function fC({searchPanelOpen:e,setSearchPanelOpen:t,searchInput:n,setSearchInput:r,searchType:i,setSearchType:a,curSeqHitIndex:o,sequenceHits:s,setCurSeqHitIndex:c,includeRC:l,setIncludeRC:u}){return(0,d.jsxs)(`div`,{className:`bg-white p-1 text-sm shadow rounded `,children:[(0,d.jsx)(`div`,{className:`flex items-center`,children:e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),className:`bg-gray-100 hover:bg-gray-200 text-gray-800 font-semibold py-2 px-2 rounded inline-flex items-center`,children:[{value:`nuc`,label:`nuc. index`},{value:`annot`,label:`annotation`},{value:`sequence`,label:`sequence`}].map(e=>(0,d.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,d.jsx)(dC,{type:`text`,value:n,onChange:e=>{c(0),r(e.target.value),/^[0-9]+$/.test(e.target.value)?a(`nuc`):/^[ACGTacgt]+$/.test(e.target.value)?a(`sequence`):/^[^0-9]+$/.test(e.target.value)&&a(`annot`)},className:`mx-2 bg-white focus:outline-hidden focus:shadow-outline border border-gray-300 rounded-lg py-2 px-4 block w-full appearance-none leading-normal`,placeholder:i===`nuc`?`nuc. index`:i===`annot`?`gene name`:`ATGGC..`,id:`search-input`,autoComplete:`off`}),(0,d.jsx)(`button`,{className:`bg-gray-200 hover:bg-gray-300 text-gray-800 font-semibold py-2 px-4 rounded inline-flex items-center`,onClick:()=>{t(!1),r(null)},children:(0,d.jsx)(D,{className:`mr-2`})})]}):(0,d.jsx)(`button`,{className:`bg-gray-100 hover:bg-gray-200 text-gray-800 font-semibold py-2 px-4 rounded inline-flex items-center`,onClick:()=>t(!0),children:(0,d.jsx)(O,{className:`mr-2`})})}),i===`sequence`&&n&&n.length>0&&(0,d.jsxs)(`div`,{className:`my-2 text-gray-400 text-left px-3`,children:[(0,d.jsxs)(`label`,{className:`text-gray-900`,children:[` `,(0,d.jsx)(`input`,{type:`checkbox`,value:l,onChange:()=>{u(!l),c(0)}}),`\xA0Include reverse complement`]}),s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{children:(0,d.jsx)(uC,{onClick:()=>c(e=>e==0?s.length-1:e-1),className:`mx-3 text-gray-600 hover:text-gray-800`})}),`Hit `,o+1,` of `,s.length,(0,d.jsx)(`button`,{children:(0,d.jsx)(lC,{onClick:()=>c(e=>e==s.length-1?0:e+1),className:`mx-3 text-gray-600 hover:text-gray-800`})})]}),s.length===0&&(0,d.jsx)(d.Fragment,{children:`No hits found`})]})]})}function pC({genbankString:e,searchInput:t,setSearchInput:n,setTitleCallback:r,fastaUrl:i,alignedSequence:a}){let[o,s]=(0,u.useState)(``),c=t===void 0?o:t,l=(0,u.useCallback)(e=>{s(e),n?.(e)},[n]),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)({busy:!1,error:``}),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(0),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)(`nuc`),[N,{width:P}]=cC(),[F,I]=(0,u.useState)(null),[L,R]=(0,u.useState)({x:null,y:null}),[z,ee]=(0,u.useState)(null),[te,ne]=(0,u.useState)([]),[re,ie]=(0,u.useState)(0),[ae,oe]=(0,u.useState)(!1),se=O===`nuc`?parseInt(c):null,B=O===`annot`?c:null,ce=O===`sequence`&&c?c.toUpperCase():null,[le,ue]=(0,u.useState)(0);function de(){var e=document;return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}(0,u.useEffect)(()=>{let e=()=>{let e=window.pageYOffset,t=window.innerHeight,n=e/(de()-t);Math.abs(n-le)>.05&&ue(n)};return window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[le]),(0,u.useEffect)(()=>{let t=!1;return ee(null),p(null),ne([]),ie(0),(async()=>{try{let n=await av(e);if(t)return;n[0].parsedSequence.sequence=n[0].parsedSequence.sequence.toUpperCase(),ee(n[0])}catch(e){console.error(`Error loading GenBank file:`,e)}})(),()=>{t=!0}},[e]),(0,u.useEffect)(()=>{let e=z?.parsedSequence.name;e&&r&&r(f?`${f.name} vs ${e} | Gensplore`:`${e} | Gensplore`)},[z,f,r]),(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.keyCode===70&&(e.preventDefault(),y(!0),setTimeout(()=>{document.getElementById(`search-input`).focus(),document.getElementById(`search-input`).select()},100))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]),(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.keyCode===67&&S!==null&&w!==null&&(Ie(e.shiftKey),e.preventDefault())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[z,S,w]);let V=Math.floor(P*.0965/2**b);V<30&&(V=30);let fe,pe;z&&(fe=z.parsedSequence.sequence,pe=fe.length);let H=(0,u.useMemo)(()=>{if(!fe)return[];let e=[];for(let t=0;t<pe;t+=V)e.push({rowStart:t,rowEnd:t+V>pe?pe:t+V});return e},[fe,V,pe]),me=(0,u.useRef)(null),[he,ge]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{let e=me.current;if(!e)return;let t=()=>ge(e.getBoundingClientRect().top+window.scrollY);t();let n=new ResizeObserver(t);return n.observe(e.parentElement),()=>n.disconnect()},[z,P]);let _e=_t({count:H.length,estimateSize:()=>90,scrollMargin:he}),ve=_e.getVirtualItems(),[ye,be]=(0,u.useState)(null),xe=e=>{let t=ve[Math.floor(ve.length/2)].index,n=H[t].rowStart,r=H[t].rowEnd,i=Math.floor((n+r)/2);be(i),console.log(`middleRowMiddle`,i),x(e)};(0,u.useEffect)(()=>{if(!ye)return;if(S&&w){let e=Math.floor((S+w)/2);_e.scrollToIndex(3+Math.floor(e/V),{align:`center`,smoothScroll:!1}),be(null);return}let e=Math.floor(ye/V);_e.scrollToIndex(e,{align:`center`,smoothScroll:!1}),be(null),console.log(`scrolling to`,ye)},[ye,b]);let[Se,Ce]=(0,u.useState)(null),[we,Te]=(0,u.useState)(!1),[Ee,De]=(0,u.useState)(!1),[Oe,ke]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(!se)return;let e=Math.floor(se/V);se!==Se&&(e>H.length||(_e.scrollToIndex(e+1,{align:`center`}),Ce(se)))},[se,V]),(0,u.useEffect)(()=>{if(!Oe)return;let e=Math.floor(Oe.start/V);_e.scrollToIndex(e+1,{align:`center`}),ke(null)},[Oe,V]),(0,u.useEffect)(()=>{if(!B)return;let e=B.replace(/\s/g,``);if(e===``)return;let t=Si(z.parsedSequence.features,e);if(t.length===0){q.error(`No matching features found`);return}let n=t[0],r=Math.floor(n.start/V);_e.scrollToIndex(r+1,{align:`center`}),Ce(B)},[B]),(0,u.useEffect)(()=>{if(!fe||!ce){ne([]);return}let e=ce.replace(/\s/g,``);if(e===``){ne([]);return}console.log(`strippedSequenceInput`,e);let t=[],n=0,r=xi(e);for(console.log(`rc`,r);;){let i=fe.indexOf(e,n),a=ae?fe.indexOf(r,n):-1,o;if(o=i===-1?a:a===-1?i:Math.min(i,a),o===-1)break;t.push([o,o+e.length]),n=o+1}if(ne(t),console.log(`length`,t.length),t.length==0)return;let i=Math.min(re,t.length-1);i!==re&&ie(i);let a=Math.floor(t[i][0]/V);console.log(`row`,a),_e.scrollToIndex(a+1,{align:`center`}),Ce(ce)},[ce,re,ae,fe]);let[Ae,je]=(0,u.useState)(!1),[Me,U]=(0,u.useState)({}),Ne=(0,u.useMemo)(()=>{if(!z)return[];let e=[];return z.parsedSequence.features.forEach((t,n)=>{Me[n]&&e.push(t)}),e},[Me,z]);(0,u.useEffect)(()=>{if(!z)return;let e={};z.parsedSequence.features.forEach((t,n)=>{e[n]=t.type!==`source`&&t.type!==`gene`&&t.type!==`mRNA`}),U(e)},[z]);let Pe=e=>{e.preventDefault(),R({x:e.clientX,y:e.clientY})},Fe=()=>{R({x:null,y:null})},Ie=(e=!1)=>{if(S===null||w===null)return;let t=Math.min(S,w),n=Math.max(S,w),r=z.parsedSequence.sequence.substring(t,n);e&&(r=xi(r)),navigator.clipboard.writeText(r),q.success(`Copied ${e?`reverse complement `:``}to clipboard`)};return(0,u.useEffect)(()=>(document.addEventListener(`click`,Fe),()=>{document.removeEventListener(`click`,Fe)}),[]),z?P?(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(`div`,{className:`gensplore`,onContextMenu:Pe,children:[(0,d.jsx)(mi,{open:Ee,onClose:()=>De(!1),className:`gensplore fixed z-50 max-w-2xl px-4 py-6 bg-white rounded-lg shadow-xl sm:px-6 sm:py-8 sm:pb-4 sm:pt-6`,children:(0,d.jsx)(fi,{className:`fixed inset-0 flex items-center justify-center bg-gray-500/75 transition-opacity`,style:{zIndex:1e3},children:(0,d.jsxs)(`div`,{className:`bg-white rounded-lg px-4 py-4 sm:px-6 sm:py-6 shadow-md max-w-md mx-auto`,children:[(0,d.jsx)(pi,{as:`h3`,className:`text-lg font-medium leading-6 text-gray-900 mb-4`,children:`Settings`}),(0,d.jsx)(Ge,{className:`text-base text-gray-600 mb-4`,children:`Customize appearance`}),(0,d.jsx)(`p`,{className:`text-sm text-gray-500`,children:(0,d.jsxs)(`label`,{children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:we,onChange:e=>Te(e.target.checked)}),(0,d.jsx)(`span`,{className:`ml-2`,children:`Display antisense strand`})]})}),(0,d.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,d.jsx)(`button`,{type:`button`,className:`inline-flex justify-center px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 border border-transparent rounded-md hover:bg-gray-200 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500`,onClick:()=>De(!1),children:`Close`})})]})})}),(0,d.jsxs)(`div`,{className:`w-full p-5 pl-0`,children:[(0,d.jsx)(no,{}),(0,d.jsx)(`div`,{className:`fixed top-0 right-0 z-10`,children:(0,d.jsx)(fC,{searchInput:c,setSearchInput:l,searchPanelOpen:v,setSearchPanelOpen:y,searchType:O,setSearchType:k,curSeqHitIndex:re,setCurSeqHitIndex:ie,sequenceHits:te,includeRC:ae,setIncludeRC:oe})}),(0,d.jsx)(`div`,{className:`fixed bottom-0 right-0 z-10 p-2 rounded shadow bg-white comparison-toolbar`,children:(0,d.jsx)(bs,{zoomLevel:b,setZoomLevel:xe,configModalOpen:Ee,setConfigModalOpen:De,setFeatureOffcanvasOpen:je,comparisonPanelOpen:m,setComparisonPanelOpen:h,comparisonCount:f?.differences.length,comparisonStatus:g})}),(0,d.jsxs)(`div`,{className:`w-full`,children:[(0,d.jsx)(yi,{hoveredInfo:F}),z&&(0,d.jsxs)(`div`,{ref:N,children:[S!==null&&(w!==null||E!==null)&&(0,d.jsx)(`div`,{className:`fixed bottom-1 left-1 z-10 px-3 py-2 text-sm rounded-lg shadow-lg bg-linear-to-r from-gray-50 to-gray-100 border border-gray-200`,children:(0,d.jsxs)(`div`,{className:`flex flex-col `,children:[(0,d.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,d.jsx)(`span`,{className:`font-medium text-gray-700`,children:`Selection:`}),(0,d.jsxs)(`span`,{className:`font-mono text-gray-700`,children:[Math.min(S,w||E)+1,` - `,Math.max(S,w||E)]})]}),(0,d.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,d.jsx)(`span`,{className:`font-medium text-gray-700`,children:`Length:`}),(0,d.jsxs)(`span`,{className:`font-mono text-gray-700 flex items-center`,children:[Math.abs((w||E)-S),` bp`,(0,d.jsx)(`button`,{onClick:()=>Ie(),className:`ml-2 p-1 hover:bg-gray-200 rounded-full`,title:`Copy selection`,children:(0,d.jsx)(A,{className:`h-4 w-4 text-gray-500`})})]})]})]})}),(0,d.jsxs)(`div`,{className:`flex flex-col ml-4 mt-3 text-gray-900`,children:[(0,d.jsx)(`h2`,{className:`text-2xl`,style:{overflowWrap:`anywhere`},children:f?.name||z.parsedSequence.name}),(0,d.jsx)(`div`,{children:(0,d.jsx)(`div`,{className:`flex flex-row`,children:(0,d.jsxs)(`span`,{children:[f&&(0,d.jsxs)(d.Fragment,{children:[`Reference: `,(0,d.jsx)(`strong`,{children:z.parsedSequence.name}),` · `]}),z.parsedSequence.definition]})})})]}),(0,d.jsx)(vi,{open:m,setOpen:h,onStatus:_,reference:fe,features:z.parsedSequence.features,fastaUrl:i,alignedSequence:a,onResult:p,onGoTo:e=>_e.scrollToIndex(Math.floor(e/V),{align:`center`})}),(0,d.jsx)(`div`,{ref:me,className:`mt-5 h-80`,children:(0,d.jsx)(`div`,{style:{height:_e.getTotalSize(),width:`100%`,position:`relative`},className:`stripybg`,children:(0,d.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${(ve[0]?.start??0)-_e.options.scrollMargin}px)`},className:`whitebg`,children:ve.map(e=>{let t=H[e.index];return(0,d.jsx)(`div`,{ref:_e.measureElement,"data-index":e.index,children:(0,d.jsx)(co,{parsedSequence:z.parsedSequence,visibleFeatures:Ne,differences:f?.differences||[],proteins:f?.proteins,rowStart:t.rowStart,rowEnd:t.rowEnd,rowWidth:V,setHoveredInfo:I,rowId:e.index,intSearchInput:se-1,annotSearchInput:B,renderProperly:!0,zoomLevel:b,whereMouseWentDown:S,setWhereMouseWentDown:C,whereMouseWentUp:w,setWhereMouseWentUp:T,whereMouseCurrentlyIs:E,setWhereMouseCurrentlyIs:D,sequenceHits:te,curSeqHitIndex:re,enableRC:we},e.index)},e.key)})})})})]})]})]}),L.x!==null&&(0,d.jsx)(M,{x:L.x,y:L.y,onClose:Fe,onCopy:()=>{Ie(!1),Fe()},onCopyRC:()=>{Ie(!0),Fe()}}),Ae&&(0,d.jsx)(j,{isOpen:Ae,onClose:()=>je(!1),children:(0,d.jsxs)(`table`,{className:`min-w-full divide-y divide-gray-200`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,children:`Feature`}),(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,children:`Product`}),(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,children:`Type`}),(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`})]})}),(0,d.jsx)(`tbody`,{className:`bg-white divide-y divide-gray-200`,children:z?.parsedSequence.features.map((e,t)=>(0,d.jsxs)(`tr`,{children:[(0,d.jsxs)(`td`,{className:`px-6 py-4 whitespace-nowrap text-sm text-gray-600 font-medium`,children:[(0,d.jsx)(`input`,{type:`checkbox`,className:`focus:ring-indigo-500 text-indigo-600 border-gray-300 rounded mr-2`,checked:!!Me[t],onChange:()=>{let e={...Me};e[t]=!e[t],U(e)}}),e.name]}),(0,d.jsx)(`td`,{className:`px-6 py-4 whitespace-nowrap text-sm text-gray-500`,children:e.notes?.product?.join(`, `)}),(0,d.jsx)(`td`,{className:`px-6 py-4 whitespace-nowrap text-sm text-gray-500`,children:e.type}),(0,d.jsx)(`td`,{children:(0,d.jsx)(`button`,{className:`bg-gray-100 hover:bg-gray-200 text-gray-600 font-semibold py-1 px-1 border border-gray-400 rounded shadow text-sm `,onClick:()=>{je(!1),ke(e)},children:`Go to`})})]},t))})]})})]})}):(0,d.jsx)(`div`,{className:`gensplore w-full h-full p-5`,children:(0,d.jsx)(`div`,{ref:N,className:`w-full h-full`})}):(0,d.jsx)(`div`,{children:`Loading...`})}var mC=pC;module.exports=mC;
52
+ `}),l}X($S,`jsonToBed`);function eC(e){let t=wm(e);return t&&(delete t.cutsites,delete t.orfs,Bh(t.translations,e=>{delete e.aminoAcids}),t)}X(eC,`cleanUpTeselagenJsonForExport`);function tC(e,t=[]){return e.replace(/u/gi,(e,n)=>(t.push({type:`misc_feature`,name:`tg_uracil`,strand:1,start:n,end:n}),e===`U`?`T`:`t`))}X(tC,`parseUracilFeatures`);function nC(e){return JSON.stringify(ig(eC(z_(e,{annotationsAsObjects:!1})),[`sequenceFragments`,`sequenceFeatures`,`cutsites`,`orfs`,`filteredParts`,`filteredFeatures`]))}X(nC,`jsonToJsonString`);async function rC(e){let t=await av(e);for(let e of t)e.parsedSequence?.sequence&&(e.parsedSequence.sequence=e.parsedSequence.sequence.toUpperCase().replace(/U/g,`T`));return t}var iC=function(){},aC=typeof window<`u`,oC=aC?l.useLayoutEffect:l.useEffect,sC={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function cC(){var e=(0,l.useState)(null),t=e[0],n=e[1],r=(0,l.useState)(sC),i=r[0],a=r[1],o=(0,l.useMemo)(function(){return new window.ResizeObserver(function(e){if(e[0]){var t=e[0].contentRect,n=t.x,r=t.y,i=t.width,o=t.height,s=t.top,c=t.left,l=t.bottom,u=t.right;a({x:n,y:r,width:i,height:o,top:s,left:c,bottom:l,right:u})}})},[]);return oC(function(){if(t)return o.observe(t),function(){o.disconnect()}},[t]),[n,i]}var lC=aC&&window.ResizeObserver!==void 0?cC:(function(){return[iC,sC]});function uC(e){return T({tag:`svg`,attr:{fill:`currentColor`,viewBox:`0 0 16 16`},child:[{tag:`path`,attr:{d:`M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z`},child:[]}]})(e)}function dC(e){return T({tag:`svg`,attr:{fill:`currentColor`,viewBox:`0 0 16 16`},child:[{tag:`path`,attr:{d:`M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0m3.5 7.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5z`},child:[]}]})(e)}function fC({value:e,onChange:t,...n}){let[r,i]=(0,u.useState)(e??``),a=(0,u.useRef)();return(0,u.useEffect)(()=>{clearTimeout(a.current),i(e??``)},[e]),(0,u.useEffect)(()=>()=>clearTimeout(a.current),[]),(0,d.jsx)(`input`,{...n,value:r,onChange:e=>{let n=e.target.value;i(n),clearTimeout(a.current),a.current=setTimeout(()=>t({target:{value:n}}),300)}})}function pC({searchPanelOpen:e,setSearchPanelOpen:t,searchInput:n,setSearchInput:r,searchType:i,setSearchType:a,curSeqHitIndex:o,sequenceHits:s,setCurSeqHitIndex:c,includeRC:l,setIncludeRC:u}){return(0,d.jsxs)(`div`,{className:`bg-white p-1 text-sm shadow rounded `,children:[(0,d.jsx)(`div`,{className:`flex items-center`,children:e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),className:`bg-gray-100 hover:bg-gray-200 text-gray-800 font-semibold py-2 px-2 rounded inline-flex items-center`,children:[{value:`nuc`,label:`nuc. index`},{value:`annot`,label:`annotation`},{value:`sequence`,label:`sequence`}].map(e=>(0,d.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,d.jsx)(fC,{type:`text`,value:n,onChange:e=>{c(0),r(e.target.value),/^[0-9]+$/.test(e.target.value)?a(`nuc`):/^[ACGTacgt]+$/.test(e.target.value)?a(`sequence`):/^[^0-9]+$/.test(e.target.value)&&a(`annot`)},className:`mx-2 bg-white focus:outline-hidden focus:shadow-outline border border-gray-300 rounded-lg py-2 px-4 block w-full appearance-none leading-normal`,placeholder:i===`nuc`?`nuc. index`:i===`annot`?`gene name`:`ATGGC..`,id:`search-input`,autoComplete:`off`}),(0,d.jsx)(`button`,{className:`bg-gray-200 hover:bg-gray-300 text-gray-800 font-semibold py-2 px-4 rounded inline-flex items-center`,onClick:()=>{t(!1),r(null)},children:(0,d.jsx)(D,{className:`mr-2`})})]}):(0,d.jsx)(`button`,{className:`bg-gray-100 hover:bg-gray-200 text-gray-800 font-semibold py-2 px-4 rounded inline-flex items-center`,onClick:()=>t(!0),children:(0,d.jsx)(O,{className:`mr-2`})})}),i===`sequence`&&n&&n.length>0&&(0,d.jsxs)(`div`,{className:`my-2 text-gray-400 text-left px-3`,children:[(0,d.jsxs)(`label`,{className:`text-gray-900`,children:[` `,(0,d.jsx)(`input`,{type:`checkbox`,value:l,onChange:()=>{u(!l),c(0)}}),`\xA0Include reverse complement`]}),s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{children:(0,d.jsx)(dC,{onClick:()=>c(e=>e==0?s.length-1:e-1),className:`mx-3 text-gray-600 hover:text-gray-800`})}),`Hit `,o+1,` of `,s.length,(0,d.jsx)(`button`,{children:(0,d.jsx)(uC,{onClick:()=>c(e=>e==s.length-1?0:e+1),className:`mx-3 text-gray-600 hover:text-gray-800`})})]}),s.length===0&&(0,d.jsx)(d.Fragment,{children:`No hits found`})]})]})}function mC({genbankString:e,searchInput:t,setSearchInput:n,setTitleCallback:r,fastaUrl:i,alignedSequence:a}){let[o,s]=(0,u.useState)(``),c=t===void 0?o:t,l=(0,u.useCallback)(e=>{s(e),n?.(e)},[n]),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)({busy:!1,error:``}),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(0),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)(`nuc`),[N,{width:P}]=lC(),[F,I]=(0,u.useState)(null),[L,R]=(0,u.useState)({x:null,y:null}),[z,ee]=(0,u.useState)(null),[te,ne]=(0,u.useState)([]),[re,ie]=(0,u.useState)(0),[ae,oe]=(0,u.useState)(!1),se=O===`nuc`?parseInt(c):null,B=O===`annot`?c:null,ce=O===`sequence`&&c?c.toUpperCase():null,[le,ue]=(0,u.useState)(0);function de(){var e=document;return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}(0,u.useEffect)(()=>{let e=()=>{let e=window.pageYOffset,t=window.innerHeight,n=e/(de()-t);Math.abs(n-le)>.05&&ue(n)};return window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[le]),(0,u.useEffect)(()=>{let t=!1;return ee(null),p(null),ne([]),ie(0),(async()=>{try{let n=await rC(e);if(t)return;ee(n[0])}catch(e){console.error(`Error loading GenBank file:`,e)}})(),()=>{t=!0}},[e]),(0,u.useEffect)(()=>{let e=z?.parsedSequence.name;e&&r&&r(f?`${f.name} vs ${e} | Gensplore`:`${e} | Gensplore`)},[z,f,r]),(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.keyCode===70&&(e.preventDefault(),y(!0),setTimeout(()=>{document.getElementById(`search-input`).focus(),document.getElementById(`search-input`).select()},100))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]),(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.keyCode===67&&S!==null&&w!==null&&(Ie(e.shiftKey),e.preventDefault())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[z,S,w]);let V=Math.floor(P*.0965/2**b);V<30&&(V=30);let fe,pe;z&&(fe=z.parsedSequence.sequence,pe=fe.length);let H=(0,u.useMemo)(()=>{if(!fe)return[];let e=[];for(let t=0;t<pe;t+=V)e.push({rowStart:t,rowEnd:t+V>pe?pe:t+V});return e},[fe,V,pe]),me=(0,u.useRef)(null),[he,ge]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{let e=me.current;if(!e)return;let t=()=>ge(e.getBoundingClientRect().top+window.scrollY);t();let n=new ResizeObserver(t);return n.observe(e.parentElement),()=>n.disconnect()},[z,P]);let _e=_t({count:H.length,estimateSize:()=>90,scrollMargin:he}),ve=_e.getVirtualItems(),[ye,be]=(0,u.useState)(null),xe=e=>{let t=ve[Math.floor(ve.length/2)].index,n=H[t].rowStart,r=H[t].rowEnd,i=Math.floor((n+r)/2);be(i),console.log(`middleRowMiddle`,i),x(e)};(0,u.useEffect)(()=>{if(!ye)return;if(S&&w){let e=Math.floor((S+w)/2);_e.scrollToIndex(3+Math.floor(e/V),{align:`center`,smoothScroll:!1}),be(null);return}let e=Math.floor(ye/V);_e.scrollToIndex(e,{align:`center`,smoothScroll:!1}),be(null),console.log(`scrolling to`,ye)},[ye,b]);let[Se,Ce]=(0,u.useState)(null),[we,Te]=(0,u.useState)(!1),[Ee,De]=(0,u.useState)(!1),[Oe,ke]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(!se)return;let e=Math.floor(se/V);se!==Se&&(e>H.length||(_e.scrollToIndex(e+1,{align:`center`}),Ce(se)))},[se,V]),(0,u.useEffect)(()=>{if(!Oe)return;let e=Math.floor(Oe.start/V);_e.scrollToIndex(e+1,{align:`center`}),ke(null)},[Oe,V]),(0,u.useEffect)(()=>{if(!B)return;let e=B.replace(/\s/g,``);if(e===``)return;let t=Si(z.parsedSequence.features,e);if(t.length===0){q.error(`No matching features found`);return}let n=t[0],r=Math.floor(n.start/V);_e.scrollToIndex(r+1,{align:`center`}),Ce(B)},[B]),(0,u.useEffect)(()=>{if(!fe||!ce){ne([]);return}let e=ce.replace(/\s/g,``);if(e===``){ne([]);return}console.log(`strippedSequenceInput`,e);let t=[],n=0,r=xi(e);for(console.log(`rc`,r);;){let i=fe.indexOf(e,n),a=ae?fe.indexOf(r,n):-1,o;if(o=i===-1?a:a===-1?i:Math.min(i,a),o===-1)break;t.push([o,o+e.length]),n=o+1}if(ne(t),console.log(`length`,t.length),t.length==0)return;let i=Math.min(re,t.length-1);i!==re&&ie(i);let a=Math.floor(t[i][0]/V);console.log(`row`,a),_e.scrollToIndex(a+1,{align:`center`}),Ce(ce)},[ce,re,ae,fe]);let[Ae,je]=(0,u.useState)(!1),[Me,U]=(0,u.useState)({}),Ne=(0,u.useMemo)(()=>{if(!z)return[];let e=[];return z.parsedSequence.features.forEach((t,n)=>{Me[n]&&e.push(t)}),e},[Me,z]);(0,u.useEffect)(()=>{if(!z)return;let e={};z.parsedSequence.features.forEach((t,n)=>{e[n]=t.type!==`source`&&t.type!==`gene`&&t.type!==`mRNA`}),U(e)},[z]);let Pe=e=>{e.preventDefault(),R({x:e.clientX,y:e.clientY})},Fe=()=>{R({x:null,y:null})},Ie=(e=!1)=>{if(S===null||w===null)return;let t=Math.min(S,w),n=Math.max(S,w),r=z.parsedSequence.sequence.substring(t,n);e&&(r=xi(r)),navigator.clipboard.writeText(r),q.success(`Copied ${e?`reverse complement `:``}to clipboard`)};return(0,u.useEffect)(()=>(document.addEventListener(`click`,Fe),()=>{document.removeEventListener(`click`,Fe)}),[]),z?P?(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(`div`,{className:`gensplore`,onContextMenu:Pe,children:[(0,d.jsx)(mi,{open:Ee,onClose:()=>De(!1),className:`gensplore fixed z-50 max-w-2xl px-4 py-6 bg-white rounded-lg shadow-xl sm:px-6 sm:py-8 sm:pb-4 sm:pt-6`,children:(0,d.jsx)(fi,{className:`fixed inset-0 flex items-center justify-center bg-gray-500/75 transition-opacity`,style:{zIndex:1e3},children:(0,d.jsxs)(`div`,{className:`bg-white rounded-lg px-4 py-4 sm:px-6 sm:py-6 shadow-md max-w-md mx-auto`,children:[(0,d.jsx)(pi,{as:`h3`,className:`text-lg font-medium leading-6 text-gray-900 mb-4`,children:`Settings`}),(0,d.jsx)(Ge,{className:`text-base text-gray-600 mb-4`,children:`Customize appearance`}),(0,d.jsx)(`p`,{className:`text-sm text-gray-500`,children:(0,d.jsxs)(`label`,{children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:we,onChange:e=>Te(e.target.checked)}),(0,d.jsx)(`span`,{className:`ml-2`,children:`Display antisense strand`})]})}),(0,d.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,d.jsx)(`button`,{type:`button`,className:`inline-flex justify-center px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 border border-transparent rounded-md hover:bg-gray-200 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500`,onClick:()=>De(!1),children:`Close`})})]})})}),(0,d.jsxs)(`div`,{className:`w-full p-5 pl-0`,children:[(0,d.jsx)(no,{}),(0,d.jsx)(`div`,{className:`fixed top-0 right-0 z-10`,children:(0,d.jsx)(pC,{searchInput:c,setSearchInput:l,searchPanelOpen:v,setSearchPanelOpen:y,searchType:O,setSearchType:k,curSeqHitIndex:re,setCurSeqHitIndex:ie,sequenceHits:te,includeRC:ae,setIncludeRC:oe})}),(0,d.jsx)(`div`,{className:`fixed bottom-0 right-0 z-10 p-2 rounded shadow bg-white comparison-toolbar`,children:(0,d.jsx)(bs,{zoomLevel:b,setZoomLevel:xe,configModalOpen:Ee,setConfigModalOpen:De,setFeatureOffcanvasOpen:je,comparisonPanelOpen:m,setComparisonPanelOpen:h,comparisonCount:f?.differences.length,comparisonStatus:g})}),(0,d.jsxs)(`div`,{className:`w-full`,children:[(0,d.jsx)(yi,{hoveredInfo:F}),z&&(0,d.jsxs)(`div`,{ref:N,children:[S!==null&&(w!==null||E!==null)&&(0,d.jsx)(`div`,{className:`fixed bottom-1 left-1 z-10 px-3 py-2 text-sm rounded-lg shadow-lg bg-linear-to-r from-gray-50 to-gray-100 border border-gray-200`,children:(0,d.jsxs)(`div`,{className:`flex flex-col `,children:[(0,d.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,d.jsx)(`span`,{className:`font-medium text-gray-700`,children:`Selection:`}),(0,d.jsxs)(`span`,{className:`font-mono text-gray-700`,children:[Math.min(S,w||E)+1,` - `,Math.max(S,w||E)]})]}),(0,d.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,d.jsx)(`span`,{className:`font-medium text-gray-700`,children:`Length:`}),(0,d.jsxs)(`span`,{className:`font-mono text-gray-700 flex items-center`,children:[Math.abs((w||E)-S),` bp`,(0,d.jsx)(`button`,{onClick:()=>Ie(),className:`ml-2 p-1 hover:bg-gray-200 rounded-full`,title:`Copy selection`,children:(0,d.jsx)(A,{className:`h-4 w-4 text-gray-500`})})]})]})]})}),(0,d.jsxs)(`div`,{className:`flex flex-col ml-4 mt-3 text-gray-900`,children:[(0,d.jsx)(`h2`,{className:`text-2xl`,style:{overflowWrap:`anywhere`},children:f?.name||z.parsedSequence.name}),(0,d.jsx)(`div`,{children:(0,d.jsx)(`div`,{className:`flex flex-row`,children:(0,d.jsxs)(`span`,{children:[f&&(0,d.jsxs)(d.Fragment,{children:[`Reference: `,(0,d.jsx)(`strong`,{children:z.parsedSequence.name}),` · `]}),z.parsedSequence.definition]})})})]}),(0,d.jsx)(vi,{open:m,setOpen:h,onStatus:_,reference:fe,features:z.parsedSequence.features,fastaUrl:i,alignedSequence:a,onResult:p,onGoTo:e=>_e.scrollToIndex(Math.floor(e/V),{align:`center`})}),(0,d.jsx)(`div`,{ref:me,className:`mt-5 h-80`,children:(0,d.jsx)(`div`,{style:{height:_e.getTotalSize(),width:`100%`,position:`relative`},className:`stripybg`,children:(0,d.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${(ve[0]?.start??0)-_e.options.scrollMargin}px)`},className:`whitebg`,children:ve.map(e=>{let t=H[e.index];return(0,d.jsx)(`div`,{ref:_e.measureElement,"data-index":e.index,children:(0,d.jsx)(co,{parsedSequence:z.parsedSequence,visibleFeatures:Ne,differences:f?.differences||[],proteins:f?.proteins,rowStart:t.rowStart,rowEnd:t.rowEnd,rowWidth:V,setHoveredInfo:I,rowId:e.index,intSearchInput:se-1,annotSearchInput:B,renderProperly:!0,zoomLevel:b,whereMouseWentDown:S,setWhereMouseWentDown:C,whereMouseWentUp:w,setWhereMouseWentUp:T,whereMouseCurrentlyIs:E,setWhereMouseCurrentlyIs:D,sequenceHits:te,curSeqHitIndex:re,enableRC:we},e.index)},e.key)})})})})]})]})]}),L.x!==null&&(0,d.jsx)(M,{x:L.x,y:L.y,onClose:Fe,onCopy:()=>{Ie(!1),Fe()},onCopyRC:()=>{Ie(!0),Fe()}}),Ae&&(0,d.jsx)(j,{isOpen:Ae,onClose:()=>je(!1),children:(0,d.jsxs)(`table`,{className:`min-w-full divide-y divide-gray-200`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,children:`Feature`}),(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,children:`Product`}),(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,children:`Type`}),(0,d.jsx)(`th`,{className:`px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`})]})}),(0,d.jsx)(`tbody`,{className:`bg-white divide-y divide-gray-200`,children:z?.parsedSequence.features.map((e,t)=>(0,d.jsxs)(`tr`,{children:[(0,d.jsxs)(`td`,{className:`px-6 py-4 whitespace-nowrap text-sm text-gray-600 font-medium`,children:[(0,d.jsx)(`input`,{type:`checkbox`,className:`focus:ring-indigo-500 text-indigo-600 border-gray-300 rounded mr-2`,checked:!!Me[t],onChange:()=>{let e={...Me};e[t]=!e[t],U(e)}}),e.name]}),(0,d.jsx)(`td`,{className:`px-6 py-4 whitespace-nowrap text-sm text-gray-500`,children:e.notes?.product?.join(`, `)}),(0,d.jsx)(`td`,{className:`px-6 py-4 whitespace-nowrap text-sm text-gray-500`,children:e.type}),(0,d.jsx)(`td`,{children:(0,d.jsx)(`button`,{className:`bg-gray-100 hover:bg-gray-200 text-gray-600 font-semibold py-1 px-1 border border-gray-400 rounded shadow text-sm `,onClick:()=>{je(!1),ke(e)},children:`Go to`})})]},t))})]})})]})}):(0,d.jsx)(`div`,{className:`gensplore w-full h-full p-5`,children:(0,d.jsx)(`div`,{ref:N,className:`w-full h-full`})}):(0,d.jsx)(`div`,{children:`Loading...`})}var hC=mC;module.exports=hC;
package/dist/gensplore.js CHANGED
@@ -23728,8 +23728,15 @@ function wC(e) {
23728
23728
  }
23729
23729
  Z(wC, "jsonToJsonString");
23730
23730
  //#endregion
23731
+ //#region src/comparison/parseReference.mjs
23732
+ async function TC(e) {
23733
+ let t = await Dv(e);
23734
+ for (let e of t) e.parsedSequence?.sequence && (e.parsedSequence.sequence = e.parsedSequence.sequence.toUpperCase().replace(/U/g, "T"));
23735
+ return t;
23736
+ }
23737
+ //#endregion
23731
23738
  //#region node_modules/react-use/esm/misc/util.js
23732
- var TC = function() {}, EC = typeof window < "u", DC = EC ? m : d, OC = {
23739
+ var EC = function() {}, DC = typeof window < "u", OC = DC ? m : d, kC = {
23733
23740
  x: 0,
23734
23741
  y: 0,
23735
23742
  width: 0,
@@ -23739,8 +23746,8 @@ var TC = function() {}, EC = typeof window < "u", DC = EC ? m : d, OC = {
23739
23746
  bottom: 0,
23740
23747
  right: 0
23741
23748
  };
23742
- function kC() {
23743
- var e = v(null), t = e[0], n = e[1], r = v(OC), i = r[0], a = r[1], o = h(function() {
23749
+ function AC() {
23750
+ var e = v(null), t = e[0], n = e[1], r = v(kC), i = r[0], a = r[1], o = h(function() {
23744
23751
  return new window.ResizeObserver(function(e) {
23745
23752
  if (e[0]) {
23746
23753
  var t = e[0].contentRect, n = t.x, r = t.y, i = t.width, o = t.height, s = t.top, c = t.left, l = t.bottom, u = t.right;
@@ -23757,18 +23764,18 @@ function kC() {
23757
23764
  }
23758
23765
  });
23759
23766
  }, []);
23760
- return DC(function() {
23767
+ return OC(function() {
23761
23768
  if (t) return o.observe(t), function() {
23762
23769
  o.disconnect();
23763
23770
  };
23764
23771
  }, [t]), [n, i];
23765
23772
  }
23766
- var AC = EC && window.ResizeObserver !== void 0 ? kC : (function() {
23767
- return [TC, OC];
23773
+ var jC = DC && window.ResizeObserver !== void 0 ? AC : (function() {
23774
+ return [EC, kC];
23768
23775
  });
23769
23776
  //#endregion
23770
23777
  //#region node_modules/react-icons/bs/index.mjs
23771
- function jC(e) {
23778
+ function MC(e) {
23772
23779
  return ie({
23773
23780
  tag: "svg",
23774
23781
  attr: {
@@ -23782,7 +23789,7 @@ function jC(e) {
23782
23789
  }]
23783
23790
  })(e);
23784
23791
  }
23785
- function MC(e) {
23792
+ function NC(e) {
23786
23793
  return ie({
23787
23794
  tag: "svg",
23788
23795
  attr: {
@@ -23798,7 +23805,7 @@ function MC(e) {
23798
23805
  }
23799
23806
  //#endregion
23800
23807
  //#region src/SearchPanel.jsx
23801
- function NC({ value: e, onChange: t, ...n }) {
23808
+ function PC({ value: e, onChange: t, ...n }) {
23802
23809
  let [r, i] = v(e ?? ""), a = _();
23803
23810
  return d(() => {
23804
23811
  clearTimeout(a.current), i(e ?? "");
@@ -23811,7 +23818,7 @@ function NC({ value: e, onChange: t, ...n }) {
23811
23818
  }
23812
23819
  });
23813
23820
  }
23814
- function PC({ searchPanelOpen: e, setSearchPanelOpen: t, searchInput: n, setSearchInput: r, searchType: i, setSearchType: a, curSeqHitIndex: o, sequenceHits: s, setCurSeqHitIndex: c, includeRC: l, setIncludeRC: u }) {
23821
+ function FC({ searchPanelOpen: e, setSearchPanelOpen: t, searchInput: n, setSearchInput: r, searchType: i, setSearchType: a, curSeqHitIndex: o, sequenceHits: s, setCurSeqHitIndex: c, includeRC: l, setIncludeRC: u }) {
23815
23822
  return /* @__PURE__ */ S("div", {
23816
23823
  className: "bg-white p-1 text-sm shadow rounded ",
23817
23824
  children: [/* @__PURE__ */ x("div", {
@@ -23839,7 +23846,7 @@ function PC({ searchPanelOpen: e, setSearchPanelOpen: t, searchInput: n, setSear
23839
23846
  children: e.label
23840
23847
  }, e.value))
23841
23848
  }),
23842
- /* @__PURE__ */ x(NC, {
23849
+ /* @__PURE__ */ x(PC, {
23843
23850
  type: "text",
23844
23851
  value: n,
23845
23852
  onChange: (e) => {
@@ -23880,7 +23887,7 @@ function PC({ searchPanelOpen: e, setSearchPanelOpen: t, searchInput: n, setSear
23880
23887
  ]
23881
23888
  }),
23882
23889
  s.length > 0 && /* @__PURE__ */ S(b, { children: [
23883
- /* @__PURE__ */ x("button", { children: /* @__PURE__ */ x(MC, {
23890
+ /* @__PURE__ */ x("button", { children: /* @__PURE__ */ x(NC, {
23884
23891
  onClick: () => c((e) => e == 0 ? s.length - 1 : e - 1),
23885
23892
  className: "mx-3 text-gray-600 hover:text-gray-800"
23886
23893
  }) }),
@@ -23888,7 +23895,7 @@ function PC({ searchPanelOpen: e, setSearchPanelOpen: t, searchInput: n, setSear
23888
23895
  o + 1,
23889
23896
  " of ",
23890
23897
  s.length,
23891
- /* @__PURE__ */ x("button", { children: /* @__PURE__ */ x(jC, {
23898
+ /* @__PURE__ */ x("button", { children: /* @__PURE__ */ x(MC, {
23892
23899
  onClick: () => c((e) => e == s.length - 1 ? 0 : e + 1),
23893
23900
  className: "mx-3 text-gray-600 hover:text-gray-800"
23894
23901
  }) })
@@ -23900,13 +23907,13 @@ function PC({ searchPanelOpen: e, setSearchPanelOpen: t, searchInput: n, setSear
23900
23907
  }
23901
23908
  //#endregion
23902
23909
  //#region src/components/GensploreView.jsx
23903
- function FC({ genbankString: e, searchInput: t, setSearchInput: n, setTitleCallback: r, fastaUrl: i, alignedSequence: a }) {
23910
+ function IC({ genbankString: e, searchInput: t, setSearchInput: n, setTitleCallback: r, fastaUrl: i, alignedSequence: a }) {
23904
23911
  let [o, s] = v(""), c = t === void 0 ? o : t, u = l((e) => {
23905
23912
  s(e), n?.(e);
23906
23913
  }, [n]), [f, p] = v(null), [g, y] = v(!1), [C, w] = v({
23907
23914
  busy: !1,
23908
23915
  error: ""
23909
- }), [T, E] = v(!1), [D, O] = v(0), [k, A] = v(null), [j, M] = v(null), [N, P] = v(null), [F, I] = v("nuc"), [L, { width: R }] = AC(), [z, ee] = v(null), [B, te] = v({
23916
+ }), [T, E] = v(!1), [D, O] = v(0), [k, A] = v(null), [j, M] = v(null), [N, P] = v(null), [F, I] = v("nuc"), [L, { width: R }] = jC(), [z, ee] = v(null), [B, te] = v({
23910
23917
  x: null,
23911
23918
  y: null
23912
23919
  }), [V, ne] = v(null), [re, ie] = v([]), [ae, oe] = v(0), [se, ce] = v(!1), fe = F === "nuc" ? parseInt(c) : null, pe = F === "annot" ? c : null, me = F === "sequence" && c ? c.toUpperCase() : null, [he, ge] = v(0);
@@ -23926,9 +23933,9 @@ function FC({ genbankString: e, searchInput: t, setSearchInput: n, setTitleCallb
23926
23933
  let t = !1;
23927
23934
  return ne(null), p(null), ie([]), oe(0), (async () => {
23928
23935
  try {
23929
- let n = await Dv(e);
23936
+ let n = await TC(e);
23930
23937
  if (t) return;
23931
- n[0].parsedSequence.sequence = n[0].parsedSequence.sequence.toUpperCase(), ne(n[0]);
23938
+ ne(n[0]);
23932
23939
  } catch (e) {
23933
23940
  console.error("Error loading GenBank file:", e);
23934
23941
  }
@@ -24144,7 +24151,7 @@ function FC({ genbankString: e, searchInput: t, setSearchInput: n, setTitleCallb
24144
24151
  /* @__PURE__ */ x(wo, {}),
24145
24152
  /* @__PURE__ */ x("div", {
24146
24153
  className: "fixed top-0 right-0 z-10",
24147
- children: /* @__PURE__ */ x(PC, {
24154
+ children: /* @__PURE__ */ x(FC, {
24148
24155
  searchInput: c,
24149
24156
  setSearchInput: u,
24150
24157
  searchPanelOpen: T,
@@ -24374,6 +24381,6 @@ function FC({ genbankString: e, searchInput: t, setSearchInput: n, setTitleCallb
24374
24381
  }
24375
24382
  //#endregion
24376
24383
  //#region src/index.js
24377
- var IC = FC;
24384
+ var LC = IC;
24378
24385
  //#endregion
24379
- export { IC as default };
24386
+ export { LC as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gensplore",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "React component for displaying genbank files",
5
5
  "keywords": [
6
6
  "genbank",