"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3416],{3416:(e,a,t)=>{t.r(a),t.d(a,{default:()=>A});var r=t(7552),n=t(29499),s=t(36715),o=t(59705),i=t(1343),l=t(58507),c=t(5401),d=t(49823),m=t(75785),u=t(68584),g=t(91468),f=t(99546),y=t(63352);const{featurizeSA:p,getClip:h,getLength:w,getLengthSansClipping:S,getTag:v}=y.aF,k=(0,m.n9)()({root:{width:300}});function A({track:e,feature:a,handleClose:t}){const{classes:m}=k(),[y,A]=(0,r.useState)("0"),[b,C]=(0,r.useState)(),[$,x]=(0,r.useState)(),N=+y;return(0,r.useEffect)((()=>{(async()=>{C(void 0);try{if(2048&a.get("flags")){const t=(v(a,"SA")||"").split(";")[0],[r,n]=t.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:r,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]),r.createElement(d.Dialog,{open:!0,onClose:t,title:"Set window size"},r.createElement(n.A,null,b?r.createElement(s.A,{color:"error"},`${b}`):$?r.createElement("div",{className:m.root},256&$.get("flags")?r.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,r.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."),r.createElement(i.A,{value:N,onChange:e=>A(e.target.value),label:"Set window size"})):r.createElement("div",null,r.createElement(s.A,null,"To accurately perform comparison we are fetching the primary alignment. Loading primary feature..."),r.createElement(o.A,null))),r.createElement(l.A,null,r.createElement(c.A,{variant:"contained",color:"secondary",onClick:t},"Cancel"),r.createElement(c.A,{disabled:!$,variant:"contained",color:"primary",onClick:function(){try{if(!$)return;const a=$,r=(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=h(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}=r,C=b.get(g);if(!C)throw new Error("assembly not found");const x=p(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}))));r.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()}`}]}}}),r.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}`}),t()}catch(e){console.error(e),C(e)}}},"Submit")))}},59705:(e,a,t)=>{t.d(a,{A:()=>$});var r=t(83673),n=t(6614),s=t(7552),o=t(93878),i=t(70799),l=t(64761),c=t(15622),d=t(4785),m=t(51148),u=t(72489),g=t(69500);const f=["className","color","disableShrink","size","style","thickness","value","variant"];let y,p,h,w,S=e=>e;const v=(0,l.i7)(y||(y=S`
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
`)),k=(0,l.i7)(p||(p=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:t}=e;return[a.root,a[t.variant],a[`color${(0,c.A)(t.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)(h||(h=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:t}=e;return[a.circle,a[`circle${(0,c.A)(t.variant)}`],t.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 t=(0,d.b)({props:e,name:"MuiCircularProgress"}),{className:s,color:l="primary",disableShrink:m=!1,size:y=40,style:p,thickness:h=3.6,value:w=0,variant:S="indeterminate"}=t,v=(0,r.A)(t,f),k=(0,n.A)({},t,{color:l,disableShrink:m,size:y,thickness:h,value:w,variant:S}),$=(e=>{const{classes:a,variant:t,color:r,disableShrink:n}=e,s={root:["root",t,`color${(0,c.A)(r)}`],svg:["svg"],circle:["circle",`circle${(0,c.A)(t)}`,n&&"circleDisableShrink"]};return(0,i.A)(s,u.b,a)})(k),x={},N={},R={};if("determinate"===S){const e=2*Math.PI*((44-h)/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,p),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-h)/2,fill:"none",strokeWidth:h})})}))}))},72489:(e,a,t)=>{t.d(a,{A:()=>o,b:()=>s});var r=t(33761),n=t(85693);function s(e){return(0,n.Ay)("MuiCircularProgress",e)}const o=(0,r.A)("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"])}}]);
//# sourceMappingURL=3416.c889df01.chunk.js.map