"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3416],{3416:(e,a,r)=>{r.r(a),r.d(a,{default:()=>A});var t=r(7552),n=r(29499),s=r(36715),o=r(59705),i=r(1343),l=r(58507),c=r(5401),d=r(48735),m=r(75785),u=r(68584),g=r(91468),f=r(99546),y=r(63352);const{featurizeSA:h,getClip:p,getLength:w,getLengthSansClipping:S,getTag:v}=y.MismatchParser,k=(0,m.n9)()({root:{width:300}});function A({track:e,feature:a,handleClose:r}){const{classes:m}=k(),[y,A]=(0,t.useState)("0"),[b,C]=(0,t.useState)(),[$,x]=(0,t.useState)(),N=+y;return(0,t.useEffect)((()=>{(async()=>{C(void 0);try{if(2048&a.get("flags")){const r=(v(a,"SA")||"").split(";")[0],[t,n]=r.split(","),{rpcManager:s}=(0,f.getSession)(e),o=(0,u.getConf)(e,"adapter"),i=(0,g.getRpcSessionId)(e),l=(await s.call(i,"CoreGetFeatures",{adapterConfig:o,sessionId:i,regions:[{refName:t,start:+n-1,end:+n}]})).find((e=>!(e.get("name")!==a.get("name")||2048&e.get("flags")||256&e.get("flags"))));if(!l)throw new Error("primary feature not found");x(l)}else x(a)}catch(e){console.error(e),C(e)}})()}),[a,e]),t.createElement(d.Dialog,{open:!0,onClose:r,title:"Set window size"},t.createElement(n.A,null,b?t.createElement(s.A,{color:"error"},`${b}`):$?t.createElement("div",{className:m.root},256&$.get("flags")?t.createElement(s.A,{style:{color:"orange"}},"Note: You selected a secondary alignment (which generally does not have SA tags or SEQ fields) so do a full reconstruction of the alignment"):null,t.createElement(s.A,null,"Show an extra window size around each part of the split alignment. Using a larger value can allow you to see more genomic context."),t.createElement(i.A,{value:N,onChange:e=>A(e.target.value),label:"Set window size"})):t.createElement("div",null,t.createElement(s.A,null,"To accurately perform comparison we are fetching the primary alignment. Loading primary feature..."),t.createElement(o.A,null))),t.createElement(l.A,null,t.createElement(c.A,{variant:"contained",color:"secondary",onClick:r},"Cancel"),t.createElement(c.A,{disabled:!$,variant:"contained",color:"primary",onClick:function(){try{if(!$)return;const a=$,t=(0,f.getSession)(e),n=(0,f.getContainingView)(e),s=a.get("CIGAR"),o=a.get("flags"),i=a.get("strand"),l=v(a,"SA")||"",c=a.get("name"),d=p(s,1),m=`${c}_assembly_${Date.now()}`,[g]=(0,u.getConf)(e,"assemblyNames"),y=[g,m],k=`track-${Date.now()}`,A=`${c}_vs_${g}`,{assemblyManager:b}=t,C=b.get(g);if(!C)throw new Error("assembly not found");const x=h(l,a.id(),i,c,!0),R=a.toJSON();R.clipPos=d,R.strand=1,R.mate={refName:c,start:d,end:d+S(s)};const D=w(2048&o?x[0].CIGAR:s),E=[R,...x];E.forEach(((e,a)=>{e.refName=C?.getCanonicalRefName(e.refName)||e.refName,e.syntenyId=a,e.mate.syntenyId=a,e.mate.uniqueId=`${e.uniqueId}_mate`})),E.sort(((e,a)=>e.clipPos-a.clipPos));const M=a.get("seq"),P=[...E,...E.map((e=>e.mate))],q=2*N,I=E.reduce(((e,a)=>e+a.end-a.start+q),0),L=`${c}_${Date.now()}`,T=(0,u.getConf)(C,"sequence"),_=(0,f.gatherOverlaps)(E.map((e=>({...e,start:Math.max(0,e.start-N),end:e.end+N,assemblyName:g}))));t.addTemporaryAssembly?.({name:`${m}`,sequence:{type:"ReferenceSequenceTrack",name:"Read sequence",trackId:L,assemblyNames:[m],adapter:{type:"FromConfigSequenceAdapter",noAssemblyManager:!0,features:[{start:0,end:D,seq:M||"",refName:c,uniqueId:`${Math.random()}`}]}}}),t.addView("LinearSyntenyView",{type:"LinearSyntenyView",views:[{type:"LinearGenomeView",hideHeader:!0,offsetPx:0,bpPerPx:I/n.width,displayedRegions:_,tracks:[{id:`${Math.random()}`,type:"ReferenceSequenceTrack",assemblyNames:[g],configuration:T.trackId,displays:[{id:`${Math.random()}`,type:"LinearReferenceSequenceDisplay",showReverse:!0,showTranslation:!1,height:35,configuration:`${L}-LinearReferenceSequenceDisplay`}]}]},{type:"LinearGenomeView",hideHeader:!0,offsetPx:0,bpPerPx:D/n.width,displayedRegions:[{assemblyName:m,start:0,end:D,refName:c}],tracks:[{id:`${Math.random()}`,type:"ReferenceSequenceTrack",configuration:L,displays:[{id:`${Math.random()}`,type:"LinearReferenceSequenceDisplay",showReverse:!0,showTranslation:!1,height:35,configuration:`${L}-LinearReferenceSequenceDisplay`}]}]}],viewTrackConfigs:[{type:"SyntenyTrack",assemblyNames:y,adapter:{type:"FromConfigAdapter",features:P},trackId:k,name:A}],tracks:[{configuration:k,type:"SyntenyTrack",displays:[{type:"LinearSyntenyDisplay",configuration:`${k}-LinearSyntenyDisplay`}]}],displayName:`${c} vs ${g}`}),r()}catch(e){console.error(e),C(e)}}},"Submit")))}},59705:(e,a,r)=>{r.d(a,{A:()=>$});var t=r(83673),n=r(6614),s=r(7552),o=r(93878),i=r(60827),l=r(64761),c=r(15622),d=r(31049),m=r(51148),u=r(72489),g=r(69500);const f=["className","color","disableShrink","size","style","thickness","value","variant"];let y,h,p,w,S=e=>e;const v=(0,l.i7)(y||(y=S`
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
`)),k=(0,l.i7)(h||(h=S`
  0% {
    stroke-dasharray: 1px, 200px;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 100px, 200px;
    stroke-dashoffset: -15px;
  }

  100% {
    stroke-dasharray: 100px, 200px;
    stroke-dashoffset: -125px;
  }
`)),A=(0,m.Ay)("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:r}=e;return[a.root,a[r.variant],a[`color${(0,c.A)(r.color)}`]]}})((({ownerState:e,theme:a})=>(0,n.A)({display:"inline-block"},"determinate"===e.variant&&{transition:a.transitions.create("transform")},"inherit"!==e.color&&{color:(a.vars||a).palette[e.color].main})),(({ownerState:e})=>"indeterminate"===e.variant&&(0,l.AH)(p||(p=S`
      animation: ${0} 1.4s linear infinite;
    `),v))),b=(0,m.Ay)("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,a)=>a.svg})({display:"block"}),C=(0,m.Ay)("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,a)=>{const{ownerState:r}=e;return[a.circle,a[`circle${(0,c.A)(r.variant)}`],r.disableShrink&&a.circleDisableShrink]}})((({ownerState:e,theme:a})=>(0,n.A)({stroke:"currentColor"},"determinate"===e.variant&&{transition:a.transitions.create("stroke-dashoffset")},"indeterminate"===e.variant&&{strokeDasharray:"80px, 200px",strokeDashoffset:0})),(({ownerState:e})=>"indeterminate"===e.variant&&!e.disableShrink&&(0,l.AH)(w||(w=S`
      animation: ${0} 1.4s ease-in-out infinite;
    `),k))),$=s.forwardRef((function(e,a){const r=(0,d.A)({props:e,name:"MuiCircularProgress"}),{className:s,color:l="primary",disableShrink:m=!1,size:y=40,style:h,thickness:p=3.6,value:w=0,variant:S="indeterminate"}=r,v=(0,t.A)(r,f),k=(0,n.A)({},r,{color:l,disableShrink:m,size:y,thickness:p,value:w,variant:S}),$=(e=>{const{classes:a,variant:r,color:t,disableShrink:n}=e,s={root:["root",r,`color${(0,c.A)(t)}`],svg:["svg"],circle:["circle",`circle${(0,c.A)(r)}`,n&&"circleDisableShrink"]};return(0,i.A)(s,u.b,a)})(k),x={},N={},R={};if("determinate"===S){const e=2*Math.PI*((44-p)/2);x.strokeDasharray=e.toFixed(3),R["aria-valuenow"]=Math.round(w),x.strokeDashoffset=`${((100-w)/100*e).toFixed(3)}px`,N.transform="rotate(-90deg)"}return(0,g.jsx)(A,(0,n.A)({className:(0,o.A)($.root,s),style:(0,n.A)({width:y,height:y},N,h),ownerState:k,ref:a,role:"progressbar"},R,v,{children:(0,g.jsx)(b,{className:$.svg,ownerState:k,viewBox:"22 22 44 44",children:(0,g.jsx)(C,{className:$.circle,style:x,ownerState:k,cx:44,cy:44,r:(44-p)/2,fill:"none",strokeWidth:p})})}))}))},72489:(e,a,r)=>{r.d(a,{A:()=>o,b:()=>s});var t=r(55549),n=r(9577);function s(e){return(0,n.Ay)("MuiCircularProgress",e)}const o=(0,t.A)("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"])}}]);
//# sourceMappingURL=3416.d0dca7a0.chunk.js.map