view x/static/js/4060.8757dbe8.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([[4060],{24060:(e,t,r)=>{r.d(t,{makeImageData:()=>b});var a=r(68584),o=r(49823),n=r(99546);function i(e,t,r,a,o,n,i){t+a<0||t>n||(i&&(e.fillStyle=i),e.fillRect(t,r,a,o))}function s(e){const{bases:t}=e.palette;return{A:t.A.main,C:t.C.main,G:t.G.main,T:t.T.main,deletion:"#808080"}}function c(){return{charWidth:(0,n.measureText)("A"),charHeight:(0,n.measureText)("M")-2}}var l=r(36917),f=r(86576);function h({colorType:e,tag:t,feature:r,config:o,defaultColor:n,colorTagMap:i}){switch(e){case"insertSize":return function(e){return e.get("is_paired")&&e.get("refName")!==e.get("next_ref")?"#555":`hsl(${Math.abs(e.get("template_length"))/10},50%,50%)`}(r);case"strand":return function(e){return-1===e.get("strand")?"#8F8FD8":"#EC8B8B"}(r);case"mappingQuality":return function(e){return`hsl(${e.get("score")},50%,50%)`}(r);case"pairOrientation":return function(e,t){return l.pf[function(e,t){const r=(0,a.readConfObject)(t,"orientationType");return{LR:"color_pair_lr",RR:"color_pair_rr",RL:"color_pair_rl",LL:"color_pair_ll"}[f.il[r][e.get("pair_orientation")]]}(e,t)||"color_nostrand"]}(r,o);case"stranded":return function(e){return l.pf[function(e){const t=e.get("flags"),r=e.get("strand");if(1&t){const a=64&t?-1:1;return 2&t?r*a==1?"color_rev_strand":"color_fwd_strand":8&t?r*a==1?"color_rev_missing_mate":"color_fwd_missing_mate":e.get("refName")===e.get("next_ref")?r*a==1?"color_rev_strand_not_proper":"color_fwd_strand_not_proper":1===r?"color_fwd_diff_chr":"color_rev_diff_chr"}return"color_unknown"}(e)]}(r);case"xs":case"tag":{const e=r.get("tags"),a=e?e[t]:r.get(t);return"XS"===t||"TS"===t?"-"===a?l.pf.color_rev_strand:"+"===a?l.pf.color_fwd_strand:l.pf.color_nostrand:"ts"===t?"-"===a?-1===r.get("strand")?l.pf.color_fwd_strand:l.pf.color_rev_strand:"+"===a?-1===r.get("strand")?l.pf.color_rev_strand:l.pf.color_fwd_strand:l.pf.color_nostrand:i[a]||l.pf.color_nostrand}case"insertSizeAndPairOrientation":break;case"modifications":case"methylation":return 16&r.get("flags")?"#c8dcc8":"#c8c8c8";default:return n?"lightgrey":(0,a.readConfObject)(o,"color",{feature:r})}}var g=r(80544),d=r(87485);function p({ctx:e,feat:t,renderArgs:r,colorForBase:a,contrastForBase:o,charWidth:s,charHeight:c,defaultColor:l,canvasWidth:p}){const{config:u,bpPerPx:x,regions:b,colorBy:m,colorTagMap:P={}}=r,{tag:_="",type:S=""}=m||{},{feature:T}=t,M=b[0];switch(e.fillStyle=h({feature:T,config:u,tag:_,defaultColor:l,colorType:S,colorTagMap:P}),function({ctx:e,feat:t,renderArgs:r}){const{regions:a,bpPerPx:o}=r,{heightPx:i,topPx:s,feature:c}=t,l=a[0],f=c.get("start"),h=c.get("end"),[g,d]=(0,n.bpSpanPx)(f,h,l,o),p=l.reversed?-1:1,u=c.get("strand")*p;o<10&&i>5?-1===u?(e.beginPath(),e.moveTo(g-5,s+i/2),e.lineTo(g,s+i),e.lineTo(d,s+i),e.lineTo(d,s),e.lineTo(g,s),e.closePath(),e.fill()):(e.beginPath(),e.moveTo(g,s),e.lineTo(g,s+i),e.lineTo(d,s+i),e.lineTo(d+5,s+i/2),e.lineTo(d,s),e.closePath(),e.fill()):e.fillRect(g,s,d-g,i)}({ctx:e,feat:t,renderArgs:r}),S){case"perBaseQuality":!function({ctx:e,feat:t,region:r,bpPerPx:a,canvasWidth:o}){const{feature:s,topPx:c,heightPx:l}=t,f=(s.get("qual")||"").split(" ").map((e=>+e)),h=(0,g.parseCigar)(s.get("CIGAR")),d=1/a,p=s.get("start");let u=0,x=0;for(let t=0;t<h.length;t+=2){const s=+h[t],g=h[t+1];if("S"===g||"I"===g)u+=s;else if("D"===g||"N"===g)x+=s;else if("M"===g||"X"===g||"="===g){for(let t=0;t<s;t++){const s=f[u+t],h=p+x+t;i(e,(0,n.bpSpanPx)(h,h+1,r,a)[0],c,d+.5,l,o,`hsl(${255===s?150:1.5*s},55%,50%)`)}u+=s,x+=s}}}({ctx:e,feat:t,region:M,bpPerPx:x,canvasWidth:p});break;case"perBaseLettering":!function({ctx:e,feat:t,region:r,bpPerPx:a,colorForBase:o,contrastForBase:s,charWidth:c,charHeight:l,canvasWidth:f}){const h=l-2,{feature:d,topPx:p,heightPx:u}=t,x=d.get("seq"),b=(0,g.parseCigar)(d.get("CIGAR")),m=1/a,P=d.get("start");let _=0,S=0;if(x)for(let t=0;t<b.length;t+=2){const l=+b[t],g=b[t+1];if("S"===g||"I"===g)_+=l;else if("D"===g||"N"===g)S+=l;else if("M"===g||"X"===g||"="===g){for(let t=0;t<l;t++){const l=x[_+t],g=P+S+t,[d]=(0,n.bpSpanPx)(g,g+1,r,a);i(e,d,p,m+.5,u,f,o[l]),m>=c&&u>=h&&(e.fillStyle=s[l],e.fillText(l,d+(m-c)/2+1,p+u))}_+=l,S+=l}}}({ctx:e,feat:t,region:M,bpPerPx:x,colorForBase:a,contrastForBase:o,charWidth:s,charHeight:c,canvasWidth:p});break;case"modifications":!function({ctx:e,feat:t,region:r,bpPerPx:a,renderArgs:o,canvasWidth:s}){const{feature:c,topPx:l,heightPx:h}=t,{modificationTagMap:p={}}=o,u=c.get("seq");if(!u)return;const x=(0,f.c$)(c,"MM","Mm")||"",b=c.get("CIGAR"),m=c.get("start"),P=c.get("strand"),_=(0,g.parseCigar)(b),S=(0,g.getModificationProbabilities)(c),T=(0,g.getModificationPositions)(x,u,P);let M=0;for(const{type:t,positions:o}of T){const c=p[t]||"black",f=(0,d.M)(c);for(const t of(0,g.getNextRefPos)(_,o)){const o=m+t,[g,d]=(0,n.bpSpanPx)(o,o+1,r,a),p=S?.[M]||0;i(e,g,l,d-g+.5,h,s,1!==p?f.alpha(p+.1).toHslString():c),M++}}}({ctx:e,feat:t,region:M,bpPerPx:x,renderArgs:r,canvasWidth:p});break;case"methylation":!function({ctx:e,feat:t,region:r,bpPerPx:a,renderArgs:o,canvasWidth:s}){const{regionSequence:c}=o,{feature:l,topPx:f,heightPx:h}=t;if(!c)throw new Error("region sequence required for methylation");if(!l.get("seq"))return;const p=l.get("start"),u=l.get("end"),{methBins:x,methProbs:b}=(0,g.getMethBins)(l);function m(e){if(x[e]){const t=b[e]||0;return(t>.5?(0,d.M)("red").alpha(2*(t-.5)):(0,d.M)("blue").alpha(1-2*t)).toHslString()}}for(let t=0;t<u-p;t++){const o=t+p,l=c[o-r.start+1]?.toLowerCase(),g=c[o-r.start+2]?.toLowerCase();if("c"===l&&"g"===g)if(a>2){const[c,l]=(0,n.bpSpanPx)(o,o+2,r,a);i(e,c,f,l-c+.5,h,s,m(t)||m(t+1)||"blue")}else{const[c,l]=(0,n.bpSpanPx)(o,o+1,r,a);i(e,c,f,l-c+.5,h,s,m(t)||"blue");const[g,d]=(0,n.bpSpanPx)(o+1,o+2,r,a);i(e,g,f,d-g+.5,h,s,m(t+1)||"blue")}}}({ctx:e,feat:t,region:M,bpPerPx:x,renderArgs:r,canvasWidth:p})}}function u({ctx:e,feat:t,renderArgs:r,minSubfeatureWidth:a,largeInsertionIndicatorScale:o,mismatchAlpha:s,charWidth:c,charHeight:l,colorForBase:f,contrastForBase:h,canvasWidth:g,drawSNPsMuted:p,drawIndels:u=!0}){const{bpPerPx:x,regions:b}=r,{heightPx:m,topPx:P,feature:_}=t,S=b[0],T=_.get("start"),M=Math.min(1/x,2),y=_.get("mismatches"),v=l-2,C=S.reversed?1/x+1:-1;if(y){for(const t of y){const r=T+t.start,o=t.length,l=t.base,[b,_]=(0,n.bpSpanPx)(r,r+o,S,x),y=Math.max(a,Math.abs(b-_));if("mismatch"===t.type){if(!p){const r=f[t.base]||"#888",a=s?void 0===t.qual?r:(0,d.M)(r).alpha(Math.min(1,t.qual/50)).toHslString():r;i(e,Math.round(b),P,y,m,g,a)}if(y>=c&&m>=v){const r=p?"black":h[t.base]||"black";e.fillStyle=s?void 0===t.qual?r:(0,d.M)(r).alpha(Math.min(1,t.qual/50)).toHslString():r,e.fillText(l,b+(y-c)/2+1,P+m)}}else if("deletion"===t.type&&u){i(e,b,P,Math.abs(b-_),m,g,f.deletion);const r=`${t.length}`,a=(0,n.measureText)(r,10);y>=a&&m>=v&&(e.fillStyle=h.deletion,e.fillText(r,(b+_)/2-a/2,P+m))}else if("insertion"===t.type&&u){e.fillStyle="purple";const r=b+C,a=+t.base||t.length,o=Math.max(0,Math.min(1.2,1/x));if(a<10&&(i(e,r,P,o,m,g,"purple"),1/x>=c&&m>=v)){const a=r-o;i(e,a,P,3*o,1,g),i(e,a,P+m-1,3*o,1,g),e.fillText(`(${t.base})`,r+3,P+m)}}else if("hardclip"===t.type||"softclip"===t.type){const r=b+C,o="hardclip"===t.type?"red":"blue",n=Math.max(a,M);if(i(e,r,P,n,m,g,o),1/x>=c&&m>=v){const a=r-n;i(e,a,P,3*n,1,g),i(e,a,P+m-1,3*n,1,g),e.fillText(`(${t.base})`,r+3,P+m)}}else if("skip"===t.type&&b+y>0){const t=y-(x>10?1.5:0);e.clearRect(b,P,t,m),i(e,Math.max(0,b),P+m/2-1,t+(b<0?b:0),2,g,"#333")}}if(u)for(const t of y){const r=T+t.start,a=t.length,[s]=(0,n.bpSpanPx)(r,r+a,S,x),c=+t.base||t.length,f=`${c}`;if("insertion"===t.type&&c>=10)if(x>o)i(e,s-1,P,2,m,g,"purple");else if(m>l){const t=(0,n.measureText)(f),r=5;i(e,s-t/2-r,P,t+2*r,m,g,"purple"),e.fillStyle="white",e.fillText(f,s-t/2,P+m)}else{const t=2;i(e,s-t,P,2*t,m,g,"purple")}}}}function x({ctx:e,feat:t,renderArgs:r,config:o,theme:s,colorForBase:l,canvasWidth:f}){const{feature:h,topPx:d,heightPx:p}=t,{regions:u,bpPerPx:x}=r,b=u[0],m=(0,a.readConfObject)(o,"minSubfeatureWidth"),P=h.get("mismatches"),_=h.get("seq"),{charWidth:S,charHeight:T}=c();if(!_||!P)return;const M=T-2,y=(0,g.parseCigar)(h.get("CIGAR"));let v=0,C=0;for(let t=0;t<y.length;t+=2){const r=y[t+1],a=+y[t];if("S"===r){for(let r=0;r<a;r++){const o=_[v+r],c=h.get("start")-(0===t?a:0)+C+r,[g,u]=(0,n.bpSpanPx)(c,c+1,b,x),P=Math.max(m,u-g),T=l[o]||"#000000";e.fillStyle=T,i(e,g,d,P,p,f),P>=S&&p>=M&&(e.fillStyle=s.palette.getContrastText(T),e.fillText(o,g+(P-S)/2+1,d+p))}v+=a}"N"===r&&(C+=a),"M"!==r&&"="!==r&&"X"!==r||(C+=a,v+=a),"D"===r&&(C+=a),"I"===r&&(v+=a)}}function b({ctx:e,layoutRecords:t,canvasWidth:r,renderArgs:n}){const{config:i,showSoftClip:l,colorBy:f,theme:h}=n,g=(0,a.readConfObject)(i,"mismatchAlpha"),d=(0,a.readConfObject)(i,"minSubfeatureWidth"),b=(0,a.readConfObject)(i,"largeInsertionIndicatorScale"),m="#f0f"===(0,a.readConfObject)(i,"color"),P=(0,o.createJBrowseTheme)(h),_=s(P),S=function(e){return Object.fromEntries(Object.entries(s(e)).map((([t,r])=>[t,e.palette.getContrastText(r)])))}(P);e.font="bold 10px Courier New,monospace";const{charWidth:T,charHeight:M}=c(),y=(v=f?.type,["methylation","modifications"].includes(v||""));var v;for(const a of t)p({ctx:e,feat:a,renderArgs:n,defaultColor:m,colorForBase:_,contrastForBase:S,charWidth:T,charHeight:M,canvasWidth:r}),u({ctx:e,feat:a,renderArgs:n,mismatchAlpha:g,drawSNPsMuted:y,drawIndels:!0,largeInsertionIndicatorScale:b,minSubfeatureWidth:d,charWidth:T,charHeight:M,colorForBase:_,contrastForBase:S,canvasWidth:r}),l&&x({ctx:e,feat:a,renderArgs:n,colorForBase:_,config:i,theme:P,canvasWidth:r})}}}]);
//# sourceMappingURL=4060.8757dbe8.chunk.js.map