"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[6882],{16882:(e,n,t)=>{t.r(n),t.d(n,{default:()=>g});var s=t(41867),r=t(90872),c=t(1039);const o="rgb(220,220,180)",a="rgba(250,200,200)";var l=t(80838);function d(e){let{utr:n,cds:t,exons:r,sequence:c,upstream:d,downstream:u,includeIntrons:i,collapseIntron:p,intronBp:g}=e;const x=(t.length?[...t,...n].sort(((e,n)=>e.start-n.start)):r).filter((e=>e.start!==e.end));return(0,l.jsxs)(l.Fragment,{children:[d?(0,l.jsx)("span",{style:{background:a},children:d}):null,x.map(((e,n)=>{var t;const r=c.slice(e.end,null===(t=x[n+1])||void 0===t?void 0:t.start);return(0,l.jsxs)(s.Fragment,{children:[(0,l.jsx)("span",{style:{background:"CDS"===e.type?o:"rgb(200,240,240)"},children:c.slice(e.start,e.end)}),i&&n<x.length-1?(0,l.jsx)("span",{style:{background:undefined},children:p&&r.length>2*g?"".concat(r.slice(0,g),"...").concat(r.slice(-g)):r}):null]},JSON.stringify(e))})),u?(0,l.jsx)("span",{style:{background:a},children:u}):null]})}function u(e){let{cds:n,sequence:t,codonTable:s}=e;const r=(0,c.zo)(n,t);let o="";for(let c=0;c<r.length;c+=3)o+=s[r.slice(c,c+3)]||"&";return(0,l.jsx)("span",{style:{background:"rgb(220,160,220)"},children:o})}function i(e){let{sequence:n,upstream:t,downstream:s}=e;return(0,l.jsxs)(l.Fragment,{children:[t?(0,l.jsx)("span",{style:{background:a},children:t}):null,(0,l.jsx)("span",{style:{background:"rgb(200,280,200)"},children:n}),s?(0,l.jsx)("span",{style:{background:a},children:s}):null]})}function p(e){let{cds:n,sequence:t}=e;return(0,l.jsx)("span",{style:{background:o},children:(0,c.zo)(n,t)})}const g=s.forwardRef((function(e,n){const{feature:t,mode:s,intronBp:o=10}=e;let{sequence:{seq:a,upstream:g="",downstream:x=""}}=e;const{subfeatures:h=[]}=t,m=h.sort(((e,n)=>e.start-n.start)).map((e=>({...e,start:e.start-t.start,end:e.end-t.start})));let b=(0,c.D8)(m.filter((e=>"CDS"===e.type))),j=(0,c.D8)(m.filter((e=>e.type.match(/utr/i)))),f=(0,c.D8)(m.filter((e=>"exon"===e.type)));!j.length&&b.length&&f.length&&(j=(0,c.ZK)(b,f)),j.length||!b.length||f.length||(j=(0,c.mw)(b,{start:0,end:t.end-t.start,type:"gene"})),-1===t.strand&&([a,g,x]=[(0,r.revcom)(a),(0,r.revcom)(x),(0,r.revcom)(g)],b=(0,c.Wx)(b,a.length),f=(0,c.Wx)(f,a.length),j=(0,c.Wx)(j,a.length));const w=(0,r.generateCodonTable)(r.defaultCodonTable);return(0,l.jsx)("div",{ref:n,"data-testid":"sequence_panel",children:(0,l.jsxs)("div",{style:{fontFamily:"monospace",wordWrap:"break-word",overflow:"auto",color:"black",fontSize:12,maxWidth:600,maxHeight:300},children:[(0,l.jsx)("span",{style:{background:"white"},children:">".concat(t.name||t.id||"".concat(t.refName,":").concat(t.start+1,"-").concat(t.end),"-").concat(s,"\n")}),(0,l.jsx)("br",{}),"genomic"===s?(0,l.jsx)(i,{sequence:a}):"genomic_sequence_updownstream"===s?(0,l.jsx)(i,{sequence:a,upstream:g,downstream:x}):"cds"===s?(0,l.jsx)(p,{cds:b,sequence:a}):"cdna"===s?(0,l.jsx)(d,{exons:f,cds:b,utr:j,sequence:a,intronBp:o}):"protein"===s?(0,l.jsx)(u,{cds:b,codonTable:w,sequence:a}):"gene"===s?(0,l.jsx)(d,{exons:f,cds:b,utr:j,sequence:a,includeIntrons:!0,intronBp:o}):"gene_collapsed_intron"===s?(0,l.jsx)(d,{exons:f,cds:b,sequence:a,utr:j,includeIntrons:!0,collapseIntron:!0,intronBp:o}):"gene_updownstream"===s?(0,l.jsx)(d,{exons:f,cds:b,sequence:a,utr:j,upstream:g,downstream:x,includeIntrons:!0,intronBp:o}):"gene_updownstream_collapsed_intron"===s?(0,l.jsx)(d,{exons:f,cds:b,sequence:a,utr:j,upstream:g,downstream:x,includeIntrons:!0,collapseIntron:!0,intronBp:o}):(0,l.jsx)("div",{children:"Unknown type"})]})})}))}}]);
//# sourceMappingURL=6882.43fd2753.chunk.js.map