view x/static/js/5727.f7a524b6.chunk.js @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
line wrap: on
line source

"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5727],{95727:(e,t,r)=>{r.d(t,{A:()=>C});var n=r(7552),o=r(68446),a=r(36422),s=r(48231),i=r(99546),l=r(9502);function c(e,t){const r=e.get("tags");return r?r[t]:e.get(t)}function u(e,t){const r=e.get("ALT");if(r)return new Map(r.map((e=>(0,l.h)(e))).filter(i.notEmpty).map((e=>[e.MatePosition,e]))).get(`${t.get("refName")}:${t.get("start")+1}`)}var d=r(49473),g=r(72639);const f={F1R2:"LR",F2R1:"LR",F1F2:"LL",F2F1:"LL",R1R2:"RR",R2R1:"RR",R1F2:"RL",R2F1:"RL"},p={LR:"color_pair_lr",LL:"color_pair_ll",RR:"color_pair_rr",RL:"color_pair_rl"},h={color_fwd_strand_not_proper:(0,g.X4)("#CA6767",.8),color_rev_strand_not_proper:(0,g.X4)("#7272AA",.8),color_fwd_strand:(0,g.X4)("#DC2A2A",.8),color_rev_strand:(0,g.X4)("#4141BA",.8),color_fwd_missing_mate:(0,g.X4)("#921111",.8),color_rev_missing_mate:(0,g.X4)("#111192",.8),color_fwd_diff_chr:(0,g.X4)("#000000",.8),color_rev_diff_chr:(0,g.X4)("#696969",.8),color_pair_lr:(0,g.X4)("#8C8C8C",.8),color_pair_rr:(0,g.X4)("#00005A",.8),color_pair_rl:(0,g.X4)("#005A5A",.8),color_pair_ll:(0,g.X4)("#005A00",.8),color_nostrand:(0,g.X4)("#8C8C8C",.8),color_interchrom:(0,g.X4)("#5A005A",.8),color_longinsert:(0,g.X4)("#B30000",.8),color_shortinsert:(0,g.X4)("#FF3A5C",.8),color_unknown:(0,g.X4)("#555",.8)},m=h.color_unknown;function v(e,t){return-1===e&&1===t?h.color_pair_rr:1===e&&-1===t?h.color_pair_ll:h.color_unknown}function _(e,t){return-1===e&&1===t||1===e&&-1===t}function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(null,arguments)}const[w,,R]=[0,1,2,3],T=(0,o.observer)((function({model:e,trackId:t,parentRef:r,getTrackYPosOverride:o}){const{views:l,showIntraviewLinks:u}=e,g=(0,s.A)(),T=(0,i.getSession)(e),y=(0,a.getSnapshot)(e),{assemblyManager:M}=T,N=l[0],S=N?M.get(N.assemblyNames[0]):void 0;(0,d.E6)(y);const E=e.getTrackFeatures(t),b=(0,n.useMemo)((()=>function(e){for(const t of e.values())if(1&t.get("flags"))return!0;return!1}(E)),[E]),L=(0,n.useMemo)((()=>{const r=e.getMatchedFeaturesInLayout(t,b?function(e){const t=new Map,r=new Set;for(const n of e.values()){const e=n.get("flags"),o=n.id(),a=4&e,s=2&e;if(!r.has(o)&&!s&&!a){const e=n.get("name");let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}r.add(n.id())}return[...t.values()].filter((e=>e.length>1))}(E):function(e){const t=new Map,r=new Set;for(const n of e.values()){const e=n.id(),o=4&n.get("flags"),a=!!c(n,"SA");if(!r.has(e)&&!o&&a){const e=n.get("name");let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}r.add(n.id())}return[...t.values()].filter((e=>e.length>1))}(E));return b||r.forEach((e=>{e.sort(((e,t)=>e.feature.get("clipPos")-t.feature.get("clipPos")))})),r}),[E,t,b,e]),[C,O]=(0,n.useState)();let F=0;if(r.current){const e=r.current.getBoundingClientRect();F=e.top}return S?n.createElement("g",{fill:"none","data-testid":L.length?`${t}-loaded`:t},L.map((e=>{const r=[];for(let a=0;a<e.length-1;a++){const{layout:s,feature:c,level:y}=e[a],{layout:M,feature:N,level:L}=e[a+1];if(!s||!M)return console.warn("received null layout for a overlay feature"),null;if(!u&&y===L)return null;const A=S.getCanonicalRefName(c.get("refName")),W=S.getCanonicalRefName(N.get("refName"));if(!A||!W)throw new Error(`unable to find ref for ${A||W}`);const X={pair_orientation:c.get("pair_orientation")},B=c.get("strand"),$=N.get("strand");let J="",I=!1;A===W&&(b?(J=function(e){const t=f[e.pair_orientation||""];return"LR"===t?void 0:h[p[t]]}(X)||m,I="LR"!==f[X.pair_orientation||""]):(J=v(B,$),I=_(B,$)));const P=s[-1===B?w:R],j=-1===$,D=b?M[j?w:R]:M[j?R:w],x=(0,d.Tp)(l[y],A,P),V=(0,d.Tp)(l[L],W,D),Y=l[y].pxToBp(x).reversed?-1:1,H=l[L].pxToBp(V).reversed?-1:1,q=l.map((e=>e.getTrack(t))),z=(0,d.Ec)(t,y,l,q,s,o)-F,G=(0,d.Ec)(t,L,l,q,M,o)-F,K=y===L&&I,Q=K?q[y].displays[0].height:0,U=b?-1:1,Z=(0,d.eW)(l,t,y,o),ee=["M",x,z,"C",x+200*c.get("strand")*Y,K?Math.min(Z-F+Q,z+Q):z,V-200*N.get("strand")*H*U,K?Math.min(Z-F+Q,G+Q):G,V,G].join(" "),te=`${c.id()}-${N.id()}`;r.push(n.createElement("path",k({d:ee,key:te,"data-testid":"r1",strokeWidth:C===te?5:1},(0,i.getStrokeProps)(J||g.palette.text.disabled),{onClick:()=>{const e=T.addWidget?.("BreakpointAlignmentsWidget","breakpointAlignments",{featureData:{feature1:(E.get(c.id())||{toJSON:()=>{}}).toJSON(),feature2:(E.get(N.id())||{toJSON:()=>{}}).toJSON()}});T.showWidget?.(e)},onMouseOver:()=>{O(te)},onMouseOut:()=>{O(void 0)}})))}return r}))):null})),[y]=[0,1,2,3],M=(0,o.observer)((function({model:e,trackId:t,parentRef:r,getTrackYPosOverride:o}){const{views:s}=e,c=(0,i.getSession)(e),{assemblyManager:g}=c,f=e.getTrackFeatures(t),p=(0,n.useMemo)((()=>e.getMatchedFeaturesInLayout(t,function(e){const t=new Map,r=new Set;for(const n of e.values()){if(!r.has(n.id())&&"breakend"===n.get("type")){const e=n.get("ALT");e?.forEach((e=>{const r=`${n.get("refName")}:${n.get("start")+1}`,o=(0,l.h)(e);if(o){const e=t.get(r);e?e.push(n):t.set(o.MatePosition||"none",[n])}}))}r.add(n.id())}return[...t.values()].filter((e=>e.length>1))}(f))),[f,t,e]),[h,m]=(0,n.useState)(),v=(0,a.getSnapshot)(e);(0,d.E6)(v);const _=g.get(s[0].assemblyNames[0]);if(!_)return null;let k=0;if(r.current){const e=r.current.getBoundingClientRect();k=e.top}return n.createElement("g",{stroke:"green",strokeWidth:5,fill:"none","data-testid":p.length?`${t}-loaded`:t},p.map((e=>{const r=[];for(let a=0;a<e.length-1;a+=1){const{layout:i,feature:l,level:g}=e[a],{layout:p,feature:v,level:w}=e[a+1],R=l.id(),T=u(l,v);if(!i||!p)return null;const M=l.get("refName"),N=v.get("refName"),S=_.getCanonicalRefName(M),E=_.getCanonicalRefName(N);if(!S||!E)throw new Error(`unable to find ref for ${S||E}`);const b=(0,d.Tp)(s[g],S,i[y]),L=(0,d.Tp)(s[w],E,p[y]),C=s[g].pxToBp(b).reversed,O=s[w].pxToBp(L).reversed,F=s.map((e=>e.getTrack(t))),A=(0,d.Ec)(t,g,s,F,i,o)-k,W=(0,d.Ec)(t,w,s,F,p,o)-k;if(T){const e=["M",b-20*("left"===T.Join?-1:1)*(C?-1:1),A,"L",b,A,"L",L,W,"L",L-20*("left"===T.MateDirection?1:-1)*(O?-1:1),W].join(" ");r.push(n.createElement("path",{d:e,"data-testid":"r2",key:JSON.stringify(e),strokeWidth:R===h?10:5,onClick:()=>{const e=c.addWidget?.("VariantFeatureWidget","variantFeature",{featureData:f.get(R)?.toJSON()});c.showWidget?.(e)},onMouseOver:()=>{m(R)},onMouseOut:()=>{m(void 0)}}))}else console.warn("the relevant ALT allele was not found, cannot render")}return r})))})),[N]=[0,1,2,3];function S(e){return"+"===e?1:"-"===e?-1:0}const E=(0,o.observer)((function({model:e,trackId:t,parentRef:r,getTrackYPosOverride:o}){const{views:s}=e,l=(0,i.getSession)(e),{assemblyManager:c}=l,u=e.getTrackFeatures(t),g=(0,n.useMemo)((()=>e.getMatchedFeaturesInLayout(t,function(e){const t=[],r=new Set;for(const n of e.values())r.has(n.id())||"<TRA>"!==n.get("ALT")[0]||t.push([n]),r.add(n.id());return t}(u))),[u,t,e]),[f,p]=(0,n.useState)(),h=(0,a.getSnapshot)(e);if((0,d.E6)(h),!c.get(s[0].assemblyNames[0]))return null;let m=0;if(r.current){const e=r.current.getBoundingClientRect();m=e.top}return s.length<2?null:n.createElement("g",{fill:"none",stroke:"green",strokeWidth:5,"data-testid":g.length?`${t}-loaded`:t},g.map((e=>{const r=[];for(const{layout:a,feature:i,level:c}of e){const e=0===c?1:0,g=i.id();if(!a)return null;const h=i.get("INFO"),v=h.CHR2[0],_=h.END[0],k=h.STRANDS?.[0]?.split(""),[w,R]=k??[".","."],T=(0,d.Tp)(s[e],v,_);if(T){const h=[T,0,T+1,0],v=(0,d.Tp)(s[c],i.get("refName"),a[N]),_=T,k=s[c].pxToBp(v).reversed,y=s[e].pxToBp(_).reversed,M=s.map((e=>e.getTrack(t))),E=(0,d.Ec)(t,c,s,M,a,o)-m,b=(0,d.Ec)(t,e,s,M,h,o)-m,L=["M",v-20*S(w)*(k?-1:1),E,"L",v,E,"L",_,b,"L",_-20*S(R)*(y?-1:1),b].join(" ");r.push(n.createElement("path",{d:L,key:JSON.stringify(L),strokeWidth:g===f?10:5,onClick:()=>{const e=l.addWidget?.("VariantFeatureWidget","variantFeature",{featureData:(u.get(g)||{toJSON:()=>{}}).toJSON()});l.showWidget?.(e)},onMouseOver:()=>{p(g)},onMouseOut:()=>{p(void 0)}}))}}return r})))})),[b]=[0,1,2,3],L=(0,o.observer)((function({model:e,trackId:t,parentRef:r,getTrackYPosOverride:o}){const{views:s}=e,l=(0,i.getSession)(e),{assemblyManager:c}=l,u=e.getTrackFeatures(t),g=(0,n.useMemo)((()=>e.getMatchedFeaturesInLayout(t,function(e){const t=new Map,r=new Set;for(const n of e.values()){if(!r.has(n.id())&&"paired_feature"===n.get("type")){const e=n.id().replace("-r1",""),r=n.id().replace("-r2","");n.id().endsWith("-r1")?(t.get(e)||t.set(e,[]),t.get(e).push(n)):n.id().endsWith("-r2")&&(t.get(r)||t.set(r,[]),t.get(r).push(n))}r.add(n.id())}return[...t.values()].filter((e=>e.length>1))}(u))),[u,t,e]),[f,p]=(0,n.useState)(),h=(0,a.getSnapshot)(e);(0,d.E6)(h);const m=c.get(s[0].assemblyNames[0]);if(!m)return null;let v=0;if(r.current){const e=r.current.getBoundingClientRect();v=e.top}return n.createElement("g",{stroke:"green",strokeWidth:5,fill:"none","data-testid":g.length?`${t}-loaded`:t},g.map((e=>{const r=[];for(let a=0;a<e.length-1;a+=1){const{layout:i,feature:c,level:g}=e[a],{layout:h,feature:_,level:k}=e[a+1],w=c.id();if(!i||!h)return null;const R=c.get("refName"),T=_.get("refName"),y=m.getCanonicalRefName(R),M=m.getCanonicalRefName(T);if(!y||!M)throw new Error(`unable to find ref for ${y||M}`);const N=(0,d.Tp)(s[g],y,i[b]),S=(0,d.Tp)(s[k],M,h[b]),E=s.map((e=>e.getTrack(t))),L=["M",N,(0,d.Ec)(t,g,s,E,i,o)-v,"L",S,(0,d.Ec)(t,k,s,E,h,o)-v].join(" ");r.push(n.createElement("path",{d:L,"data-testid":"r2",key:JSON.stringify(L),strokeWidth:w===f?10:5,onClick:()=>{const e=l.addWidget?.("VariantFeatureWidget","variantFeature",{featureData:u.get(w)?.toJSON()});l.showWidget?.(e)},onMouseOver:()=>{p(w)},onMouseOut:()=>{p(void 0)}}))}return r})))})),C=(0,o.observer)((function(e){const{model:t,trackId:r}=e,o=t.getMatchedTracks(r);return"AlignmentsTrack"===o[0]?.type?n.createElement(T,e):"VariantTrack"===o[0]?.type?t.hasTranslocations(r)?n.createElement(E,e):t.hasPairedFeatures(r)?n.createElement(L,e):n.createElement(M,e):null}))}}]);
//# sourceMappingURL=5727.f7a524b6.chunk.js.map