"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3408],{13408:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var r=n(7552),s=n(99546),a=n(373),l=n(68446);const c="rgb(220,220,180)",o="rgba(250,200,200)",u=(0,l.observer)((function({utr:e,cds:t,exons:n,sequence:s,upstream:a,downstream:l,includeIntrons:u,collapseIntron:d,model:m}){const{upperCaseCDS:p,intronBp:g}=m,i=t.length>0,b=(t.length?[...t,...e].sort(((e,t)=>e.start-t.start)):n).filter((e=>e.start!==e.end)),E=e=>p?e.toLowerCase():e,h=e=>p?e.toUpperCase():e;return r.createElement(r.Fragment,null,a?r.createElement("span",{style:{background:o}},E(a)):null,b.map(((e,t)=>{const n=s.slice(e.end,b[t+1]?.start);return r.createElement(r.Fragment,{key:JSON.stringify(e)},r.createElement("span",{style:{background:"CDS"===e.type?c:"rgb(200,240,240)"}},i?"CDS"===e.type?h(s.slice(e.start,e.end)):E(s.slice(e.start,e.end)):h(s.slice(e.start,e.end))),u&&t<b.length-1?r.createElement("span",{style:{background:void 0}},E(d&&n.length>2*g?`${n.slice(0,g)}...${n.slice(-g)}`:n)):null)})),l?r.createElement("span",{style:{background:o}},E(l)):null)}));function d({cds:e,sequence:t,codonTable:n}){const s=(0,a.o9)(e,t);let l="";for(let e=0;e<s.length;e+=3)l+=n[s.slice(e,e+3)]||"&";return r.createElement("span",{style:{background:"rgb(220,160,220)"}},l)}function m({sequence:e,upstream:t,downstream:n}){return r.createElement(r.Fragment,null,t?r.createElement("span",{style:{background:o}},t):null,r.createElement("span",{style:{background:"rgb(200,280,200)"}},e),n?r.createElement("span",{style:{background:o}},n):null)}function p({cds:e,sequence:t}){return r.createElement("span",{style:{background:c}},(0,a.o9)(e,t))}const g=r.forwardRef((function(e,t){const{model:n,feature:l,mode:c}=e;let{sequence:{seq:o,upstream:g="",downstream:i=""}}=e;const{subfeatures:b=[]}=l,E=b.sort(((e,t)=>e.start-t.start)).map((e=>({...e,start:e.start-l.start,end:e.end-l.start})));let h=(0,a.Qq)(E.filter((e=>"CDS"===e.type))),f=(0,a.Qq)(E.filter((e=>e.type?.match(/utr/i)))),w=(0,a.Qq)(E.filter((e=>"exon"===e.type)));!f.length&&h.length&&w.length&&(f=(0,a.h8)(h,w)),f.length||!h.length||w.length||(f=(0,a.V4)(h,{start:0,end:l.end-l.start,type:"gene"})),-1===l.strand&&([o,g,i]=[(0,s.revcom)(o),(0,s.revcom)(i),(0,s.revcom)(g)],h=(0,a.YC)(h,o.length),w=(0,a.YC)(w,o.length),f=(0,a.YC)(f,o.length));const y=(0,s.generateCodonTable)(s.defaultCodonTable);return r.createElement("div",{ref:t,"data-testid":"sequence_panel"},r.createElement("div",{style:{fontFamily:"monospace",wordWrap:"break-word",overflow:"auto",color:"black",fontSize:12,maxWidth:600,maxHeight:300}},r.createElement("span",{style:{background:"white"}},`>${l.name||l.id||`${l.refName}:${l.start+1}-${l.end}`}-${c}\n`),r.createElement("br",null),"genomic"===c?r.createElement(m,{sequence:o}):"genomic_sequence_updownstream"===c?r.createElement(m,{sequence:o,upstream:g,downstream:i}):"cds"===c?r.createElement(p,{cds:h,sequence:o}):"cdna"===c?r.createElement(u,{model:n,exons:w,cds:h,utr:f,sequence:o}):"protein"===c?r.createElement(d,{cds:h,codonTable:y,sequence:o}):"gene"===c?r.createElement(u,{model:n,exons:w,cds:h,utr:f,sequence:o,includeIntrons:!0}):"gene_collapsed_intron"===c?r.createElement(u,{model:n,exons:w,cds:h,sequence:o,utr:f,includeIntrons:!0,collapseIntron:!0}):"gene_updownstream"===c?r.createElement(u,{model:n,exons:w,cds:h,sequence:o,utr:f,upstream:g,downstream:i,includeIntrons:!0}):"gene_updownstream_collapsed_intron"===c?r.createElement(u,{model:n,exons:w,cds:h,sequence:o,utr:f,upstream:g,downstream:i,includeIntrons:!0,collapseIntron:!0}):r.createElement("div",null,"Unknown type")))}))}}]);
//# sourceMappingURL=3408.2dc54308.chunk.js.map