"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6882],{16882:(e,n,t)=>{t.r(n),t.d(n,{default:()=>i});var r=t(66204),s=t(90872),a=t(1039);const l="rgb(220,220,180)",c="rgba(250,200,200)";function o({utr:e,cds:n,exons:t,sequence:s,upstream:a,downstream:o,includeIntrons:u,collapseIntron:d,intronBp:m}){const i=(n.length?[...n,...e].sort(((e,n)=>e.start-n.start)):t).filter((e=>e.start!==e.end));return r.createElement(r.Fragment,null,a?r.createElement("span",{style:{background:c}},a):null,i.map(((e,n)=>{const t=s.slice(e.end,i[n+1]?.start);return r.createElement(r.Fragment,{key:JSON.stringify(e)},r.createElement("span",{style:{background:"CDS"===e.type?l:"rgb(200,240,240)"}},s.slice(e.start,e.end)),u&&n<i.length-1?r.createElement("span",{style:{background:void 0}},d&&t.length>2*m?`${t.slice(0,m)}...${t.slice(-m)}`:t):null)})),o?r.createElement("span",{style:{background:c}},o):null)}function u({cds:e,sequence:n,codonTable:t}){const s=(0,a.zo)(e,n);let l="";for(let e=0;e<s.length;e+=3)l+=t[s.slice(e,e+3)]||"&";return r.createElement("span",{style:{background:"rgb(220,160,220)"}},l)}function d({sequence:e,upstream:n,downstream:t}){return r.createElement(r.Fragment,null,n?r.createElement("span",{style:{background:c}},n):null,r.createElement("span",{style:{background:"rgb(200,280,200)"}},e),t?r.createElement("span",{style:{background:c}},t):null)}function m({cds:e,sequence:n}){return r.createElement("span",{style:{background:l}},(0,a.zo)(e,n))}const i=r.forwardRef((function(e,n){const{feature:t,mode:l,intronBp:c=10}=e;let{sequence:{seq:i,upstream:p="",downstream:g=""}}=e;const{subfeatures:b=[]}=t,E=b.sort(((e,n)=>e.start-n.start)).map((e=>({...e,start:e.start-t.start,end:e.end-t.start})));let f=(0,a.D8)(E.filter((e=>"CDS"===e.type))),h=(0,a.D8)(E.filter((e=>e.type.match(/utr/i)))),w=(0,a.D8)(E.filter((e=>"exon"===e.type)));!h.length&&f.length&&w.length&&(h=(0,a.ZK)(f,w)),h.length||!f.length||w.length||(h=(0,a.mw)(f,{start:0,end:t.end-t.start,type:"gene"})),-1===t.strand&&([i,p,g]=[(0,s.revcom)(i),(0,s.revcom)(g),(0,s.revcom)(p)],f=(0,a.Wx)(f,i.length),w=(0,a.Wx)(w,i.length),h=(0,a.Wx)(h,i.length));const y=(0,s.generateCodonTable)(s.defaultCodonTable);return r.createElement("div",{ref:n,"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"}},`>${t.name||t.id||`${t.refName}:${t.start+1}-${t.end}`}-${l}\n`),r.createElement("br",null),"genomic"===l?r.createElement(d,{sequence:i}):"genomic_sequence_updownstream"===l?r.createElement(d,{sequence:i,upstream:p,downstream:g}):"cds"===l?r.createElement(m,{cds:f,sequence:i}):"cdna"===l?r.createElement(o,{exons:w,cds:f,utr:h,sequence:i,intronBp:c}):"protein"===l?r.createElement(u,{cds:f,codonTable:y,sequence:i}):"gene"===l?r.createElement(o,{exons:w,cds:f,utr:h,sequence:i,includeIntrons:!0,intronBp:c}):"gene_collapsed_intron"===l?r.createElement(o,{exons:w,cds:f,sequence:i,utr:h,includeIntrons:!0,collapseIntron:!0,intronBp:c}):"gene_updownstream"===l?r.createElement(o,{exons:w,cds:f,sequence:i,utr:h,upstream:p,downstream:g,includeIntrons:!0,intronBp:c}):"gene_updownstream_collapsed_intron"===l?r.createElement(o,{exons:w,cds:f,sequence:i,utr:h,upstream:p,downstream:g,includeIntrons:!0,collapseIntron:!0,intronBp:c}):r.createElement("div",null,"Unknown type")))}))}}]);
//# sourceMappingURL=6882.41439498.chunk.js.map