jbrowse-plugin-graphgenomeviewer 6.26.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddTrackWorkflow-ELAP73WV.js → AddTrackWorkflow-Q6RY23LF.js} +2 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-4EMCRZFD.js +2 -0
- package/dist/chunks/GbzBaseSyntenyAdapter-4EMCRZFD.js.map +7 -0
- package/dist/chunks/{GraphGenomeView-3ZJSM36D.js → GraphGenomeView-Q3ZQDV5H.js} +2 -2
- package/dist/chunks/{GraphGenomeView-3ZJSM36D.js.map → GraphGenomeView-Q3ZQDV5H.js.map} +1 -1
- package/dist/chunks/GraphTrackSettingsDialog-EQ5W5KTL.js +6 -0
- package/dist/chunks/GraphTrackSettingsDialog-EQ5W5KTL.js.map +7 -0
- package/dist/chunks/{HighlightColorDialog-H6AGVINB.js → HighlightColorDialog-3BONNNBR.js} +2 -2
- package/dist/chunks/LinearGraphDisplay-M6ITGK2E.js +2 -0
- package/dist/chunks/{LinearGraphDisplay-RTMEWTK4.js.map → LinearGraphDisplay-M6ITGK2E.js.map} +3 -3
- package/dist/chunks/MinigraphBubbleAdapter-DZJIN4J2.js +2 -0
- package/dist/chunks/MinigraphBubbleAdapter-DZJIN4J2.js.map +7 -0
- package/dist/chunks/RgfaTabixAdapter-IZMJCSYQ.js +3 -0
- package/dist/chunks/RgfaTabixAdapter-IZMJCSYQ.js.map +7 -0
- package/dist/chunks/WalkTabixSyntenyAdapter-H5NDC7U5.js +2 -0
- package/dist/chunks/WalkTabixSyntenyAdapter-H5NDC7U5.js.map +7 -0
- package/dist/chunks/{bandage-layout-3AR6BCUD-SOXMX65M.js → bandage-layout-3AR6BCUD-OCBA5MS7.js} +1 -1
- package/dist/chunks/{bandage-layout-3AR6BCUD-SOXMX65M.js.map → bandage-layout-3AR6BCUD-OCBA5MS7.js.map} +1 -1
- package/dist/chunks/chunk-2APZWSYD.js +3 -0
- package/dist/chunks/chunk-2APZWSYD.js.map +7 -0
- package/dist/chunks/chunk-4O7LDKI5.js +3 -0
- package/dist/chunks/chunk-4O7LDKI5.js.map +7 -0
- package/dist/chunks/{chunk-C4ORW22P.js → chunk-56V22DVI.js} +1 -1
- package/dist/chunks/{chunk-C4ORW22P.js.map → chunk-56V22DVI.js.map} +1 -1
- package/dist/chunks/chunk-5OI6LO4I.js +2 -0
- package/dist/chunks/chunk-5OI6LO4I.js.map +7 -0
- package/dist/chunks/chunk-5Q2F5SF4.js +4 -0
- package/dist/chunks/chunk-5Q2F5SF4.js.map +7 -0
- package/dist/chunks/chunk-CH2E7TRS.js +2 -0
- package/dist/chunks/chunk-CH2E7TRS.js.map +7 -0
- package/dist/chunks/chunk-CRL7N4KQ.js +2 -0
- package/dist/chunks/chunk-CRL7N4KQ.js.map +7 -0
- package/dist/chunks/chunk-E2QPSDQL.js +2 -0
- package/dist/chunks/chunk-E2QPSDQL.js.map +7 -0
- package/dist/chunks/chunk-ECZOKJYP.js +2 -0
- package/dist/chunks/chunk-ECZOKJYP.js.map +7 -0
- package/dist/chunks/chunk-EHCF6AXH.js +2 -0
- package/dist/chunks/chunk-EHCF6AXH.js.map +7 -0
- package/dist/chunks/{chunk-5JKSYSN5.js → chunk-G73A6PEI.js} +2 -2
- package/dist/chunks/{chunk-5JKSYSN5.js.map → chunk-G73A6PEI.js.map} +1 -1
- package/dist/chunks/chunk-GHL7VXRC.js +2 -0
- package/dist/chunks/chunk-GHL7VXRC.js.map +7 -0
- package/dist/chunks/{chunk-VAATBXRG.js → chunk-HW4LIGPA.js} +1 -1
- package/dist/chunks/{chunk-VAATBXRG.js.map → chunk-HW4LIGPA.js.map} +1 -1
- package/dist/chunks/chunk-IXQK7JAW.js +2 -0
- package/dist/chunks/chunk-IXQK7JAW.js.map +7 -0
- package/dist/chunks/chunk-KOB7YIMR.js +2 -0
- package/dist/chunks/chunk-KOB7YIMR.js.map +7 -0
- package/dist/chunks/chunk-LUTMKRXY.js +2 -0
- package/dist/chunks/chunk-LUTMKRXY.js.map +7 -0
- package/dist/chunks/chunk-MVVXRZXV.js +2 -0
- package/dist/chunks/chunk-MVVXRZXV.js.map +7 -0
- package/dist/chunks/{chunk-KFP5PZRE.js → chunk-OUN4BNWJ.js} +1 -1
- package/dist/chunks/{chunk-KFP5PZRE.js.map → chunk-OUN4BNWJ.js.map} +1 -1
- package/dist/chunks/chunk-RKOQVSZG.js +4 -0
- package/dist/chunks/{chunk-LCODIX3W.js.map → chunk-RKOQVSZG.js.map} +3 -3
- package/dist/chunks/{chunk-EHGTBGBO.js → chunk-TOT4S3TG.js} +1 -1
- package/dist/chunks/{chunk-EHGTBGBO.js.map → chunk-TOT4S3TG.js.map} +1 -1
- package/dist/chunks/chunk-TXI43PEN.js +2 -0
- package/dist/chunks/chunk-TXI43PEN.js.map +7 -0
- package/dist/chunks/chunk-WO5OWZPP.js +9 -0
- package/dist/chunks/chunk-WO5OWZPP.js.map +7 -0
- package/dist/chunks/chunk-WRH2EJKX.js +2 -0
- package/dist/chunks/chunk-WRH2EJKX.js.map +7 -0
- package/dist/chunks/{chunk-GTESIJZQ.js → chunk-XJDTSPBL.js} +2 -2
- package/dist/chunks/{chunk-GTESIJZQ.js.map → chunk-XJDTSPBL.js.map} +1 -1
- package/dist/chunks/chunk-Z4B6RZGP.js +2 -0
- package/dist/chunks/{chunk-BQQTY3GZ.js.map → chunk-Z4B6RZGP.js.map} +3 -3
- package/dist/chunks/chunk-ZWMYT35X.js +2 -0
- package/dist/chunks/chunk-ZWMYT35X.js.map +7 -0
- package/dist/chunks/renderSvg-QLUKGVIN.js +2 -0
- package/dist/chunks/renderSvg-QLUKGVIN.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +4 -4
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +7 -9
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.test.ts +35 -35
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts +24 -36
- package/src/GbzBaseSyntenyAdapter/companion.test.ts +8 -4
- package/src/GbzBaseSyntenyAdapter/configSchema.ts +2 -17
- package/src/GetGraphReads.ts +3 -11
- package/src/GetSubgraph.test.ts +30 -48
- package/src/GraphAddTrackWorkflow/buildTrackConfig.ts +6 -3
- package/src/GraphAddTrackWorkflow/graphManifest.ts +9 -5
- package/src/GraphGenomeView/components/FacetPanels.tsx +24 -1
- package/src/GraphGenomeView/components/GraphCanvas.tsx +18 -12
- package/src/GraphGenomeView/components/GraphSettingsDialog.test.tsx +36 -0
- package/src/GraphGenomeView/components/GraphSettingsDialog.tsx +12 -10
- package/src/GraphGenomeView/components/LabelChip.tsx +28 -6
- package/src/GraphGenomeView/components/LabelLayer.tsx +28 -4
- package/src/GraphGenomeView/components/PaneSvg.tsx +11 -0
- package/src/GraphGenomeView/components/ReferenceStripOverlay.tsx +1 -1
- package/src/GraphGenomeView/components/WalkRowsOverlay.tsx +68 -77
- package/src/GraphGenomeView/components/WalkStrip.test.tsx +44 -0
- package/src/GraphGenomeView/components/WalkStrip.tsx +47 -40
- package/src/GraphGenomeView/components/usePaneGestures.test.tsx +78 -0
- package/src/GraphGenomeView/components/usePaneGestures.ts +16 -2
- package/src/GraphGenomeView/genes/geneFeatures.ts +12 -5
- package/src/GraphGenomeView/genes/genes.test.ts +14 -0
- package/src/GraphGenomeView/index.ts +2 -19
- package/src/GraphGenomeView/legendSections.ts +17 -6
- package/src/GraphGenomeView/model.test.ts +132 -25
- package/src/GraphGenomeView/pane/fitViews.ts +16 -13
- package/src/GraphGenomeView/pane/graphViews.ts +7 -12
- package/src/GraphGenomeView/pane/hostViews.ts +14 -15
- package/src/GraphGenomeView/pane/launchActions.ts +2 -3
- package/src/GraphGenomeView/pane/launchViews.ts +23 -22
- package/src/GraphGenomeView/pane/loadActions.ts +93 -76
- package/src/GraphGenomeView/pane/paneBase.ts +3 -2
- package/src/GraphGenomeView/pane/renderingActions.ts +9 -5
- package/src/GraphGenomeView/pane/settingActions.ts +22 -15
- package/src/GraphGenomeView/renderPipeline.test.ts +5 -1
- package/src/GraphGenomeView/repeats/repeatFeatures.ts +1 -1
- package/src/GraphGenomeView/subgraphLoad.test.ts +34 -5
- package/src/LaunchGraphGenomeView.ts +2 -18
- package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +90 -14
- package/src/LinearGraphDisplay/components/GraphStatusChrome.test.tsx +5 -0
- package/src/LinearGraphDisplay/components/GraphStatusChrome.tsx +9 -11
- package/src/LinearGraphDisplay/components/SubgraphContextSelect.test.tsx +27 -0
- package/src/LinearGraphDisplay/components/SubgraphContextSelect.tsx +6 -2
- package/src/LinearGraphDisplay/components/SubgraphHaplotypesField.test.tsx +1 -1
- package/src/LinearGraphDisplay/components/SubgraphHaplotypesField.tsx +5 -5
- package/src/LinearGraphDisplay/model.ts +17 -11
- package/src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.test.ts +18 -0
- package/src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.ts +2 -1
- package/src/MinigraphBubbleAdapter/configSchema.ts +7 -25
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.test.ts +37 -18
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.ts +72 -48
- package/src/RgfaTabixAdapter/bubbleTier.test.ts +19 -4
- package/src/RgfaTabixAdapter/configSchema.ts +24 -65
- package/src/RgfaTabixAdapter/test_data/walks1_header.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks1_header.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_follow.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_follow.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_header.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_header.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_maxnode.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_maxnode.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_rejoin.GRCh38.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks2_rejoin.GRCh38.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/walkFiles.test.ts +96 -242
- package/src/RgfaTabixAdapter/walkReader.ts +31 -213
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.test.ts +4 -8
- package/src/WalkTabixSyntenyAdapter/WalkTabixSyntenyAdapter.ts +18 -40
- package/src/WalkTabixSyntenyAdapter/configSchema.ts +16 -76
- package/src/WalkTabixSyntenyAdapter/gbzParity.test.ts +4 -7
- package/src/WalkTabixSyntenyAdapter/walkLanes.ts +1 -1
- package/src/graphTrackConfig.ts +3 -3
- package/src/launchFromGraph/contributors.test.ts +9 -3
- package/src/launchFromGraph/launchFromGraph.test.ts +2 -0
- package/src/launchFromGraph/launchFromGraph.ts +21 -16
- package/src/launchFromGraph/launchTracks.ts +4 -11
- package/src/launchFromGraph/syntenyTracks.ts +4 -11
- package/src/locationName.ts +21 -0
- package/src/panSNAliases/panSNAliases.test.ts +93 -88
- package/src/panSNAliases/trackAdapterConfig.ts +8 -2
- package/src/panSNTabix.ts +32 -0
- package/src/synteny/ComparativeAdapterBase.ts +4 -3
- package/src/synteny/lanePairs.ts +15 -0
- package/src/{RgfaTabixAdapter/tabixRange.ts → tabixRange.ts} +4 -1
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-KTZMVVMW.js +0 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-KTZMVVMW.js.map +0 -7
- package/dist/chunks/GraphTrackSettingsDialog-JHKKV2S4.js +0 -6
- package/dist/chunks/GraphTrackSettingsDialog-JHKKV2S4.js.map +0 -7
- package/dist/chunks/LinearGraphDisplay-RTMEWTK4.js +0 -2
- package/dist/chunks/MinigraphBubbleAdapter-FKDOLLD3.js +0 -2
- package/dist/chunks/MinigraphBubbleAdapter-FKDOLLD3.js.map +0 -7
- package/dist/chunks/RgfaTabixAdapter-SMDO5VX7.js +0 -3
- package/dist/chunks/RgfaTabixAdapter-SMDO5VX7.js.map +0 -7
- package/dist/chunks/WalkTabixSyntenyAdapter-L2E7QSX2.js +0 -2
- package/dist/chunks/WalkTabixSyntenyAdapter-L2E7QSX2.js.map +0 -7
- package/dist/chunks/chunk-2I4VPDLZ.js +0 -2
- package/dist/chunks/chunk-2I4VPDLZ.js.map +0 -7
- package/dist/chunks/chunk-3GI2K2L7.js +0 -9
- package/dist/chunks/chunk-3GI2K2L7.js.map +0 -7
- package/dist/chunks/chunk-4II37RC7.js +0 -2
- package/dist/chunks/chunk-4II37RC7.js.map +0 -7
- package/dist/chunks/chunk-6NKKRJ2C.js +0 -3
- package/dist/chunks/chunk-6NKKRJ2C.js.map +0 -7
- package/dist/chunks/chunk-AHEG3FOH.js +0 -2
- package/dist/chunks/chunk-AHEG3FOH.js.map +0 -7
- package/dist/chunks/chunk-BQQTY3GZ.js +0 -2
- package/dist/chunks/chunk-EAZJJZAY.js +0 -2
- package/dist/chunks/chunk-EAZJJZAY.js.map +0 -7
- package/dist/chunks/chunk-HHADQLAY.js +0 -2
- package/dist/chunks/chunk-HHADQLAY.js.map +0 -7
- package/dist/chunks/chunk-LCODIX3W.js +0 -4
- package/dist/chunks/chunk-N6PJ3YND.js +0 -3
- package/dist/chunks/chunk-N6PJ3YND.js.map +0 -7
- package/dist/chunks/chunk-OTU3GXFO.js +0 -2
- package/dist/chunks/chunk-OTU3GXFO.js.map +0 -7
- package/dist/chunks/chunk-R3TRNF7N.js +0 -2
- package/dist/chunks/chunk-R3TRNF7N.js.map +0 -7
- package/dist/chunks/chunk-TH3R5SGF.js +0 -2
- package/dist/chunks/chunk-TH3R5SGF.js.map +0 -7
- package/dist/chunks/chunk-Z35N4ZAV.js +0 -4
- package/dist/chunks/chunk-Z35N4ZAV.js.map +0 -7
- package/dist/chunks/renderSvg-MS35CDL4.js +0 -2
- package/dist/chunks/renderSvg-MS35CDL4.js.map +0 -7
- package/src/RgfaTabixAdapter/test_data/walks_follow.links.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_follow.links.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_follow.nodes.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_follow.nodes.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_follow.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_follow.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_header.links.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_header.links.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_header.nodes.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_header.nodes.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_header.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_header.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_maxnode.links.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_maxnode.links.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_maxnode.nodes.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_maxnode.nodes.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_maxnode.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_maxnode.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_rejoin.links.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_rejoin.links.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_rejoin.nodes.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_rejoin.nodes.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_rejoin.walks.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/walks_rejoin.walks.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/walkRows.test.ts +0 -446
- package/src/RgfaTabixAdapter/walkRows.ts +0 -699
- /package/dist/chunks/{AddTrackWorkflow-ELAP73WV.js.map → AddTrackWorkflow-Q6RY23LF.js.map} +0 -0
- /package/dist/chunks/{HighlightColorDialog-H6AGVINB.js.map → HighlightColorDialog-3BONNNBR.js.map} +0 -0
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as He}from"./chunk-HHADQLAY.js";import{a as Ye,c as $e}from"./chunk-TENPGIPX.js";function ze(e){let t=[],r=0,o;for(let n=0,i=e.length;n<i;n++){let a=e.charCodeAt(n);if(a>=48&&a<=57)r=r*10+a-48;else if(a===58)o=r,r=0;else{let s=e[n];s==="M"||s==="="||s==="X"?t.push({own:o===void 0?r:o,mate:r,op:"M"}):s==="I"?t.push({own:0,mate:r,op:s}):(s==="D"||s==="N")&&t.push({own:r,mate:0,op:s}),o=void 0,r=0}}return t}function Ae(e){let t="";for(let{own:r,mate:o,op:n}of ze(e))t+=n==="M"?r===0?`${o}I`:o===0?`${r}D`:`${r}M`:`${n==="I"?o:r}${n}`;return t}var ve=2**28-1;function Se(e,t,r){for(let o=t;o>0;o-=ve)e.push((Math.min(o,ve)<<4|r)>>>0)}function Pr(e,t,r){if(t===r)Se(e,t,0);else{let o=Math.ceil(Math.max(t,r)/ve);for(let n=0;n<o;n++){let i=Math.floor(t*(n+1)/o)-Math.floor(t*n/o),a=Math.floor(r*(n+1)/o)-Math.floor(r*n/o);e.push((i<<4|9)>>>0,(a<<4|9)>>>0)}}}function _e(e){let t=[];for(let{own:r,mate:o,op:n}of ze(e))n==="M"?Pr(t,r,o):n==="I"?Se(t,o,1):Se(t,r,n==="N"?3:2);return Uint32Array.from(t)}function Nr(e){return e>=48&&e<=57}function kr(e){return e!==void 0&&/[A-Za-z]/.test(e)}function Ve(e,t){let r=t;for(;r<e.length&&kr(e[r]);)r++;return r}function qe(e,t){let r=t,o=0;for(;r<e.length&&Nr(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r++;return{value:o,next:r}}function Ze(e,t){let r=0;for(;r<e.length;){let o=e[r];if(o===":"){let{value:n,next:i}=qe(e,r+1);t(":",n,n,r+1,i),r=i}else if(o==="="){let n=Ve(e,r+1),i=n-r-1;t("=",i,i,r+1,n),r=n}else if(o==="*")t("*",1,1,r+1,Math.min(r+3,e.length)),r+=3;else if(o==="+"||o==="-"){let n=Ve(e,r+1),i=n-r-1;t(o,o==="-"?i:0,o==="+"?i:0,r+1,n),r=n}else if(o==="~"){let{value:n,next:i}=qe(e,r+3),a=Math.min(i+2,e.length);t("~",n,0,r+1,a),r=a}else r++}}function Ce(e,t,r,o){let n=r??Number.NEGATIVE_INFINITY,i=o??Number.POSITIVE_INFINITY,a=0;Ze(e,(s,p,f,c,u)=>{if(s==="*")a>=n&&a<i&&t(88,a,1,e[c+1]??"",-1,0,0);else if(s==="+"){if(a>=n&&a<=i){let m=e.slice(c,u);t(73,a,f,m,-1,0,f)}}else(s==="-"||s==="~")&&a<i&&a+p>n&&t(s==="-"?68:78,a,p,"",-1,0,0);a+=p})}function er(e,t,r,o){let n=0,i=0,a=[],s=r&&t;for(let p=0,f=e.length;p<f;p++){let c=e[p],u=c>>>4,m=c&15;if(m===0||m===7){if(s)for(let l=0;l<u;l++)(t.charCodeAt(i+l)|32)!==(r.charCodeAt(n+l)|32)&&a.push({start:n+l,type:"mismatch",base:t[i+l],altbase:r[n+l],length:1});i+=u,n+=u}else if(m===1)a.push({start:n,type:"insertion",insertlen:u,insertedBases:t?.slice(i,i+u),length:0}),i+=u;else if(m===2)a.push({start:n,type:"deletion",length:u}),n+=u;else if(m===3)a.push({start:n,type:"skip",length:u}),n+=u;else if(m===8){for(let l=0;l<u;l++)a.push({start:n+l,type:"mismatch",base:t?.[i+l]||"X",qual:o?.[i+l],length:1});i+=u,n+=u}else m===5?a.push({start:n,type:"hardclip",cliplen:u,length:1}):m===4&&(a.push({start:n,type:"softclip",cliplen:u,length:1}),i+=u)}return a}function rr(e,t,r,o,n){if(!t)return[];let i=[],a=t.length,s=o.length,p=n!==void 0,f=r.length,c=!1;for(let b=0;b<f;b++)if(r[b].type==="skip"){c=!0;break}let u=0,m=0,l=0,y=0,d=0,x=0,g=e.length;for(;x<g;){let b=e.charCodeAt(x);if(b>=48&&b<=57){let S=0;for(;x<g;){let v=e.charCodeAt(x);if(v>=48&&v<=57)S=S*10+(v-48),x++;else break}u+=S}else if(b===94)for(x++;x<g&&e.charCodeAt(x)>=65;)x++,u++;else if(b>=65){let S=e[x];if(x++,c&&f>0)for(let I=d;I<f;I++){let R=r[I];R.type==="skip"&&u>=R.start&&(u+=R.length,d=I+1)}let v=l,C=y;for(let I=m;I<a&&C<=u;I++,m=I){let R=t[I],L=R>>>4,A=R&15;A===4||A===1?v+=L:A===2||A===6||A===3?C+=L:A!==5&&(v+=L,C+=L)}l=v,y=C;let F=v-(C-u),q=F<s?o[F]:"X";i.push({start:u,base:q,qual:p?n[F]:void 0,altbase:S,length:1,type:"mismatch"}),u++}else x++}return i}var tr={77:0,73:1,68:2,78:3,83:4,72:5,80:6,61:7,88:8};function or(e=""){let t=0,r=[];for(let o=0,n=e.length;o<n;o++){let i=e.charCodeAt(o);if(i>=48&&i<=57)t=t*10+(i-48);else{let a=tr[i];r.push(t<<4|a),t=0}}return r}function Te(e=""){let t=0;for(let i=0,a=e.length;i<a;i++){let s=e.charCodeAt(i);(s<48||s>57)&&t++}let r=new Uint32Array(t),o=0,n=0;for(let i=0,a=e.length;i<a;i++){let s=e.charCodeAt(i);s>=48&&s<=57?o=o*10+(s-48):(r[n++]=o<<4|tr[s],o=0)}return r}function Z(e,t,r,o,n){let i=or(e),a=e?er(i,r,o,n):[];return t&&r?a.concat(rr(t,i,a,r,n)):a}var $=class extends Ye{get(t){return t==="mismatches"?Z(this.walkableCigar):t==="clipLengthAtStartOfRead"?this.clipLengthAtStartOfRead:t==="name"?super.get("name")??this.mate?.refName:super.get(t)}get mate(){return super.get("mate")}get walkableCigar(){let t=super.get("CIGAR"),r=super.get("coarseCigar");return typeof t=="string"?t:typeof r=="string"?Ae(r):void 0}get clipLengthAtStartOfRead(){return this.mate?.start??0}forEachMismatch(t,r){let o=this.get("start"),n=r?.start===void 0?void 0:r.start-o,i=r?.end===void 0?void 0:r.end-o,a=this.get("cs");if(a)Ce(a,t,n,i);else{let s=n??Number.NEGATIVE_INFINITY,p=i??Number.POSITIVE_INFINITY;for(let f of Z(this.walkableCigar))(f.type==="deletion"||f.type==="skip"?f.start<p&&f.start+f.length>s:f.start>=s&&f.start<=p)&&(f.type==="mismatch"?t(88,f.start,f.length,f.base,f.qual??-1,0,0):f.type==="insertion"?t(73,f.start,f.length,f.insertedBases??"",-1,0,f.insertlen):f.type==="deletion"?t(68,f.start,f.length,"",-1,0,0):f.type==="skip"&&t(78,f.start,f.length,"",-1,0,0))}}};var we=function(e,t){return we=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r[n]=o[n])},we(e,t)};function H(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");we(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function nr(e,t,r,o){function n(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{f(o.next(c))}catch(u){a(u)}}function p(c){try{f(o.throw(c))}catch(u){a(u)}}function f(c){c.done?i(c.value):n(c.value).then(s,p)}f((o=o.apply(e,t||[])).next())})}function ee(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(f){return function(c){return p([f,c])}}function p(f){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,f[0]&&(r=0)),r;)try{if(o=1,n&&(i=f[0]&2?n.return:f[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,f[1])).done)return i;switch(n=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(c){f=[6,c],n=0}finally{o=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function P(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function G(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}function N(e){return this instanceof N?(this.v=e,this):new N(e)}function ir(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=r.apply(e,t||[]),n,i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(l){return function(y){return Promise.resolve(y).then(l,u)}}function s(l,y){o[l]&&(n[l]=function(d){return new Promise(function(x,g){i.push([l,d,x,g])>1||p(l,d)})},y&&(n[l]=y(n[l])))}function p(l,y){try{f(o[l](y))}catch(d){m(i[0][3],d)}}function f(l){l.value instanceof N?Promise.resolve(l.value.v).then(c,u):m(i[0][2],l)}function c(l){p("next",l)}function u(l){p("throw",l)}function m(l,y){l(y),i.shift(),i.length&&p(i[0][0],i[0][1])}}function ar(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof P=="function"?P(e):e[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(i){r[i]=e[i]&&function(a){return new Promise(function(s,p){a=e[i](a),n(s,p,a.done,a.value)})}}function n(i,a,s,p){Promise.resolve(p).then(function(f){i({value:f,done:s})},a)}}function h(e){return typeof e=="function"}function fr(e){var t=function(o){Error.call(o),o.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var re=fr(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
2
|
-
`+r.map(function(o,n){return n+1+") "+o.toString()}).join(`
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function Oe(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var te=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,o,n,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=P(a),p=s.next();!p.done;p=s.next()){var f=p.value;f.remove(this)}}catch(d){t={error:d}}finally{try{p&&!p.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var c=this.initialTeardown;if(h(c))try{c()}catch(d){i=d instanceof re?d.errors:[d]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var m=P(u),l=m.next();!l.done;l=m.next()){var y=l.value;try{sr(y)}catch(d){i=i??[],d instanceof re?i=D(D([],G(i)),G(d.errors)):i.push(d)}}}catch(d){o={error:d}}finally{try{l&&!l.done&&(n=m.return)&&n.call(m)}finally{if(o)throw o.error}}}if(i)throw new re(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)sr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Oe(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Oe(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var Qt=te.EMPTY;function oe(e){return e instanceof te||e&&"closed"in e&&h(e.remove)&&h(e.add)&&h(e.unsubscribe)}function sr(e){h(e)?e():e.unsubscribe()}var w={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var j={setTimeout:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var n=j.delegate;return n?.setTimeout?n.setTimeout.apply(n,D([e,t],G(r))):setTimeout.apply(void 0,D([e,t],G(r)))},clearTimeout:function(e){var t=j.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ne(e){j.setTimeout(function(){var t=w.onUnhandledError;if(t)t(e);else throw e})}function Re(){}var pr=(function(){return Me("C",void 0,void 0)})();function cr(e){return Me("E",void 0,e)}function ur(e){return Me("N",e,void 0)}function Me(e,t,r){return{kind:e,value:t,error:r}}var k=null;function lr(e){if(w.useDeprecatedSynchronousErrorHandling){var t=!k;if(t&&(k={errorThrown:!1,error:null}),e(),t){var r=k,o=r.errorThrown,n=r.error;if(k=null,o)throw n}}else e()}function mr(e){w.useDeprecatedSynchronousErrorHandling&&k&&(k.errorThrown=!0,k.error=e)}var z=(function(e){H(t,e);function t(r){var o=e.call(this)||this;return o.isStopped=!1,r?(o.destination=r,oe(r)&&r.add(o)):o.destination=Wr,o}return t.create=function(r,o,n){return new ae(r,o,n)},t.prototype.next=function(r){this.isStopped?Le(ur(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Le(cr(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Le(pr,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(te);var jr=Function.prototype.bind;function Fe(e,t){return jr.call(e,t)}var Ur=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(o){ie(o)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(o){ie(o)}else ie(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){ie(r)}},e})(),ae=(function(e){H(t,e);function t(r,o,n){var i=e.call(this)||this,a;if(h(r)||!r)a={next:r??void 0,error:o??void 0,complete:n??void 0};else{var s;i&&w.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&Fe(r.next,s),error:r.error&&Fe(r.error,s),complete:r.complete&&Fe(r.complete,s)}):a=r}return i.destination=new Ur(a),i}return t})(z);function ie(e){w.useDeprecatedSynchronousErrorHandling?mr(e):ne(e)}function Br(e){throw e}function Le(e,t){var r=w.onStoppedNotification;r&&j.setTimeout(function(){return r(e,t)})}var Wr={closed:!0,next:Re,error:Br,complete:Re};var U=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function dr(e){return e}function xr(e){return e.length===0?dr:e.length===1?e[0]:function(r){return e.reduce(function(o,n){return n(o)},r)}}var _=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,o){var n=this,i=$r(t)?t:new ae(t,r,o);return lr(function(){var a=n,s=a.operator,p=a.source;i.add(s?s.call(i,p):p?n._subscribe(i):n._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var o=this;return r=hr(r),new r(function(n,i){var a=new ae({next:function(s){try{t(s)}catch(p){i(p),a.unsubscribe()}},error:i,complete:n});o.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[U]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return xr(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=hr(t),new t(function(o,n){var i;r.subscribe(function(a){return i=a},function(a){return n(a)},function(){return o(i)})})},e.create=function(t){return new e(t)},e})();function hr(e){var t;return(t=e??w.Promise)!==null&&t!==void 0?t:Promise}function Yr(e){return e&&h(e.next)&&h(e.error)&&h(e.complete)}function $r(e){return e&&e instanceof z||Yr(e)&&oe(e)}function Hr(e){return h(e?.lift)}function E(e){return function(t){if(Hr(t))return t.lift(function(r){try{return e(r,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function M(e,t,r,o,n){return new zr(e,t,r,o,n)}var zr=(function(e){H(t,e);function t(r,o,n,i,a,s){var p=e.call(this,r)||this;return p.onFinalize=a,p.shouldUnsubscribe=s,p._next=o?function(f){try{o(f)}catch(c){r.error(c)}}:e.prototype._next,p._error=i?function(f){try{i(f)}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._error,p._complete=n?function(){try{n()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,p}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(z);var fe=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function se(e){return h(e?.then)}function pe(e){return h(e[U])}function ce(e){return Symbol.asyncIterator&&h(e?.[Symbol.asyncIterator])}function ue(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Vr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var le=Vr();function me(e){return h(e?.[le])}function de(e){return ir(this,arguments,function(){var r,o,n,i;return ee(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,N(r.read())];case 3:return o=a.sent(),n=o.value,i=o.done,i?[4,N(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,N(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function xe(e){return h(e?.getReader)}function O(e){if(e instanceof _)return e;if(e!=null){if(pe(e))return qr(e);if(fe(e))return Qr(e);if(se(e))return Kr(e);if(ce(e))return yr(e);if(me(e))return Xr(e);if(xe(e))return Jr(e)}throw ue(e)}function qr(e){return new _(function(t){var r=e[U]();if(h(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Qr(e){return new _(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Kr(e){return new _(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,ne)})}function Xr(e){return new _(function(t){var r,o;try{for(var n=P(e),i=n.next();!i.done;i=n.next()){var a=i.value;if(t.next(a),t.closed)return}}catch(s){r={error:s}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}t.complete()})}function yr(e){return new _(function(t){Zr(e,t).catch(function(r){return t.error(r)})})}function Jr(e){return yr(de(e))}function Zr(e,t){var r,o,n,i;return nr(this,void 0,void 0,function(){var a,s;return ee(this,function(p){switch(p.label){case 0:p.trys.push([0,5,6,11]),r=ar(e),p.label=1;case 1:return[4,r.next()];case 2:if(o=p.sent(),!!o.done)return[3,4];if(a=o.value,t.next(a),t.closed)return[2];p.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=p.sent(),n={error:s},[3,11];case 6:return p.trys.push([6,,9,10]),o&&!o.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:p.sent(),p.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function T(e,t,r,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=t.schedule(function(){r(),n?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(i),!n)return i}function he(e,t){return t===void 0&&(t=0),E(function(r,o){r.subscribe(M(o,function(n){return T(o,e,function(){return o.next(n)},t)},function(){return T(o,e,function(){return o.complete()},t)},function(n){return T(o,e,function(){return o.error(n)},t)}))})}function ye(e,t){return t===void 0&&(t=0),E(function(r,o){o.add(e.schedule(function(){return r.subscribe(o)},t))})}function gr(e,t){return O(e).pipe(ye(t),he(t))}function br(e,t){return O(e).pipe(ye(t),he(t))}function vr(e,t){return new _(function(r){var o=0;return t.schedule(function(){o===e.length?r.complete():(r.next(e[o++]),r.closed||this.schedule())})})}function Sr(e,t){return new _(function(r){var o;return T(r,t,function(){o=e[le](),T(r,t,function(){var n,i,a;try{n=o.next(),i=n.value,a=n.done}catch(s){r.error(s);return}a?r.complete():r.next(i)},0,!0)}),function(){return h(o?.return)&&o.return()}})}function ge(e,t){if(!e)throw new Error("Iterable cannot be null");return new _(function(r){T(r,t,function(){var o=e[Symbol.asyncIterator]();T(r,t,function(){o.next().then(function(n){n.done?r.complete():r.next(n.value)})},0,!0)})})}function Ar(e,t){return ge(de(e),t)}function _r(e,t){if(e!=null){if(pe(e))return gr(e,t);if(fe(e))return vr(e,t);if(se(e))return br(e,t);if(ce(e))return ge(e,t);if(me(e))return Sr(e,t);if(xe(e))return Ar(e,t)}throw ue(e)}function Pe(e,t){return t?_r(e,t):O(e)}function V(e,t){return E(function(r,o){var n=0;r.subscribe(M(o,function(i){o.next(e.call(t,i,n++))}))})}function Cr(e,t,r,o,n,i,a,s){var p=[],f=0,c=0,u=!1,m=function(){u&&!p.length&&!f&&t.complete()},l=function(d){return f<o?y(d):p.push(d)},y=function(d){i&&t.next(d),f++;var x=!1;O(r(d,c++)).subscribe(M(t,function(g){n?.(g),i?l(g):t.next(g)},function(){x=!0},void 0,function(){if(x)try{f--;for(var g=function(){var b=p.shift();a?T(t,a,function(){return y(b)}):y(b)};p.length&&f<o;)g();m()}catch(b){t.error(b)}}))};return e.subscribe(M(t,l,function(){u=!0,m()})),function(){s?.()}}function B(e,t,r){return r===void 0&&(r=1/0),h(t)?B(function(o,n){return V(function(i,a){return t(o,i,n,a)})(O(e(o,n)))},r):(typeof t=="number"&&(r=t),E(function(o,n){return Cr(o,n,e,r)}))}function Ir(e,t,r,o,n){return function(i,a){var s=r,p=t,f=0;i.subscribe(M(a,function(c){var u=f++;p=s?e(p,c,u):(s=!0,c),o&&a.next(p)},n&&(function(){s&&a.next(p),a.complete()})))}}function Er(e,t){return E(Ir(e,t,arguments.length>=2,!1,!0))}var et=function(e,t){return e.push(t),e};function be(){return E(function(e,t){Er(et,[])(e).subscribe(t)})}var rt=397,tt=387,ot=385;function Tr(e){return(1<<e&rt)!==0}function wr(e){return(1<<e&tt)!==0}function Or(e){return(1<<e&ot)!==0}function Ne(e,t,r,o,n,i,a){let s=n===-1?-1:1,p=t,f=n===-1?o:r,c=[],u=1/0,m=-1/0,l=1/0,y=-1/0,d=(x,g)=>{l=Math.min(l,x,g),y=Math.max(y,x,g)};for(let x=0;x<e.length;x++){let g=e[x],b=g>>>4,S=g&15,v=S===9,C=v||Tr(S)?b:0,F=v?e[++x]>>>4:wr(S)?b:0,q=p+C,I=f+F*s,R=p,L=q;if(L>=i&&R<=a)if(C>0){let A=Math.max(R,i),W=Math.min(L,a);if(W>A)if(u=Math.min(u,A),m=Math.max(m,W),v){let je=F/b,Ue=W-A,Be=Math.round(Ue*je),We=Math.round(f+(A-p)*je*s);c.push(Ue<<4|9,Be<<4|9),d(We,We+Be*s)}else c.push(W-A<<4|S),Or(S)?d(f+(A-p)*s,f+(W-p)*s):d(f,f)}else F>0&&(v?c.push(g,e[x]):c.push(g),u=Math.min(u,p),m=Math.max(m,p),d(f,I));if(p=q,f=I,p>a)break}if(c.length!==0)return{start:u,end:m,mateStart:l,mateEnd:y,cigar:Uint32Array.from(c)}}function nt(e){return e===1||e===2||e===3}function ke(e,t,r,o,n,i){let a=n===-1?-1:1,s=[],p=t,f=n===-1?o:r,c,u=!1,m=()=>{c!==void 0&&u&&c.qHi>c.qLo&&s.push({start:c.qLo,end:c.qHi,mateStart:c.tLo,mateEnd:c.tHi,cigar:Uint32Array.from(c.ops)}),c=void 0,u=!1};for(let l=0;l<e.length;l++){let y=e[l],d=y>>>4,x=y&15,g=x===9,b=g?e[++l]:void 0,S=g||Tr(x)?d:0,v=b!==void 0?b>>>4:wr(x)?d:0,C=f+v*a;nt(x)&&d>=i?m():(S>0||v>0)&&(c===void 0&&(c={qLo:p,qHi:p,tLo:f,tHi:f,ops:[]}),c.qHi=p+S,c.tLo=Math.min(c.tLo,f,C),c.tHi=Math.max(c.tHi,f,C),c.ops.push(y),b!==void 0&&c.ops.push(b),u=u||g||Or(x)),p+=S,f=C}return m(),s}function Rr(e){let t=e.get("CIGAR");return typeof t=="string"?t:void 0}function Mr(e){let t=e.get("coarseCigar");return typeof t=="string"?t:void 0}function Ge(e){let t=Rr(e),r=t===void 0?Mr(e):void 0;return t!==void 0?Te(t):r!==void 0?_e(r):void 0}var it=["CIGAR","cs","coarseCigar","cg","cr"];function at(e){return typeof e=="object"&&e!==null&&"refName"in e&&"start"in e&&"end"in e&&typeof e.refName=="string"&&typeof e.start=="number"&&typeof e.end=="number"}function ft(e){let t=e.get("mate");return at(t)?t:void 0}function st(e,t,r,o){let n=Math.max(e.start,o.start),i=Math.min(e.end,o.end),a=(t.end-t.start)/Math.max(e.end-e.start,1),s=c=>r===-1?t.end-(c-e.start)*a:t.start+(c-e.start)*a,p=Math.round(s(n)),f=Math.round(s(i));return i>n?{start:n,end:i,mateStart:Math.min(p,f),mateEnd:Math.max(p,f)}:void 0}function pt(e,t,r,o,n){let i={start:e.get("start"),end:e.get("end")},a=e.get("strand")===-1?-1:1,s=i.start>=r.start&&i.end<=r.end,p=s&&o===void 0&&!n?void 0:Ge(e);if(p===void 0){let f=s?{...i,mateStart:t.start,mateEnd:t.end}:st(i,t,a,r);return f===void 0?[]:[f]}else return(o===void 0?[{...i,mateStart:t.start,mateEnd:t.end,cigar:p}]:ke(p,i.start,t.start,t.end,a,o)).flatMap(c=>{let u=Ne(c.cigar,c.start,c.mateStart,c.mateEnd,a,r.start,r.end);return u===void 0?[]:[u]})}function ct(e,t,r,o,n,i){let a=`:${o.start}-${o.end}${n}`,s=e.toJSON(),p={...s,uniqueId:`${e.id()}${a}`,start:r.start,end:r.end,mate:{...t,start:r.mateStart,end:r.mateEnd}};s.syntenyId!==void 0&&(p.syntenyId=`${String(s.syntenyId)}${a}`);for(let f of it)delete p[f];return i&&r.cigar&&(p.alignmentOps=r.cigar),new $(p)}function Fr(e,t,r,o=!1){let n=ft(e);if(n===void 0)return[e];{let i=pt(e,n,t,r,o);return i.map((a,s)=>ct(e,n,a,t,i.length>1?`/${s}`:"",o))}}var Lr=class extends He{constructor(){super(...arguments);this.recordsAreAlignments=!0}static{this.capabilities=["getFeatures","getRefNames"]}async hasDataForRefName(){return!0}getFeaturesInMultipleRegions(r,o={}){let{clipToRegion:n,splitAtGapBp:i,keepAlignment:a,...s}=o,p=n&&this.recordsAreAlignments,f=$e(s.statusCallback);return Pe(r).pipe(B((c,u)=>this.getFeatures(c,{...s,statusCallback:f()}).pipe(B(m=>p?Fr(m,m.get("assemblyName")===c.assemblyName?c:{start:m.get("start"),end:m.get("end")},i,a):[m]),be(),V(m=>({index:u,features:m})))),be(),B(c=>c.sort((u,m)=>u.index-m.index).flatMap(u=>u.features)))}};var De=class extends Error{constructor(r){super(`a pair query names both lanes: queryAssemblyName ${r} came without a targetAssemblyName`);this.name="PairTargetError"}};function Vi(e){let{lanePairs:t,queryAssemblyName:r,targetAssemblyName:o}=e;if(t?.length)return t;if(r===void 0)return[];if(o===void 0)throw new De(r);return[{queryAssemblyName:r,targetAssemblyName:o}]}export{$ as a,Lr as b,De as c,Vi as d};
|
|
4
|
-
//# sourceMappingURL=chunk-LCODIX3W.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{E as Q,F as ee,Ha as Oe,Ja as le,Ma as Ae,S as y,T as ne,W as F,Xa as pe,Y as A,Ya as ce,Z as re,_ as oe,a as $,ab as We,ca as ve,e as B,ea as Le,i as me,ia as Ee,j as ke,k as K,lb as Te,m as Re,na as ae,qa as _e,r as xe,s as Me,t as ye,ta as Ce,u as Pe,ua as se,x as Se,y as U,ya as ie}from"./chunk-4II37RC7.js";import{h as Y,j as Z,t as te}from"./chunk-GTESIJZQ.js";import{A as X,B as q,J,y as S}from"./chunk-5JKSYSN5.js";import{b as L,c as O}from"./chunk-EHGTBGBO.js";import{e as z}from"./chunk-NDRLCGPC.js";import{a as we,c as _,d as D,e as j,f as C}from"./chunk-6OPB7FOJ.js";import{a as ge,b as h,c as P,d as x}from"./chunk-JMBDTNUR.js";var Fe={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},Ve=x(function({model:e}){let{bubbleHalos:n,hoveredBubble:o}=e;if(n.length===0)return null;let{scaleX:r,scaleY:s,translateX:i,translateY:p,paneWidth:a,canvasHeight:u}=e,c=e.contigThickness*ve;return h("svg",{style:Fe,width:a,height:u,"data-testid":"graph-bubble-halos",children:h("g",{transform:`translate(${i} ${p}) scale(${r} ${s})`,children:n.filter(d=>!d.whole&&(!d.tick||o&&L(d.bubble,o))).map(d=>h("path",{d:d.path,fill:"none",stroke:y[d.kind],strokeOpacity:o&&L(d.bubble,o)?.45:e.bubbleFaded(d)?.06:.22,strokeWidth:c,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},O(d.bubble)))})})}),$t=Ve;var I=18,W=48,je="rgb(160, 160, 160)",qe=6,ue=7,Je="#b8b8c0",de=ke-4;function Ze(t){return t.kind==="fill"?t.width??I:I}var V=t=>[{offset:0,color:t}];function G(t,e,n,o=I){return{key:t,label:n,swatch:{kind:"fill",stops:V(e),width:o}}}function Qe(t){return t.flatMap((e,n)=>[{offset:n/t.length,color:e},{offset:(n+1)/t.length,color:e}])}function et(t){let e=new Map;for(let n of t.bubbleHalos)if(!n.whole){let o=y[n.kind],r=e.get(o)??new Set;r.add(ne[n.kind]),e.set(o,r)}return[...e].map(([n,o])=>{let r=[...o].join(" or ");return{color:n,label:r===ne.superbubble?r:`${r} bubble`}})}function tt(t){let e=t.openBubble;if(!e)return[];let n=t.bubbleHalos.find(o=>L(o.bubble,e));return[{key:"open",label:`open: ${n?.label??"bubble"}`,swatch:n?{kind:"halo",color:y[n.kind]}:{kind:"blank"},closesBubble:!0}]}function nt(t){let e=t.walkLift?void 0:t.referenceRampDomain;if(!e)return[];let n=Math.round(e.start),o=Math.round(e.end),{offReference:r,unplaced:s}=t.referenceRampOffKeys;return[{key:"ramp",label:`${n.toLocaleString()}-${o.toLocaleString()} (${J(o-n)})`,swatch:{kind:"fill",stops:B,width:W}},...r?[G("off",Z,"off the reference",W)]:[],...s?[G("unplaced",je,"no reference position",W)]:[]]}function rt(t){let e=t.walkLift;if(e)return e.walks.map(r=>te(r.encoding));if(t.effectiveColorScheme==="reference-position")return[B];let n=t.referenceStripBlocks.map(r=>r.colors[0]).filter((r,s,i)=>r!==i[s-1]),o=Math.min(qe,n.length);return[o===0?V(Y):Array.from({length:o},(r,s)=>({offset:o>1?s/(o-1):0,color:n[o>1?Math.round(s*(n.length-1)/(o-1)):0]}))]}function ot(t){if(!t.referenceStripShown)return[];let e=(t.walkLift?.walks.length??0)>1;return[{key:"strip",label:`top strip: reference${e?", a row per walk":""}`,swatch:{kind:"bands",bands:rt(t)}},...t.referenceStripFaded?[G("strip-faded",Y,t.walkLift?`reference not on ${e?"that row's walk":t.liftedWalksLabel}`:"reference outside the open bubble")]:[],...t.referenceStripOverhangs?[{key:"overhang",label:"graph runs past this edge",swatch:{kind:"overhang"}}]:[]]}function at(t){return et(t).map(({color:e,label:n})=>({key:`halo-${e}`,label:n,swatch:{kind:"halo",color:e}}))}function st(t){return t.genePins.some(e=>e.exonsByNode.length>0)?[{key:"exon",label:"exon",swatch:{kind:"outline",color:A,stroke:2,radius:5,height:8}}]:[]}function it(t){let e=t.foldNote;return e?[{key:"fold",label:e}]:[]}function lt(t){return t.pathLegend.map(({name:e,label:n,color:o})=>({key:`path-${e}`,label:n,swatch:{kind:"line",color:o}}))}function N(t,e,n){return{key:t,label:n,swatch:{kind:"fill",stops:V(e),height:ue,square:!0}}}function pt(t){let{roles:e,haplotypeTube:n,bundled:o,values:r,logWidths:s,foldBp:i,forwardReads:p,reverseReads:a,substitution:u,insertion:c,deletion:d}=t.tubeMapKeys,f=t.readsShown,b=[];r&&b.push(N("value-reference",le,"reference"),...r.map(({value:m,color:l})=>N(`value-${m}`,l,m))),e&&b.push(N("ref",le,"reference"),N("hap",n,o?"shared route, \xD7n haplotypes":"haplotype"));let g=(m,l,w)=>({key:m,label:w,swatch:{kind:"fill",stops:Qe(l),height:ue,square:!0}});return p&&b.push(g("fwd",Q,"read on the forward strand")),a&&b.push(g("rev",ee,"read on the reverse strand")),f&&f.shown<f.total&&b.push({key:"sampled",label:`${f.shown.toLocaleString("en-US")} of ${f.total.toLocaleString("en-US")} reads shown`,swatch:{kind:"blank"}}),u&&b.push({key:"sub",label:"read mismatch",swatch:{kind:"glyph",char:"A"}}),c&&b.push({key:"ins",label:"read insertion",swatch:{kind:"glyph",char:"*"}}),d&&b.push(N("del","grey","read deletion")),i!==void 0&&b.push({key:"tube-fold",label:`haplotype variant < ${J(i)}`,swatch:{kind:"tick",color:Ce(),height:ue,backing:Je}}),s&&b.push({key:"log",label:"width grows with log of length",swatch:{kind:"bracket"}}),b}function ct(t){return t.kind==="gene"?{kind:"outline",color:me,stroke:1.5,radius:0,height:de}:{kind:"fill",stops:t.kind==="bar"&&t.ramp?B:V(t.fill),height:t.kind==="gap"?K:de}}function ut(t){let e=t.walkRowBars;if(!e)return[];let n=[e.reference,...e.rows].flatMap(r=>r.call??[]),o=(r,s,i)=>({key:r,label:i,swatch:{kind:"tick",color:s,height:de}});return[...xe(e,{ramp:t.referenceRampDomain,genes:t.walkRowGeneKey}).map(r=>({key:`rows-${r.label}`,label:r.label,swatch:r.note?void 0:ct(r.swatch)})),...n.some(r=>r.spanningReads!==0)?[o("call",Me,"allele length called for this walk")]:[],...n.some(r=>r.spanningReads===0)?[o("unbacked",ye,"called with no read spanning it")]:[],...n.some(r=>r.agrees===!1)?[o("disagrees",Pe,`walk and call over ${Math.round(.1*100)}% apart`)]:[]]}function dt(t,e){let n=Ee(e,t.walkReference);return{key:`walk-${e.name}`,strong:t.walkLabel(e.name),label:n.delta+n.outside+n.reversed,swatch:{kind:"fill",stops:te(e.encoding),width:n.shades?W:I},under:n.scale,title:n.hover,walk:e}}function ft(t){let e=t.walkLift;if(!e||t.facetPanels)return[];let n=e.walks.map(r=>dt(t,r)),o=n.some(r=>Ze(r.swatch)===W)?W:I;return[...n,...t.liftPaintsOffReference?[G("lift-off",Z,"off the reference",o)]:[],G("faded",Y,`not on ${t.liftedWalksLabel}`,o)]}function Dn(t){return[{testid:"graph-open-bubble-legend",rows:tt(t)},{testid:"graph-ramp-legend",rows:nt(t)},{testid:"graph-reference-strip-legend",rows:ot(t)},{testid:"graph-halo-legend",rows:at(t)},{testid:"graph-gene-legend",rows:st(t)},{testid:"graph-fold-legend",rows:it(t)},{testid:"graph-path-legend",rows:lt(t)},{testid:"graph-tube-map-legend",rows:pt(t)},{testid:"graph-walk-rows-legend",rows:ut(t)},{testid:"graph-walk-readout",rows:ft(t)}].filter(e=>e.rows.length>0)}function bt(t){return t==="class"?"className":/^(data|aria)-/.test(t)?t:t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function Be(t,e){if(typeof t=="string")return t;let n={key:e};for(let[o,r]of Object.entries(t.attrs))r!==void 0&&(n[bt(o)]=r);return we(t.tag,n,...t.children.map(Be))}function H({el:t}){return Be(t,0)}var ht={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:2},gt=x(function({model:e}){let n=`exon-outline-${D().replaceAll(/[^\w-]/g,"")}`,{genePins:o,walkLift:r,nodeInk:s}=e,{scaleX:i,scaleY:p,translateX:a,translateY:u,paneWidth:c,canvasHeight:d}=e,f=r?void 0:e.openBubbleFocus,b=f?o.map(m=>({...m,exonsByNode:m.exonsByNode.filter(l=>f.nodeIds.has(l.nodeId))})):o,g=oe(re(b,s.halfWidthPx,r),{id:n,width:c,height:d,transform:`translate(${a} ${u}) scale(${i} ${p})`});return g?h("svg",{style:ht,width:c,height:d,"data-testid":"graph-gene-pins",children:h(H,{el:g})}):null}),jn=gt;function T({x:t,y:e,w:n,text:o,note:r,color:s,edge:i=s,italic:p,small:a,dimmed:u,title:c,testId:d,onClick:f,onHover:b}){return P("g",{style:{pointerEvents:f||b?"auto":"none",cursor:f?"pointer":void 0,opacity:u?.35:1},"data-testid":d,onClick:f,onMouseEnter:()=>{b?.(!0)},onMouseLeave:()=>{b?.(!1)},children:[c?h("title",{children:c}):null,h("rect",{x:t-n/2,y:e-S-X+2,width:n,height:S+X*2-2,rx:3,fill:"rgba(255,255,255,0.85)",stroke:i,strokeWidth:a?.6:1}),P("text",{x:t,y:e,fontSize:a?S-1:S,fontFamily:"sans-serif",fontStyle:p?"italic":void 0,fontWeight:p?600:void 0,fill:s,textAnchor:"middle",children:[o,r?h("tspan",{fontStyle:"normal",fontWeight:"normal",children:r}):null]})]})}var wt={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"hidden",zIndex:3},Ne="#1c1c22",fe=9,be=3,mt=x(function({model:e}){let{bubbles:n,genes:o,routes:r,ticks:s}=e.overlayLabels;if(n.length+o.length+r.length+s.length===0)return null;let{walkLift:i,scaleY:p,translateY:a,contigThickness:u,hoveredBubble:c}=e,d=c?s.find(l=>L(l.item.bubble,c)):void 0,f=l=>s[Number(l.getAttribute("data-tick"))],b=l=>e.bubbleFaded(l),g=l=>e.bubbleIsOpen(l.bubble),m=l=>i!==void 0&&!l.route.walks.some(w=>i.names.has(w));return P("svg",{style:wt,width:e.paneWidth,height:e.canvasHeight,"data-testid":"graph-label-layer",children:[h("g",{"data-testid":"graph-bubble-ticks",onClick:l=>{let w=f(l.target);w&&e.toggleBubble(w.item.bubble)},onMouseOver:l=>{let w=f(l.target);w&&e.setHoveredBubble(w.item.bubble)},onMouseOut:()=>{z(e)&&e.setHoveredBubble(null)},children:s.map(({item:l,x:w,y:R},M)=>h("rect",{"data-tick":M,x:w-be/2,y:R-fe,width:be,height:fe,rx:be/2,fill:y[l.kind],opacity:b(l)?.35:1,style:{pointerEvents:"all",cursor:"pointer"}},O(l.bubble)))}),o.map(({item:l,x:w,y:R,w:M,text:v})=>{let{gene:k}=l,he=Le(l);return P("g",{children:[h("line",{x1:w,x2:w,y1:R-S-2,y2:l.at.y*p+a+u/2,stroke:Ne,strokeWidth:.8,strokeOpacity:.6}),h(T,{x:w,y:R,w:M,text:k.name,note:v.slice(k.name.length)||void 0,color:Ne,edge:A,italic:!0,title:`${k.name} ${k.refName}:${k.start.toLocaleString()}-${k.end.toLocaleString()}${he?`, ${he} in the cut`:""}`,testId:"graph-gene-pin-label"})]},`${k.name}-${k.start}`)}),r.map(({item:{halo:l,route:w},x:R,y:M,w:v,text:k})=>h(T,{x:R,y:M,w:v,text:k,color:y[l.kind],small:!0,dimmed:m(w),title:`${w.route.walks.length} walk(s): ${w.route.walks.join(", ")}`,testId:"graph-route-label"},`${O(l.bubble)}-${w.route.steps.join(",")}`)),n.map(({item:l,x:w,y:R,w:M,text:v})=>h(T,{x:w,y:R,w:M,text:v,color:y[l.kind],dimmed:b(l),title:`${l.label}
|
|
2
|
-
${l.bubble.segmentCount} segments${l.bubble.covering?"":g(l)?" \xB7 click to close":" \xB7 click to open"}`,testId:"graph-bubble-halo-label",onClick:l.bubble.covering?void 0:()=>{e.toggleBubble(l.bubble)},onHover:k=>{z(e)&&e.setHoveredBubble(k?l.bubble:null)}},O(l.bubble))),d?h(T,{x:d.x,y:d.y-fe-4,w:q(d.item.label),text:d.item.label,color:y[d.item.kind],testId:"graph-bubble-tick-label"}):null]})}),gr=mt;var kt={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:5};function Rt(t,e,{lit:n,dpr:o}){let r=e.referenceStripFrame;r&&Te(t,e.referenceStripBlocks,r,{width:e.paneWidth,lit:n,darkMode:e.darkMode,dpr:o})}var xt=x(function({model:e}){let n=C(null),{referenceStripShown:o,paneWidth:r,canvasHeight:s}=e;return _(()=>$(()=>{let i=n.current,p=i?.getContext("2d");if(i&&p&&e.referenceStripShown){let a=F(),u=e.paneWidth,c=e.canvasHeight;i.width=Math.round(u*a),i.height=Math.round(c*a),p.setTransform(a,0,0,a,0,0),p.clearRect(0,0,u,c),Rt(p,e,{lit:e.referenceStripLit,dpr:a})}}),[e]),h("canvas",{ref:n,"data-testid":o?"graph-reference-strip":void 0,style:{...kt,width:r,height:s,display:o?"block":"none"}})}),Pr=xt;var Mt=.45,yt={position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1};function Pt(t,e,{highlightNode:n}){let o=e.tubeMapPicture,r=e.tubeMapFrame;if(!o||!r)return;let s=e.paneWidth,i=e.tubeMapPanelViews;if(i){St(t,e,i,n);return}let p={...r,width:s,highlightNode:n,darkMode:e.darkMode,tubeColors:e.tubeMapTubeColors,nodeColors:e.tubeMapNodeColors};ie(t,o,p);let a=e.layoutResult?.tubeMap;a&&(pe(t,o,a.graph,p),ce(t,a,p)),se(t,e.tubeMapDeviations,p),_e(t,e.tubeMapConnectors,e.connectorZoneBottom,p);let{bounds:u}=o;Oe(t,e.tubeMapGenes,p,r.y(u.minY)-2);let c=e.tubeMapRulerBoxes;c&&ae(t,c,p,r.y(u.maxY)+4,e.layoutResult?.referenceAxis)}function St(t,e,n,o){let r=e.paneWidth,s=e.darkMode?"255,255,255":"0,0,0";for(let a of n){if(a.bottom<0||a.titleTop>e.canvasHeight)continue;let u={...a.frame,width:r,highlightNode:o,darkMode:e.darkMode,tubeColors:a.tubeColors,nodeColors:a.nodeColors};ie(t,a.picture,u),pe(t,a.picture,a.panel.result.tubeMap.graph,u),ce(t,a.panel.result.tubeMap,u),t.globalAlpha=Mt,se(t,a.deviations,u),t.globalAlpha=1,t.strokeStyle=`rgba(${s},0.15)`,t.lineWidth=1,t.beginPath(),t.moveTo(0,Math.round(a.titleTop)+.5),t.lineTo(r,Math.round(a.titleTop)+.5),t.stroke(),t.font=Ae,t.textAlign="left",t.textBaseline="top",t.fillStyle=`rgba(${s},0.85)`,t.fillText(a.label,6,a.titleTop+4)}let i=n.at(-1),p=e.tubeMapPanelRulerBoxes;i&&p&&ae(t,p,{...i.frame,width:r,darkMode:e.darkMode},i.bottom+4,!0)}var vt=x(function({model:e}){let n=C(null),{tubeMapPicture:o,paneWidth:r,canvasHeight:s}=e;return _(()=>$(()=>{let i=n.current,p=i?.getContext("2d");if(i&&p&&e.tubeMapPicture&&e.tubeMapFrame){let a=F(),u=e.paneWidth,c=e.canvasHeight;i.width=Math.round(u*a),i.height=Math.round(c*a),p.setTransform(a,0,0,a,0,0),p.clearRect(0,0,u,c),Pt(p,e,{highlightNode:e.selectedNode})}}),[e]),h("canvas",{ref:n,"data-testid":o?"graph-tube-map":void 0,style:{...yt,width:r,height:s,display:o?"block":"none"}})}),Ir=vt;var E=JBrowseExports["@jbrowse/render-core/marks"],Lt=t=>E!=null&&t in Object(E)?E[t]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+t+"' from '@jbrowse/render-core/marks' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:t});var Ie=Lt("spanMark");var $r=E&&E.__esModule?E.default:E;function Et(t,e,n){let o=e*Math.min(n,1-n),r=s=>{let i=(s+t/30)%12;return 255*(n-o*Math.max(-1,Math.min(i-3,9-i,1)))};return[r(0),r(8),r(4)]}function De(t){if(t.startsWith("#")){let r=Number.parseInt(t.slice(1),16);return[r>>16&255,r>>8&255,r&255]}let[e=0,n=0,o=0]=t.match(/[\d.]+/g).map(Number);return t.startsWith("hsl")?Et(e,n/100,o/100):[e,n,o]}var Xe=([t,e,n])=>(255<<24|Math.round(n)<<16|Math.round(e)<<8|Math.round(t))>>>0,Ge=new Map;function _t(t){let e=Ge.get(t);return e===void 0&&(e=Xe(De(t)),Ge.set(t,e)),e}function Ct(t,e,n){let o=t.start+t.bp,r=Re(t,e);if("fill"in r)return[[t.start,o,_t(r.fill)]];let s=r.stops.map(De),i=r.stops.map(c=>Number(/[\d.]+/.exec(c)[0])),p=Math.abs(i.at(-1)-i[0]),a=Math.max(1,Math.min(Math.ceil(t.bp*n),Math.ceil(p),t.bp)),u=[];for(let c=0;c<a;c++){let d=(c+.5)/a*(s.length-1),f=Math.min(Math.floor(d),s.length-2),b=s[f],g=s[f+1],m=d-f;u.push([Math.round(t.start+t.bp*c/a),Math.round(t.start+t.bp*(c+1)/a),Xe([0,1,2].map(l=>b[l]+(g[l]-b[l])*m))])}return u}function He(t){return{x:new Uint32Array(t),x2:new Uint32Array(t),row:new Uint32Array(t),color:new Uint32Array(t),count:0}}function $e(t){let e=t.count;return{x:t.x.subarray(0,e),x2:t.x2.subarray(0,e),row:t.row.subarray(0,e),color:t.color.subarray(0,e),count:e}}function Ye(t,e,n){let o=t.map(u=>Se(u.runs,e).map(c=>({gap:c.gap,pieces:Ct(c,n,e)}))),r=0;for(let u of o)for(let c of u)r+=c.pieces.length;let s=He(r),i=He(r),p=new Uint32Array(t.length+1),a=new Uint32Array(t.length+1);return o.forEach((u,c)=>{for(let d of u){let f=d.gap?i:s;for(let[b,g,m]of d.pieces){let l=f.count++;f.x[l]=b,f.x2[l]=g,f.row[l]=c,f.color[l]=m}}p[c+1]=s.count,a[c+1]=i.count}),{bars:$e(s),gaps:$e(i),barRows:p,gapRows:a}}function Ot(t,e,n){return{x:t.x.subarray(e,n),x2:t.x2.subarray(e,n),row:t.row.subarray(e,n),color:t.color.subarray(e,n),count:n-e}}function Ke(t,e,n){let o=1;for(let p of[e.bars,e.gaps])for(let a of p.x2)o=Math.max(o,a);let r={start:0,end:o,screenStartPx:n.origin*n.scaleX+n.translateX,screenEndPx:(n.origin+o)*n.scaleX+n.translateX,reversed:!1,displayedRegionIndex:0},s={canvasWidth:n.width,canvasHeight:n.height},i=n.rowPx*n.scaleY;for(let{first:p,count:a,rowY:u}of n.blocks){let c=i/2-n.translateY-(u-p*n.rowPx)*n.scaleY,d=(u-n.rowPx/2)*n.scaleY+n.translateY;if(!(d>n.height||d+a*i<0))for(let[f,b,g]of[[e.bars,e.barRows,n.barPx],[e.gaps,e.gapRows,Math.min(K,n.barPx)]])Ie.paintBlock(t,Ot(f,b[p],b[p+a]),r,s,{rowHeight:i,rowProportion:g/i,minWidthPx:1,seamPx:0,scrollTop:c})}}var Ue={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible",zIndex:3};function At(t,e,n,o,r){return e.length===0?[U(t,o,r)]:[U({...t,rows:[]},o,r),...e.flatMap((s,i)=>U({...t,rows:t.rows.slice(s.first-1,s.first-1+s.count)},{...o,translateY:o.translateY+(n(s.first)-o.rowPx)*o.scaleY},{...r,idPrefix:`${r.idPrefix}-s${i}`}).children.filter(a=>typeof a!="string"&&a.attrs["data-testid"]!=="graph-walk-reference"))]}var Wt={...Ue,overflow:void 0},Tt=x(function({model:e,rows:n,origin:o}){let r=C(null),{scaleX:s,scaleY:i,translateX:p,translateY:a,paneWidth:u,canvasHeight:c}=e,d=e.walkRowPlacement,f=e.walkRowPitch,b=e.walkRowGroups?.sections,g=e.referenceRampDomain,m=j(()=>Ye(n,s,g),[n,s,g]);_(()=>{let w=r.current,R=w?.getContext("2d");if(!w||!R||!d||!f)return;let M=window.devicePixelRatio||1;R.setTransform(M,0,0,M,0,0),R.clearRect(0,0,u,c);let v=b?.length?[{first:0,count:1,rowY:d.rowY(0)},...b.map(k=>({first:k.first,count:k.count,rowY:d.rowY(k.first)}))]:[{first:0,count:n.length,rowY:d.rowY(0)}];Ke(R,m,{scaleX:s,scaleY:i,translateX:p,translateY:a,width:u,height:c,rowPx:f.rowPx,barPx:f.barPx,origin:o,blocks:v})},[m,n.length,o,d,f,b,s,i,p,a,u,c]);let l=typeof window>"u"?1:window.devicePixelRatio||1;return h("canvas",{ref:r,"data-testid":"graph-walk-rows-spans",width:Math.round(u*l),height:Math.round(c*l),style:{...Wt,width:u,height:c}})}),Bt=x(function({model:e,vector:n=!1}){let o=D().replace(/[^\w-]/g,""),r=e.walkRowBars,s=e.walkRowPlacement,i=e.walkRowPitch,p=j(()=>r&&{all:[r.reference,...r.rows],bare:{...r,reference:{...r.reference,runs:[]},rows:r.rows.map(g=>({...g,runs:[]}))}},[r]);if(!r||!p||!s||!i)return null;let{paneWidth:a,canvasHeight:u}=e,c=g=>g*e.scaleY+e.translateY,d=e.hoveredWalkRowText?[r.reference,...r.rows].findIndex(g=>g.name===e.hoveredWalkRow):-1,f=d>=0?[r.reference,...r.rows][d]:void 0,b={scaleX:e.scaleX,scaleY:e.scaleY,translateX:e.translateX,translateY:e.translateY,width:a,height:u,...i};return P(ge,{children:[n?null:h(Tt,{model:e,rows:p.all,origin:r.origin}),P("svg",{style:Ue,width:a,height:u,"data-testid":"graph-walk-rows",children:[At(n?r:p.bare,e.walkRowGroups?.sections??[],s.rowY,b,{ramp:e.referenceRampDomain,rowGenes:e.walkRowGenes,idPrefix:o}).map((g,m)=>h(H,{el:g},m)),s.headers.map(g=>h("text",{x:10,y:c(g.top)+We-4,fontFamily:"sans-serif",fontSize:11,fontWeight:"bold",fill:"#333","data-testid":"graph-walk-section",children:g.title},g.key)),f?h("rect",{"data-testid":"graph-walk-row-hovered",x:r.origin*e.scaleX+e.translateX-2,y:c(s.rowY(d))-i.rowPx/2-1,width:f.bp*e.scaleX+4,height:i.rowPx+2,fill:"none",stroke:"#111",strokeWidth:1}):null]})]})}),Jr=Bt;export{$t as a,I as b,Ze as c,ct as d,dt as e,Dn as f,H as g,jn as h,gr as i,Rt as j,Pr as k,Pt as l,Ir as m,Jr as n};
|
|
3
|
-
//# sourceMappingURL=chunk-N6PJ3YND.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/GraphGenomeView/components/BubbleHalos.tsx", "../../src/GraphGenomeView/legendSections.ts", "../../src/GraphGenomeView/components/ElTree.tsx", "../../src/GraphGenomeView/components/GenePins.tsx", "../../src/GraphGenomeView/components/LabelChip.tsx", "../../src/GraphGenomeView/components/LabelLayer.tsx", "../../src/GraphGenomeView/components/ReferenceStripOverlay.tsx", "../../src/GraphGenomeView/components/TubeMapOverlay.tsx", "host:@jbrowse/render-core/marks", "../../src/GraphGenomeView/walkRowSpans.ts", "../../src/GraphGenomeView/components/WalkRowsOverlay.tsx"],
|
|
4
|
-
"sourcesContent": ["import { bubbleKey, sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { HALO_FACTOR } from '@jbrowse/bandage-core/labelLayout'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\n// The bubbles over a node drawing: each a translucent halo along its nodes,\n// drawn once in layout units and moved with the canvas by one transform. The\n// halo takes no pointer events, so the nodes under it still hover and drag;\n// its name and its routes' chips are LabelLayer's. A small variant is\n// LabelLayer's tick, and shows its halo only while hovered.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nconst BubbleHalos = observer(function BubbleHalos({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbleHalos, hoveredBubble } = model\n if (bubbleHalos.length === 0) {\n return null\n }\n const {\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth: width,\n canvasHeight,\n } = model\n const halo = model.contigThickness * HALO_FACTOR\n return (\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-bubble-halos\"\n >\n <g\n transform={`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`}\n >\n {bubbleHalos\n .filter(\n h =>\n !h.whole &&\n (!h.tick ||\n (hoveredBubble && sameBubble(h.bubble, hoveredBubble))),\n )\n .map(h => (\n <path\n key={bubbleKey(h.bubble)}\n d={h.path}\n fill=\"none\"\n stroke={BUBBLE_KIND_COLORS[h.kind]}\n strokeOpacity={\n hoveredBubble && sameBubble(h.bubble, hoveredBubble)\n ? 0.45\n : model.bubbleFaded(h)\n ? 0.06\n : 0.22\n }\n strokeWidth={halo}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n </svg>\n )\n})\n\nexport default BubbleHalos\n", "import { sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport {\n BUBBLE_KIND_COLORS,\n BUBBLE_KIND_NAMES,\n} from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { EXON_COLOR } from '@jbrowse/bandage-core/genes/exonOutline'\nimport { formatBp } from '@jbrowse/bandage-core/graphLabels'\nimport {\n BAR_PX as WALK_ROW_BAR_PX,\n CALL_TICK,\n DISAGREES,\n GAP_PX,\n GENE_INK,\n UNBACKED_TICK,\n walkRowsKey,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport { RAMP_GRADIENT_STOPS } from '@jbrowse/bandage-core/referenceRampCss'\nimport {\n LIFT_BACKDROP_CSS,\n REFERENCE_RAMP_ALT_CSS,\n} from '@jbrowse/bandage-core/renderer/GeometryBuilder'\nimport { deviationInk } from '@jbrowse/bandage-core/tubeMap/deviations'\nimport {\n FORWARD_READ_COLORS,\n REVERSE_READ_COLORS,\n} from '@jbrowse/bandage-core/tubeMap/reads'\nimport { encodingStops } from '@jbrowse/bandage-core/walkEncoding'\nimport { walkKey } from '@jbrowse/bandage-core/walkKey'\n\nimport { CALL_TOLERANCE } from './repeats/walkCalls'\nimport { PANEL_REFERENCE_TUBE } from './tubeMapPanels'\n\nimport type { GraphPaneModel } from './model'\nimport type { KeySwatch } from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport type { LiftedWalk } from '@jbrowse/bandage-core/walkHighlight'\n\n// The legend as data, so the screen's panel and the exported figure's key\n// draw the same rows from one place\n\nexport const SWATCH_PX = 18\nexport const BAR_PX = 48\n\n// getNodeColor's grey for a node the ramp cannot place\nexport const UNPLACED_SWATCH = 'rgb(160, 160, 160)'\n\nconst STRIP_SAMPLES = 6\nconst TUBE_SWATCH_PX = 7\nconst FOLD_TICK_BACKING = '#b8b8c0'\nconst WALK_ROW_SWATCH_PX = WALK_ROW_BAR_PX - 4\n\nexport interface Stop {\n offset: number\n color: string\n}\n\nexport type LegendSwatch =\n | {\n kind: 'fill'\n stops: Stop[]\n width?: number\n height?: number\n square?: boolean\n }\n // the reference strip, a band per lifted walk\n | { kind: 'bands'; bands: Stop[][] }\n | { kind: 'line'; color: string }\n | { kind: 'halo'; color: string }\n | {\n kind: 'outline'\n color: string\n stroke: number\n radius: number\n height: number\n }\n | { kind: 'overhang' }\n | { kind: 'glyph'; char: string }\n | { kind: 'tick'; color: string; height: number; backing?: string }\n | { kind: 'bracket' }\n | { kind: 'blank' }\n\n// A row with no swatch is a note on the drawing\nexport interface LegendRow {\n key: string\n label: string\n swatch?: LegendSwatch\n strong?: string\n under?: string\n title?: string\n walk?: LiftedWalk\n closesBubble?: true\n}\n\nexport interface LegendSection {\n testid: string\n rows: LegendRow[]\n}\n\nexport function swatchWidth(swatch: LegendSwatch) {\n return swatch.kind === 'fill' ? (swatch.width ?? SWATCH_PX) : SWATCH_PX\n}\n\nconst flat = (color: string): Stop[] => [{ offset: 0, color }]\n\nfunction fillRow(\n key: string,\n color: string,\n label: string,\n width = SWATCH_PX,\n): LegendRow {\n return { key, label, swatch: { kind: 'fill', stops: flat(color), width } }\n}\n\n// hard-edged bands, a read taking one shade of its strand's palette\nfunction bandStops(colors: readonly string[]) {\n return colors.flatMap((color, i) => [\n { offset: i / colors.length, color },\n { offset: (i + 1) / colors.length, color },\n ])\n}\n\n// One key entry per halo colour drawn, naming the kinds it stands for\nexport function haloKeyEntries(model: GraphPaneModel) {\n const kindsByColor = new Map<string, Set<string>>()\n for (const h of model.bubbleHalos) {\n if (!h.whole) {\n const color = BUBBLE_KIND_COLORS[h.kind]\n const kinds = kindsByColor.get(color) ?? new Set<string>()\n kinds.add(BUBBLE_KIND_NAMES[h.kind])\n kindsByColor.set(color, kinds)\n }\n }\n return [...kindsByColor].map(([color, kinds]) => {\n const names = [...kinds].join(' or ')\n return {\n color,\n label:\n names === BUBBLE_KIND_NAMES.superbubble ? names : `${names} bubble`,\n }\n })\n}\n\nfunction openBubbleRows(model: GraphPaneModel): LegendRow[] {\n const open = model.openBubble\n if (!open) {\n return []\n }\n const halo = model.bubbleHalos.find(h => sameBubble(h.bubble, open))\n return [\n {\n key: 'open',\n label: `open: ${halo?.label ?? 'bubble'}`,\n swatch: halo\n ? { kind: 'halo', color: BUBBLE_KIND_COLORS[halo.kind] }\n : { kind: 'blank' },\n closesBubble: true,\n },\n ]\n}\n\n// Under lifted walks each lane states its own scale, and the rest is grey\nfunction rampRows(model: GraphPaneModel): LegendRow[] {\n const domain = model.walkLift ? undefined : model.referenceRampDomain\n if (!domain) {\n return []\n }\n // a measured domain runs between node midpoints, which can fall on a half bp\n const start = Math.round(domain.start)\n const end = Math.round(domain.end)\n const { offReference, unplaced } = model.referenceRampOffKeys\n return [\n {\n key: 'ramp',\n label: `${start.toLocaleString()}-${end.toLocaleString()} (${formatBp(end - start)})`,\n swatch: { kind: 'fill', stops: RAMP_GRADIENT_STOPS, width: BAR_PX },\n },\n ...(offReference\n ? [fillRow('off', REFERENCE_RAMP_ALT_CSS, 'off the reference', BAR_PX)]\n : []),\n ...(unplaced\n ? [fillRow('unplaced', UNPLACED_SWATCH, 'no reference position', BAR_PX)]\n : []),\n ]\n}\n\n// The strip's own colours: a band per lifted walk in its lane's, else the\n// node scheme's, a few of its blocks in bp order rather than a rainbow it\n// does not draw\nfunction stripBands(model: GraphPaneModel): Stop[][] {\n const lift = model.walkLift\n if (lift) {\n return lift.walks.map(w => encodingStops(w.encoding))\n }\n if (model.effectiveColorScheme === 'reference-position') {\n return [RAMP_GRADIENT_STOPS]\n }\n const colors = model.referenceStripBlocks\n .map(b => b.colors[0]!)\n .filter((c, i, all) => c !== all[i - 1])\n const n = Math.min(STRIP_SAMPLES, colors.length)\n return [\n n === 0\n ? flat(LIFT_BACKDROP_CSS)\n : Array.from({ length: n }, (_, i) => ({\n offset: n > 1 ? i / (n - 1) : 0,\n color:\n colors[\n n > 1 ? Math.round((i * (colors.length - 1)) / (n - 1)) : 0\n ]!,\n })),\n ]\n}\n\nfunction stripRows(model: GraphPaneModel): LegendRow[] {\n if (!model.referenceStripShown) {\n return []\n }\n const rowPerWalk = (model.walkLift?.walks.length ?? 0) > 1\n return [\n {\n key: 'strip',\n label: `top strip: reference${rowPerWalk ? ', a row per walk' : ''}`,\n swatch: { kind: 'bands', bands: stripBands(model) },\n },\n ...(model.referenceStripFaded\n ? [\n fillRow(\n 'strip-faded',\n LIFT_BACKDROP_CSS,\n model.walkLift\n ? `reference not on ${rowPerWalk ? \"that row's walk\" : model.liftedWalksLabel}`\n : 'reference outside the open bubble',\n ),\n ]\n : []),\n ...(model.referenceStripOverhangs\n ? [\n {\n key: 'overhang',\n label: 'graph runs past this edge',\n swatch: { kind: 'overhang' } as const,\n },\n ]\n : []),\n ]\n}\n\nfunction haloRows(model: GraphPaneModel): LegendRow[] {\n return haloKeyEntries(model).map(({ color, label }) => ({\n key: `halo-${color}`,\n label,\n swatch: { kind: 'halo', color },\n }))\n}\n\nfunction geneRows(model: GraphPaneModel): LegendRow[] {\n return model.genePins.some(pin => pin.exonsByNode.length > 0)\n ? [\n {\n key: 'exon',\n label: 'exon',\n swatch: {\n kind: 'outline',\n color: EXON_COLOR,\n stroke: 2,\n radius: 5,\n height: 8,\n },\n },\n ]\n : []\n}\n\nfunction foldRows(model: GraphPaneModel): LegendRow[] {\n const note = model.foldNote\n return note ? [{ key: 'fold', label: note }] : []\n}\n\nfunction pathRows(model: GraphPaneModel): LegendRow[] {\n return model.pathLegend.map(({ name, label, color }) => ({\n key: `path-${name}`,\n label,\n swatch: { kind: 'line', color },\n }))\n}\n\nfunction tubeRow(key: string, color: string, label: string): LegendRow {\n return {\n key,\n label,\n swatch: {\n kind: 'fill',\n stops: flat(color),\n height: TUBE_SWATCH_PX,\n square: true,\n },\n }\n}\n\n// What a tube map draws that nothing else on screen explains, each listed\n// only while it applies\nexport function tubeMapRows(model: GraphPaneModel): LegendRow[] {\n const {\n roles,\n haplotypeTube,\n bundled,\n values,\n logWidths,\n foldBp,\n forwardReads,\n reverseReads,\n substitution,\n insertion,\n deletion,\n } = model.tubeMapKeys\n const reads = model.readsShown\n const rows: LegendRow[] = []\n if (values) {\n rows.push(\n tubeRow('value-reference', PANEL_REFERENCE_TUBE, 'reference'),\n ...values.map(({ value, color }) =>\n tubeRow(`value-${value}`, color, value),\n ),\n )\n }\n if (roles) {\n rows.push(\n tubeRow('ref', PANEL_REFERENCE_TUBE, 'reference'),\n tubeRow(\n 'hap',\n haplotypeTube,\n bundled ? 'shared route, \u00D7n haplotypes' : 'haplotype',\n ),\n )\n }\n const readRow = (key: string, colors: readonly string[], label: string) => ({\n key,\n label,\n swatch: {\n kind: 'fill',\n stops: bandStops(colors),\n height: TUBE_SWATCH_PX,\n square: true,\n } as const,\n })\n if (forwardReads) {\n rows.push(readRow('fwd', FORWARD_READ_COLORS, 'read on the forward strand'))\n }\n if (reverseReads) {\n rows.push(readRow('rev', REVERSE_READ_COLORS, 'read on the reverse strand'))\n }\n if (reads && reads.shown < reads.total) {\n rows.push({\n key: 'sampled',\n label: `${reads.shown.toLocaleString('en-US')} of ${reads.total.toLocaleString('en-US')} reads shown`,\n swatch: { kind: 'blank' },\n })\n }\n if (substitution) {\n rows.push({\n key: 'sub',\n label: 'read mismatch',\n swatch: { kind: 'glyph', char: 'A' },\n })\n }\n if (insertion) {\n rows.push({\n key: 'ins',\n label: 'read insertion',\n swatch: { kind: 'glyph', char: '*' },\n })\n }\n if (deletion) {\n rows.push(tubeRow('del', 'grey', 'read deletion'))\n }\n if (foldBp !== undefined) {\n rows.push({\n key: 'tube-fold',\n label: `haplotype variant < ${formatBp(foldBp)}`,\n swatch: {\n kind: 'tick',\n color: deviationInk(),\n height: TUBE_SWATCH_PX,\n backing: FOLD_TICK_BACKING,\n },\n })\n }\n if (logWidths) {\n rows.push({\n key: 'log',\n label: 'width grows with log of length',\n swatch: { kind: 'bracket' },\n })\n }\n return rows\n}\n\nexport function walkRowSwatch(swatch: KeySwatch): LegendSwatch {\n return swatch.kind === 'gene'\n ? {\n kind: 'outline',\n color: GENE_INK,\n stroke: 1.5,\n radius: 0,\n height: WALK_ROW_SWATCH_PX,\n }\n : {\n kind: 'fill',\n stops:\n swatch.kind === 'bar' && swatch.ramp\n ? RAMP_GRADIENT_STOPS\n : flat(swatch.fill),\n height: swatch.kind === 'gap' ? GAP_PX : WALK_ROW_SWATCH_PX,\n }\n}\n\n// The walk rows' bar colours, genes and ticks; each tick row appears once\n// the rows hold one, so a catalogue with no genotypes keeps the plain key\nfunction walkRowsRows(model: GraphPaneModel): LegendRow[] {\n const bars = model.walkRowBars\n if (!bars) {\n return []\n }\n const calls = [bars.reference, ...bars.rows].flatMap(row => row.call ?? [])\n const tick = (key: string, color: string, label: string): LegendRow => ({\n key,\n label,\n swatch: { kind: 'tick', color, height: WALK_ROW_SWATCH_PX },\n })\n return [\n ...walkRowsKey(bars, {\n ramp: model.referenceRampDomain,\n genes: model.walkRowGeneKey,\n }).map(entry => ({\n key: `rows-${entry.label}`,\n label: entry.label,\n swatch: entry.note ? undefined : walkRowSwatch(entry.swatch),\n })),\n ...(calls.some(call => call.spanningReads !== 0)\n ? [tick('call', CALL_TICK, 'allele length called for this walk')]\n : []),\n ...(calls.some(call => call.spanningReads === 0)\n ? [tick('unbacked', UNBACKED_TICK, 'called with no read spanning it')]\n : []),\n ...(calls.some(call => call.agrees === false)\n ? [\n tick(\n 'disagrees',\n DISAGREES,\n `walk and call over ${Math.round(CALL_TOLERANCE * 100)}% apart`,\n ),\n ]\n : []),\n ]\n}\n\n// One lifted walk's key: a swatch, or a short bar of the scale its lane\n// shades by, then its name, with the scale's stretch under it\nexport function walkKeyRow(model: GraphPaneModel, walk: LiftedWalk): LegendRow {\n const key = walkKey(walk, model.walkReference)\n return {\n key: `walk-${walk.name}`,\n strong: model.walkLabel(walk.name),\n label: key.delta + key.outside + key.reversed,\n swatch: {\n kind: 'fill',\n stops: encodingStops(walk.encoding),\n width: key.shades ? BAR_PX : SWATCH_PX,\n },\n under: key.scale,\n title: key.hover,\n walk,\n }\n}\n\n// Each lifted walk's key, then what the faded rest is; the colours under a\n// shaded walk's bar are bars of its width\nfunction walkReadoutRows(model: GraphPaneModel): LegendRow[] {\n const lift = model.walkLift\n if (!lift || model.facetPanels) {\n return []\n }\n const rows = lift.walks.map(w => walkKeyRow(model, w))\n const width = rows.some(r => swatchWidth(r.swatch!) === BAR_PX)\n ? BAR_PX\n : SWATCH_PX\n return [\n ...rows,\n // the ramp's own key, which names this, is off while walks are lifted\n ...(model.liftPaintsOffReference\n ? [\n fillRow(\n 'lift-off',\n REFERENCE_RAMP_ALT_CSS,\n 'off the reference',\n width,\n ),\n ]\n : []),\n fillRow(\n 'faded',\n LIFT_BACKDROP_CSS,\n `not on ${model.liftedWalksLabel}`,\n width,\n ),\n ]\n}\n\n// The keys in the order the panel stacks them, top first\nexport function legendSections(model: GraphPaneModel): LegendSection[] {\n return [\n { testid: 'graph-open-bubble-legend', rows: openBubbleRows(model) },\n { testid: 'graph-ramp-legend', rows: rampRows(model) },\n { testid: 'graph-reference-strip-legend', rows: stripRows(model) },\n { testid: 'graph-halo-legend', rows: haloRows(model) },\n { testid: 'graph-gene-legend', rows: geneRows(model) },\n { testid: 'graph-fold-legend', rows: foldRows(model) },\n { testid: 'graph-path-legend', rows: pathRows(model) },\n { testid: 'graph-tube-map-legend', rows: tubeMapRows(model) },\n { testid: 'graph-walk-rows-legend', rows: walkRowsRows(model) },\n { testid: 'graph-walk-readout', rows: walkReadoutRows(model) },\n ].filter(section => section.rows.length > 0)\n}\n", "import { createElement } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { El } from '@jbrowse/bandage-core/el'\n\n// SVG's attribute names as React's props: `class` is className, `data-` and\n// `aria-` keep their dashes, the rest are camel-cased (`stroke-width` is\n// strokeWidth)\nfunction propName(name: string) {\n return name === 'class'\n ? 'className'\n : /^(data|aria)-/.test(name)\n ? name\n : name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\nfunction toReact(node: El | string, key: number): ReactNode {\n if (typeof node === 'string') {\n return node\n }\n const props: Record<string, unknown> = { key }\n for (const [name, value] of Object.entries(node.attrs)) {\n if (value !== undefined) {\n props[propName(name)] = value\n }\n }\n return createElement(node.tag, props, ...node.children.map(toReact))\n}\n\n// A core element tree as React elements\nexport default function ElTree({ el }: { el: El }) {\n return toReact(el, 0)\n}\n", "import { useId } from 'react'\n\nimport {\n exonOutlineTree,\n exonStretches,\n} from '@jbrowse/bandage-core/genes/exonOutline'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\n\nimport type { GraphPaneModel } from '../model'\n\n// The session's genes drawn onto the graph: each exon outlined round its\n// stretch of node, as core's exonOutlineTree draws it for every host, moved by\n// the same transform the halos use. Their names are LabelLayer's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 2,\n}\n\nexport { EXON_COLOR } from '@jbrowse/bandage-core/genes/exonOutline'\n\nconst GenePins = observer(function GenePins({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const id = `exon-outline-${useId().replaceAll(/[^\\w-]/g, '')}`\n const { genePins, walkLift, nodeInk } = model\n const { scaleX, scaleY, translateX, translateY, paneWidth, canvasHeight } =\n model\n // an open bubble rings only its own exons\n const focus = walkLift ? undefined : model.openBubbleFocus\n const pins = focus\n ? genePins.map(pin => ({\n ...pin,\n exonsByNode: pin.exonsByNode.filter(e => focus.nodeIds.has(e.nodeId)),\n }))\n : genePins\n const tree = exonOutlineTree(\n exonStretches(pins, nodeInk.halfWidthPx, walkLift),\n {\n id,\n width: paneWidth,\n height: canvasHeight,\n transform: `translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`,\n },\n )\n return tree ? (\n <svg\n style={svgStyle}\n width={paneWidth}\n height={canvasHeight}\n data-testid=\"graph-gene-pins\"\n >\n <ElTree el={tree} />\n </svg>\n ) : null\n})\n\nexport default GenePins\n", "import { LABEL_PAD, LABEL_PX } from '@jbrowse/bandage-core/overlayLabels'\n\n// One label on an overlay: a white chip with a coloured edge and text, its\n// baseline at y and centred on x. A note follows the text in plain type.\nexport default function LabelChip({\n x,\n y,\n w,\n text,\n note,\n color,\n edge = color,\n italic,\n small,\n dimmed,\n title,\n testId,\n onClick,\n onHover,\n}: {\n x: number\n y: number\n w: number\n text: string\n note?: string\n color: string\n edge?: string\n italic?: boolean\n small?: boolean\n dimmed?: boolean\n title?: string\n testId?: string\n onClick?: () => void\n onHover?: (hovered: boolean) => void\n}) {\n return (\n <g\n style={{\n pointerEvents: onClick || onHover ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : undefined,\n opacity: dimmed ? 0.35 : 1,\n }}\n data-testid={testId}\n onClick={onClick}\n onMouseEnter={() => {\n onHover?.(true)\n }}\n onMouseLeave={() => {\n onHover?.(false)\n }}\n >\n {title ? <title>{title}</title> : null}\n <rect\n x={x - w / 2}\n y={y - LABEL_PX - LABEL_PAD + 2}\n width={w}\n height={LABEL_PX + LABEL_PAD * 2 - 2}\n rx={3}\n fill=\"rgba(255,255,255,0.85)\"\n stroke={edge}\n strokeWidth={small ? 0.6 : 1}\n />\n <text\n x={x}\n y={y}\n fontSize={small ? LABEL_PX - 1 : LABEL_PX}\n fontFamily=\"sans-serif\"\n fontStyle={italic ? 'italic' : undefined}\n fontWeight={italic ? 600 : undefined}\n fill={color}\n textAnchor=\"middle\"\n >\n {text}\n {note ? (\n <tspan fontStyle=\"normal\" fontWeight=\"normal\">\n {note}\n </tspan>\n ) : null}\n </text>\n </g>\n )\n}\n", "import { bubbleKey, sameBubble } from '@jbrowse/bandage-core/bubbles/bubbleLine'\nimport { BUBBLE_KIND_COLORS } from '@jbrowse/bandage-core/bubbles/classifyBubble'\nimport { geneCoverageNote } from '@jbrowse/bandage-core/labelLayout'\nimport { LABEL_PX, labelWidth } from '@jbrowse/bandage-core/overlayLabels'\nimport { isAlive } from '@jbrowse/mobx-state-tree'\nimport { observer } from 'mobx-react'\n\nimport { EXON_COLOR } from './GenePins'\nimport LabelChip from './LabelChip'\n\nimport type { GraphPaneModel } from '../model'\nimport type {\n BubbleHalo,\n RouteLabel,\n} from '@jbrowse/bandage-core/bubbles/bubbleHalos'\n\n// Every chip drawn over the graph, above all of its ink: bubble names, gene\n// names on their pins, and the routes' walkers. `overlayLabels` has placed\n// them against each other and against the row labels already.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'hidden' as const,\n zIndex: 3,\n}\n\nconst GENE_INK = '#1c1c22'\nconst TICK_PX = 9\nconst TICK_WIDTH = 3\n\nconst LabelLayer = observer(function LabelLayer({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const { bubbles, genes, routes, ticks } = model.overlayLabels\n if (bubbles.length + genes.length + routes.length + ticks.length === 0) {\n return null\n }\n const { walkLift, scaleY, translateY, contigThickness, hoveredBubble } = model\n const hoveredTick = hoveredBubble\n ? ticks.find(t => sameBubble(t.item.bubble, hoveredBubble))\n : undefined\n const tickAt = (target: EventTarget) =>\n ticks[Number((target as Element).getAttribute('data-tick'))]\n const dimmedBubble = (h: BubbleHalo) => model.bubbleFaded(h)\n const isOpen = (h: BubbleHalo) => model.bubbleIsOpen(h.bubble)\n // lifted walks dim the routes none of them takes\n const dimmedRoute = (r: RouteLabel) =>\n walkLift !== undefined && !r.route.walks.some(w => walkLift.names.has(w))\n\n return (\n <svg\n style={svgStyle}\n width={model.paneWidth}\n height={model.canvasHeight}\n data-testid=\"graph-label-layer\"\n >\n <g\n data-testid=\"graph-bubble-ticks\"\n onClick={e => {\n const tick = tickAt(e.target)\n if (tick) {\n model.toggleBubble(tick.item.bubble)\n }\n }}\n onMouseOver={e => {\n const tick = tickAt(e.target)\n if (tick) {\n model.setHoveredBubble(tick.item.bubble)\n }\n }}\n // a leave also fires as the view closing it unmounts the tick\n onMouseOut={() => {\n if (isAlive(model)) {\n model.setHoveredBubble(null)\n }\n }}\n >\n {ticks.map(({ item: h, x, y }, i) => (\n <rect\n key={bubbleKey(h.bubble)}\n data-tick={i}\n x={x - TICK_WIDTH / 2}\n y={y - TICK_PX}\n width={TICK_WIDTH}\n height={TICK_PX}\n rx={TICK_WIDTH / 2}\n fill={BUBBLE_KIND_COLORS[h.kind]}\n opacity={dimmedBubble(h) ? 0.35 : 1}\n style={{ pointerEvents: 'all', cursor: 'pointer' }}\n />\n ))}\n </g>\n {genes.map(({ item: pin, x, y, w, text }) => {\n const { gene } = pin\n const note = geneCoverageNote(pin)\n return (\n <g key={`${gene.name}-${gene.start}`}>\n <line\n x1={x}\n x2={x}\n y1={y - LABEL_PX - 2}\n y2={pin.at.y * scaleY + translateY + contigThickness / 2}\n stroke={GENE_INK}\n strokeWidth={0.8}\n strokeOpacity={0.6}\n />\n <LabelChip\n x={x}\n y={y}\n w={w}\n text={gene.name}\n note={text.slice(gene.name.length) || undefined}\n color={GENE_INK}\n edge={EXON_COLOR}\n italic\n title={`${gene.name} ${gene.refName}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()}${note ? `, ${note} in the cut` : ''}`}\n testId=\"graph-gene-pin-label\"\n />\n </g>\n )\n })}\n {routes.map(({ item: { halo: h, route }, x, y, w, text }) => (\n <LabelChip\n key={`${bubbleKey(h.bubble)}-${route.route.steps.join(',')}`}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n small\n dimmed={dimmedRoute(route)}\n title={`${route.route.walks.length} walk(s): ${route.route.walks.join(', ')}`}\n testId=\"graph-route-label\"\n />\n ))}\n {bubbles.map(({ item: h, x, y, w, text }) => (\n <LabelChip\n key={bubbleKey(h.bubble)}\n x={x}\n y={y}\n w={w}\n text={text}\n color={BUBBLE_KIND_COLORS[h.kind]}\n dimmed={dimmedBubble(h)}\n title={`${h.label}\\n${h.bubble.segmentCount} segments${h.bubble.covering ? '' : isOpen(h) ? ' \u00B7 click to close' : ' \u00B7 click to open'}`}\n testId=\"graph-bubble-halo-label\"\n // the bubble the drawing is would open into this same drawing\n onClick={\n h.bubble.covering\n ? undefined\n : () => {\n model.toggleBubble(h.bubble)\n }\n }\n // a leave also fires as the view closing it unmounts the chip\n onHover={hovered => {\n if (isAlive(model)) {\n model.setHoveredBubble(hovered ? h.bubble : null)\n }\n }}\n />\n ))}\n {hoveredTick ? (\n <LabelChip\n x={hoveredTick.x}\n y={hoveredTick.y - TICK_PX - 4}\n w={labelWidth(hoveredTick.item.label)}\n text={hoveredTick.item.label}\n color={BUBBLE_KIND_COLORS[hoveredTick.item.kind]}\n testId=\"graph-bubble-tick-label\"\n />\n ) : null}\n </svg>\n )\n})\n\nexport default LabelLayer\n", "import { useEffect, useRef } from 'react'\n\nimport { drawReferenceStrip } from '@jbrowse/bandage-core/referenceStrip'\nimport { getDpr } from '@jbrowse/bandage-core/renderer/canvas'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 5,\n}\n\n// Each reference segment at its bp in the linear view, onto the pane's\n// canvas or the linear view's SVG export\nexport function paintReferenceStrip(\n ctx: CanvasRenderingContext2D,\n model: GraphPaneModel,\n {\n lit,\n dpr,\n }: { lit: GraphPaneModel['referenceStripLit'] | undefined; dpr: number },\n) {\n const frame = model.referenceStripFrame\n if (frame) {\n drawReferenceStrip(ctx, model.referenceStripBlocks, frame, {\n width: model.paneWidth,\n lit,\n darkMode: model.darkMode,\n dpr,\n })\n }\n}\n\n// Each reference segment at its bp in the linear view, over a drawing that\n// has no bp axis of its own. Repainted by an autorun, so a pan in the linear\n// view moves the strip in the same frame as its other tracks.\nconst ReferenceStripOverlay = observer(function ReferenceStripOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { referenceStripShown, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && model.referenceStripShown) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n paintReferenceStrip(ctx, model, {\n lit: model.referenceStripLit,\n dpr,\n })\n }\n }),\n [model],\n )\n return (\n <canvas\n ref={ref}\n data-testid={referenceStripShown ? 'graph-reference-strip' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: referenceStripShown ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default ReferenceStripOverlay\n", "import { useEffect, useRef } from 'react'\n\nimport { getDpr } from '@jbrowse/bandage-core/renderer/canvas'\nimport { drawTubeMapRuler } from '@jbrowse/bandage-core/tubeMap/axis'\nimport { drawTubeMapConnectors } from '@jbrowse/bandage-core/tubeMap/connectors'\nimport { drawDeviationMarks } from '@jbrowse/bandage-core/tubeMap/deviations'\nimport { drawTubeMap } from '@jbrowse/bandage-core/tubeMap/draw'\nimport { drawTubeMapGenes } from '@jbrowse/bandage-core/tubeMap/genes'\nimport { autorun } from 'mobx'\nimport { observer } from 'mobx-react'\n\nimport {\n PANEL_TITLE_FONT,\n drawBundleCounts,\n drawSqueezedLengths,\n} from '../tubeMapPanels'\n\n// variants folded into a box mark texture under a panel's routes\nconst PANEL_TICK_ALPHA = 0.45\n\nimport type { GraphPaneModel } from '../model'\n\nconst canvasStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n zIndex: 1,\n}\n\n// The tubes, their connectors, genes and ruler, onto a canvas sized to the\n// pane or onto the linear view's SVG export\nexport function paintTubeMap(\n ctx: CanvasRenderingContext2D,\n model: GraphPaneModel,\n { highlightNode }: { highlightNode: string | null },\n) {\n const picture = model.tubeMapPicture\n const frame = model.tubeMapFrame\n if (!picture || !frame) {\n return\n }\n const width = model.paneWidth\n const panels = model.tubeMapPanelViews\n if (panels) {\n paintPanels(ctx, model, panels, highlightNode)\n return\n }\n const tubeFrame = {\n ...frame,\n width,\n highlightNode,\n darkMode: model.darkMode,\n tubeColors: model.tubeMapTubeColors,\n nodeColors: model.tubeMapNodeColors,\n }\n drawTubeMap(ctx, picture, tubeFrame)\n const drawn = model.layoutResult?.tubeMap\n if (drawn) {\n drawBundleCounts(ctx, picture, drawn.graph, tubeFrame)\n drawSqueezedLengths(ctx, drawn, tubeFrame)\n }\n drawDeviationMarks(ctx, model.tubeMapDeviations, tubeFrame)\n drawTubeMapConnectors(\n ctx,\n model.tubeMapConnectors,\n model.connectorZoneBottom,\n tubeFrame,\n )\n const { bounds } = picture\n drawTubeMapGenes(ctx, model.tubeMapGenes, tubeFrame, frame.y(bounds.minY) - 2)\n const boxes = model.tubeMapRulerBoxes\n if (boxes) {\n drawTubeMapRuler(\n ctx,\n boxes,\n tubeFrame,\n frame.y(bounds.maxY) + 4,\n model.layoutResult?.referenceAxis,\n )\n }\n}\n\n// Each panel of a split tube map under a rule and its title, which the canvas\n// draws so a figure's SVG carries them\nfunction paintPanels(\n ctx: CanvasRenderingContext2D,\n model: GraphPaneModel,\n panels: NonNullable<GraphPaneModel['tubeMapPanelViews']>,\n highlightNode: string | null,\n) {\n const width = model.paneWidth\n const ink = model.darkMode ? '255,255,255' : '0,0,0'\n for (const p of panels) {\n if (p.bottom < 0 || p.titleTop > model.canvasHeight) {\n continue\n }\n const tubeFrame = {\n ...p.frame,\n width,\n highlightNode,\n darkMode: model.darkMode,\n tubeColors: p.tubeColors,\n nodeColors: p.nodeColors,\n }\n drawTubeMap(ctx, p.picture, tubeFrame)\n drawBundleCounts(ctx, p.picture, p.panel.result.tubeMap.graph, tubeFrame)\n drawSqueezedLengths(ctx, p.panel.result.tubeMap, tubeFrame)\n ctx.globalAlpha = PANEL_TICK_ALPHA\n drawDeviationMarks(ctx, p.deviations, tubeFrame)\n ctx.globalAlpha = 1\n ctx.strokeStyle = `rgba(${ink},0.15)`\n ctx.lineWidth = 1\n ctx.beginPath()\n ctx.moveTo(0, Math.round(p.titleTop) + 0.5)\n ctx.lineTo(width, Math.round(p.titleTop) + 0.5)\n ctx.stroke()\n ctx.font = PANEL_TITLE_FONT\n ctx.textAlign = 'left'\n ctx.textBaseline = 'top'\n ctx.fillStyle = `rgba(${ink},0.85)`\n ctx.fillText(p.label, 6, p.titleTop + 4)\n }\n const last = panels.at(-1)\n const boxes = model.tubeMapPanelRulerBoxes\n if (last && boxes) {\n drawTubeMapRuler(\n ctx,\n boxes,\n { ...last.frame, width, darkMode: model.darkMode },\n last.bottom + 4,\n true,\n )\n }\n}\n\n// The tube map's ink, over the canvas, which draws nothing under a tube map\n// layout. Above the tubes go the session's genes in a view of its own, or in\n// a linear view the bands tying each reference box to its bp there; under\n// them a reference ruler, unless the linear view's is already the axis.\n// Repainted by an autorun on every change of transform, so a pan in the linear\n// view above moves the tubes in the same frame as its other tracks.\nconst TubeMapOverlay = observer(function TubeMapOverlay({\n model,\n}: {\n model: GraphPaneModel\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { tubeMapPicture, paneWidth, canvasHeight } = model\n useEffect(\n () =>\n autorun(() => {\n const canvas = ref.current\n const ctx = canvas?.getContext('2d')\n if (canvas && ctx && model.tubeMapPicture && model.tubeMapFrame) {\n const dpr = getDpr()\n const width = model.paneWidth\n const height = model.canvasHeight\n canvas.width = Math.round(width * dpr)\n canvas.height = Math.round(height * dpr)\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, width, height)\n paintTubeMap(ctx, model, { highlightNode: model.selectedNode })\n }\n }),\n [model],\n )\n // Mounted whether or not there is a tube map, so the autorun above has its\n // canvas the moment a layout brings one.\n return (\n <canvas\n ref={ref}\n data-testid={tubeMapPicture ? 'graph-tube-map' : undefined}\n style={{\n ...canvasStyle,\n width: paneWidth,\n height: canvasHeight,\n display: tubeMapPicture ? 'block' : 'none',\n }}\n />\n )\n})\n\nexport default TubeMapOverlay\n", "const host = JBrowseExports[\"@jbrowse/render-core/marks\"]\nconst read = name =>\n host != null && name in Object(host)\n ? host[name]\n : Object.assign(\n function () {\n throw new Error(\n \"This JBrowse does not provide '\" + name + \"' from '\" + \"@jbrowse/render-core/marks\" + \"' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse\",\n )\n },\n { jbrowseHostMissing: name },\n )\nexport const HIDDEN_ROW = /* @__PURE__ */ read(\"HIDDEN_ROW\")\nexport const LINK_ELSEWHERE = /* @__PURE__ */ read(\"LINK_ELSEWHERE\")\nexport const LINK_NO_REGION = /* @__PURE__ */ read(\"LINK_NO_REGION\")\nexport const NO_ROW_COLOR = /* @__PURE__ */ read(\"NO_ROW_COLOR\")\nexport const RAMP_NOT_A_NUMBER_COLOR = /* @__PURE__ */ read(\"RAMP_NOT_A_NUMBER_COLOR\")\nexport const RAMP_NO_VALUE_BITS = /* @__PURE__ */ read(\"RAMP_NO_VALUE_BITS\")\nexport const RAMP_NO_VALUE_COLOR = /* @__PURE__ */ read(\"RAMP_NO_VALUE_COLOR\")\nexport const RowKeys = /* @__PURE__ */ read(\"RowKeys\")\nexport const abgrToCssRgba = /* @__PURE__ */ read(\"abgrToCssRgba\")\nexport const appendGlyph = /* @__PURE__ */ read(\"appendGlyph\")\nexport const backToFront = /* @__PURE__ */ read(\"backToFront\")\nexport const barMark = /* @__PURE__ */ read(\"barMark\")\nexport const buildRowTable = /* @__PURE__ */ read(\"buildRowTable\")\nexport const defineMark = /* @__PURE__ */ read(\"defineMark\")\nexport const ellipseDistance = /* @__PURE__ */ read(\"ellipseDistance\")\nexport const ellipseNearest = /* @__PURE__ */ read(\"ellipseNearest\")\nexport const inkOfInstances = /* @__PURE__ */ read(\"inkOfInstances\")\nexport const instanceColor = /* @__PURE__ */ read(\"instanceColor\")\nexport const isThreshold = /* @__PURE__ */ read(\"isThreshold\")\nexport const keepRampValues = /* @__PURE__ */ read(\"keepRampValues\")\nexport const keySlot = /* @__PURE__ */ read(\"keySlot\")\nexport const lineCenterMark = /* @__PURE__ */ read(\"lineCenterMark\")\nexport const lineMarkOf = /* @__PURE__ */ read(\"lineMarkOf\")\nexport const lineStepMark = /* @__PURE__ */ read(\"lineStepMark\")\nexport const linkFeet = /* @__PURE__ */ read(\"linkFeet\")\nexport const linkMark = /* @__PURE__ */ read(\"linkMark\")\nexport const makeAbgrFill = /* @__PURE__ */ read(\"makeAbgrFill\")\nexport const nearestMarkHit = /* @__PURE__ */ read(\"nearestMarkHit\")\nexport const paintColors = /* @__PURE__ */ read(\"paintColors\")\nexport const paintMarkBlocks = /* @__PURE__ */ read(\"paintMarkBlocks\")\nexport const planMarks = /* @__PURE__ */ read(\"planMarks\")\nexport const pointInsetPx = /* @__PURE__ */ read(\"pointInsetPx\")\nexport const pointMark = /* @__PURE__ */ read(\"pointMark\")\nexport const rampUniforms = /* @__PURE__ */ read(\"rampUniforms\")\nexport const rampValueBits = /* @__PURE__ */ read(\"rampValueBits\")\nexport const recordPath = /* @__PURE__ */ read(\"recordPath\")\nexport const rowColor = /* @__PURE__ */ read(\"rowColor\")\nexport const rowSlot = /* @__PURE__ */ read(\"rowSlot\")\nexport const rowSpanIndex = /* @__PURE__ */ read(\"rowSpanIndex\")\nexport const ruleMark = /* @__PURE__ */ read(\"ruleMark\")\nexport const shiftInk = /* @__PURE__ */ read(\"shiftInk\")\nexport const spanMark = /* @__PURE__ */ read(\"spanMark\")\nexport const spansInRow = /* @__PURE__ */ read(\"spansInRow\")\nexport const thresholdBandOf = /* @__PURE__ */ read(\"thresholdBandOf\")\nexport const valueWindow = /* @__PURE__ */ read(\"valueWindow\")\nexport const withPassId = /* @__PURE__ */ read(\"withPassId\")\nexport default host && host.__esModule ? host.default : host", "import {\n GAP_PX,\n coalesceRuns,\n runPaint,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport { spanMark } from '@jbrowse/render-core/marks'\n\nimport type { WalkRow, WalkRun } from '@jbrowse/bandage-core/layout/walkRows'\nimport type { MarkContext2D, SpanChannels } from '@jbrowse/render-core/marks'\n\ntype Rgb = [number, number, number]\n\nfunction hslRgb(h: number, s: number, l: number): Rgb {\n const a = s * Math.min(l, 1 - l)\n const f = (n: number) => {\n const k = (n + h / 30) % 12\n return 255 * (l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)))\n }\n return [f(0), f(8), f(4)]\n}\n\n// The colours runPaint writes: `#rrggbb`, `rgb(r, g, b)` and\n// `hsl(h, s%, l%)`\nexport function cssRgb(css: string): Rgb {\n if (css.startsWith('#')) {\n const v = Number.parseInt(css.slice(1), 16)\n return [(v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff]\n }\n const [a = 0, b = 0, c = 0] = css.match(/[\\d.]+/g)!.map(Number)\n return css.startsWith('hsl') ? hslRgb(a, b / 100, c / 100) : [a, b, c]\n}\n\nconst abgr = ([r, g, b]: Rgb) =>\n ((0xff << 24) |\n (Math.round(b) << 16) |\n (Math.round(g) << 8) |\n Math.round(r)) >>>\n 0\n\nconst cssAbgr = new Map<string, number>()\nfunction packCss(css: string) {\n let v = cssAbgr.get(css)\n if (v === undefined) {\n v = abgr(cssRgb(css))\n cssAbgr.set(css, v)\n }\n return v\n}\n\n/**\n * A run as the pieces it paints in, each `[start, end, abgr]` in bp along\n * the row: one for a solid fill, and for a gradient one per pixel or per\n * degree of hue, whichever is fewer, coloured as the SVG gradient through\n * the same stops colours its middle\n */\nexport function runPieces(\n run: WalkRun,\n ramp: { start: number; end: number } | undefined,\n pxPerBp: number,\n): [number, number, number][] {\n const end = run.start + run.bp\n const paint = runPaint(run, ramp)\n if ('fill' in paint) {\n return [[run.start, end, packCss(paint.fill)]]\n }\n const stops = paint.stops.map(cssRgb)\n const hues = paint.stops.map(css => Number(/[\\d.]+/.exec(css)![0]))\n const hueSpan = Math.abs(hues.at(-1)! - hues[0]!)\n const n = Math.max(\n 1,\n Math.min(Math.ceil(run.bp * pxPerBp), Math.ceil(hueSpan), run.bp),\n )\n const pieces: [number, number, number][] = []\n for (let k = 0; k < n; k++) {\n const t = ((k + 0.5) / n) * (stops.length - 1)\n const i = Math.min(Math.floor(t), stops.length - 2)\n const a = stops[i]!\n const b = stops[i + 1]!\n const f = t - i\n pieces.push([\n Math.round(run.start + (run.bp * k) / n),\n Math.round(run.start + (run.bp * (k + 1)) / n),\n abgr([0, 1, 2].map(j => a[j]! + (b[j]! - a[j]!) * f) as Rgb),\n ])\n }\n return pieces\n}\n\nexport interface WalkRowSpans {\n bars: SpanChannels & { color: Uint32Array }\n gaps: SpanChannels & { color: Uint32Array }\n // where each drawn row's spans start in `bars` and `gaps`\n barRows: Uint32Array\n gapRows: Uint32Array\n}\n\nfunction channels(capacity: number) {\n return {\n x: new Uint32Array(capacity),\n x2: new Uint32Array(capacity),\n row: new Uint32Array(capacity),\n color: new Uint32Array(capacity),\n count: 0,\n }\n}\n\nfunction trim(c: ReturnType<typeof channels>) {\n const n = c.count\n return {\n x: c.x.subarray(0, n),\n x2: c.x2.subarray(0, n),\n row: c.row.subarray(0, n),\n color: c.color.subarray(0, n),\n count: n,\n }\n}\n\n/**\n * Each row's runs as `walkRowsTree` coalesces and colours them at\n * `pxPerBp`, as span channels: `x`/`x2` in bp along the row, `row` its index\n * among `rows`. Gaps go apart, since they draw thinner.\n */\nexport function walkRowSpans(\n rows: WalkRow[],\n pxPerBp: number,\n ramp?: { start: number; end: number },\n): WalkRowSpans {\n const pieces = rows.map(r =>\n coalesceRuns(r.runs, pxPerBp).map(run => ({\n gap: run.gap,\n pieces: runPieces(run, ramp, pxPerBp),\n })),\n )\n let total = 0\n for (const runs of pieces) {\n for (const run of runs) {\n total += run.pieces.length\n }\n }\n const bars = channels(total)\n const gaps = channels(total)\n const barRows = new Uint32Array(rows.length + 1)\n const gapRows = new Uint32Array(rows.length + 1)\n pieces.forEach((runs, row) => {\n for (const run of runs) {\n const c = run.gap ? gaps : bars\n for (const [x, x2, color] of run.pieces) {\n const i = c.count++\n c.x[i] = x\n c.x2[i] = x2\n c.row[i] = row\n c.color[i] = color\n }\n }\n barRows[row + 1] = bars.count\n gapRows[row + 1] = gaps.count\n })\n return { bars: trim(bars), gaps: trim(gaps), barRows, gapRows }\n}\n\nfunction slice<T extends SpanChannels & { color: Uint32Array }>(\n c: T,\n a: number,\n b: number,\n) {\n return {\n x: c.x.subarray(a, b),\n x2: c.x2.subarray(a, b),\n row: c.row.subarray(a, b),\n color: c.color.subarray(a, b),\n count: b - a,\n }\n}\n\nexport interface WalkRowSpanFrame {\n scaleX: number\n scaleY: number\n translateX: number\n translateY: number\n width: number\n height: number\n rowPx: number\n barPx: number\n origin: number\n // runs of rows whose y is `rowY(first)` plus a row pitch each, as the\n // reference row and each grouped section are\n blocks: { first: number; count: number; rowY: number }[]\n}\n\n/**\n * Paints the spans through render-core's span mark, a block of rows at a\n * time: row i's bar centred where `walkRowsTree` centres it, `barPx` tall,\n * its x at `origin + bp` through the pane's transform.\n */\nexport function paintWalkRowSpans(\n ctx: MarkContext2D,\n spans: WalkRowSpans,\n f: WalkRowSpanFrame,\n) {\n let longest = 1\n for (const c of [spans.bars, spans.gaps]) {\n for (const x2 of c.x2) {\n longest = Math.max(longest, x2)\n }\n }\n const block = {\n start: 0,\n end: longest,\n screenStartPx: f.origin * f.scaleX + f.translateX,\n screenEndPx: (f.origin + longest) * f.scaleX + f.translateX,\n reversed: false,\n displayedRegionIndex: 0,\n }\n const frame = { canvasWidth: f.width, canvasHeight: f.height }\n const rowHeight = f.rowPx * f.scaleY\n for (const { first, count, rowY } of f.blocks) {\n // slot `row` centres at (rowY + (row - first) * rowPx) * scaleY + translateY\n const scrollTop =\n rowHeight / 2 - f.translateY - (rowY - first * f.rowPx) * f.scaleY\n const top = (rowY - f.rowPx / 2) * f.scaleY + f.translateY\n if (top > f.height || top + count * rowHeight < 0) {\n continue\n }\n for (const [c, starts, barPx] of [\n [spans.bars, spans.barRows, f.barPx],\n [spans.gaps, spans.gapRows, Math.min(GAP_PX, f.barPx)],\n ] as const) {\n spanMark.paintBlock(\n ctx,\n slice(c, starts[first]!, starts[first + count]!),\n block,\n frame,\n {\n rowHeight,\n rowProportion: barPx / rowHeight,\n minWidthPx: 1,\n seamPx: 0,\n scrollTop,\n },\n )\n }\n }\n}\n", "import { useEffect, useId, useMemo, useRef } from 'react'\n\nimport { walkRowsTree } from '@jbrowse/bandage-core/layout/walkRowDraw'\nimport { observer } from 'mobx-react'\n\nimport ElTree from './ElTree'\nimport { SECTION_HEADER_PX } from '../walkRowGroups'\nimport { paintWalkRowSpans, walkRowSpans } from '../walkRowSpans'\n\nimport type { GraphPaneModel } from '../model'\nimport type { WalkRowSection } from '../walkRowGroups'\nimport type { El } from '@jbrowse/bandage-core/el'\nimport type {\n WalkRowsFrame,\n WalkRowsWithCalls,\n} from '@jbrowse/bandage-core/layout/walkRowDraw'\n\n// The walk-rows layout's bars: one per haplotype walk under the reference\n// row, each on its own bp axis from the window's left edge. The runs paint as\n// spans on a canvas, coloured by whether they are on the reference walk's\n// path, and core's walkRowsTree draws the rest: unit separators, each row's\n// genes from its own assembly's annotation, the allele a repeat genotype\n// called and a readout. Under the\n// reference-position ramp an aligned run takes the hue of the reference it is\n// threaded through. In a tandem array that is the aligner's pick among\n// near-identical copies, so the hue says which reference copy the graph used,\n// not which one a copy resembles.\n//\n// The walk rows pair a repeat record's allele with each walk \u2014 see\n// repeats/walkCalls.ts, which also holds the threshold a red readout is read\n// off. Colouring each copy by its unit is jbrowse-plugin-tandem-repeat's.\n\nconst svgStyle = {\n position: 'absolute' as const,\n left: 0,\n top: 0,\n pointerEvents: 'none' as const,\n overflow: 'visible' as const,\n zIndex: 3,\n}\n\n// The rows' trees, a section at a time while grouped. walkRowsTree puts its\n// i-th row at i * rowPx below its reference row and draws that row too, so\n// each section is drawn shifted down to its place with its reference row\n// dropped.\nexport function walkRowTrees(\n bars: WalkRowsWithCalls,\n sections: WalkRowSection[],\n rowY: (i: number) => number,\n frame: WalkRowsFrame & { rowPx: number },\n o: Parameters<typeof walkRowsTree>[2] & { idPrefix: string },\n): El[] {\n if (sections.length === 0) {\n return [walkRowsTree(bars, frame, o)]\n }\n return [\n walkRowsTree({ ...bars, rows: [] }, frame, o),\n ...sections.flatMap((section, k) => {\n const tree = walkRowsTree(\n {\n ...bars,\n rows: bars.rows.slice(\n section.first - 1,\n section.first - 1 + section.count,\n ),\n },\n {\n ...frame,\n translateY:\n frame.translateY +\n (rowY(section.first) - frame.rowPx) * frame.scaleY,\n },\n { ...o, idPrefix: `${o.idPrefix}-s${k}` },\n )\n return tree.children.filter(\n (c): c is El =>\n typeof c !== 'string' &&\n c.attrs['data-testid'] !== 'graph-walk-reference',\n )\n }),\n ]\n}\n\nconst canvasStyle = { ...svgStyle, overflow: undefined }\n\nconst WalkRowSpansCanvas = observer(function WalkRowSpansCanvas({\n model,\n rows,\n origin,\n}: {\n model: GraphPaneModel\n rows: WalkRowsWithCalls['rows']\n origin: number\n}) {\n const ref = useRef<HTMLCanvasElement>(null)\n const { scaleX, scaleY, translateX, translateY, paneWidth, canvasHeight } =\n model\n const place = model.walkRowPlacement\n const pitch = model.walkRowPitch\n const sections = model.walkRowGroups?.sections\n const ramp = model.referenceRampDomain\n const spans = useMemo(\n () => walkRowSpans(rows, scaleX, ramp),\n [rows, scaleX, ramp],\n )\n useEffect(() => {\n const canvas = ref.current\n const ctx = canvas?.getContext('2d')\n if (!canvas || !ctx || !place || !pitch) {\n return\n }\n const dpr = window.devicePixelRatio || 1\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0)\n ctx.clearRect(0, 0, paneWidth, canvasHeight)\n const blocks = sections?.length\n ? [\n { first: 0, count: 1, rowY: place.rowY(0) },\n ...sections.map(s => ({\n first: s.first,\n count: s.count,\n rowY: place.rowY(s.first),\n })),\n ]\n : [{ first: 0, count: rows.length, rowY: place.rowY(0) }]\n paintWalkRowSpans(ctx, spans, {\n scaleX,\n scaleY,\n translateX,\n translateY,\n width: paneWidth,\n height: canvasHeight,\n rowPx: pitch.rowPx,\n barPx: pitch.barPx,\n origin,\n blocks,\n })\n }, [\n spans,\n rows.length,\n origin,\n place,\n pitch,\n sections,\n scaleX,\n scaleY,\n translateX,\n translateY,\n paneWidth,\n canvasHeight,\n ])\n const dpr = typeof window === 'undefined' ? 1 : window.devicePixelRatio || 1\n return (\n <canvas\n ref={ref}\n data-testid=\"graph-walk-rows-spans\"\n width={Math.round(paneWidth * dpr)}\n height={Math.round(canvasHeight * dpr)}\n style={{ ...canvasStyle, width: paneWidth, height: canvasHeight }}\n />\n )\n})\n\n// `vector` for an SVG export, which draws the bars as walkRowsTree's rects\nconst WalkRowsOverlay = observer(function WalkRowsOverlay({\n model,\n vector = false,\n}: {\n model: GraphPaneModel\n vector?: boolean\n}) {\n const idPrefix = useId().replace(/[^\\w-]/g, '')\n const bars = model.walkRowBars\n const place = model.walkRowPlacement\n const pitch = model.walkRowPitch\n const drawn = useMemo(\n () =>\n bars && {\n all: [bars.reference, ...bars.rows],\n bare: {\n ...bars,\n reference: { ...bars.reference, runs: [] },\n rows: bars.rows.map(r => ({ ...r, runs: [] })),\n },\n },\n [bars],\n )\n if (!bars || !drawn || !place || !pitch) {\n return null\n }\n const { paneWidth: width, canvasHeight } = model\n const Y = (y: number) => y * model.scaleY + model.translateY\n const hovered = model.hoveredWalkRowText\n ? [bars.reference, ...bars.rows].findIndex(\n r => r.name === model.hoveredWalkRow,\n )\n : -1\n const row =\n hovered >= 0 ? [bars.reference, ...bars.rows][hovered]! : undefined\n const frame = {\n scaleX: model.scaleX,\n scaleY: model.scaleY,\n translateX: model.translateX,\n translateY: model.translateY,\n width,\n height: canvasHeight,\n ...pitch,\n }\n return (\n <>\n {vector ? null : (\n <WalkRowSpansCanvas\n model={model}\n rows={drawn.all}\n origin={bars.origin}\n />\n )}\n <svg\n style={svgStyle}\n width={width}\n height={canvasHeight}\n data-testid=\"graph-walk-rows\"\n >\n {walkRowTrees(\n vector ? bars : drawn.bare,\n model.walkRowGroups?.sections ?? [],\n place.rowY,\n frame,\n {\n ramp: model.referenceRampDomain,\n rowGenes: model.walkRowGenes,\n idPrefix,\n },\n ).map((tree, i) => (\n <ElTree key={i} el={tree} />\n ))}\n {place.headers.map(header => (\n <text\n key={header.key}\n x={10}\n y={Y(header.top) + SECTION_HEADER_PX - 4}\n fontFamily=\"sans-serif\"\n fontSize={11}\n fontWeight=\"bold\"\n fill=\"#333\"\n data-testid=\"graph-walk-section\"\n >\n {header.title}\n </text>\n ))}\n {row ? (\n <rect\n data-testid=\"graph-walk-row-hovered\"\n x={bars.origin * model.scaleX + model.translateX - 2}\n y={Y(place.rowY(hovered)) - pitch.rowPx / 2 - 1}\n width={row.bp * model.scaleX + 4}\n height={pitch.rowPx + 2}\n fill=\"none\"\n stroke=\"#111\"\n strokeWidth={1}\n />\n ) : null}\n </svg>\n </>\n )\n})\n\nexport default WalkRowsOverlay\n"],
|
|
5
|
-
"mappings": "yoBAaA,IAAMA,GAAW,CACf,SAAU,WACV,KAAM,EACN,IAAK,EACL,cAAe,OACf,SAAU,SACV,OAAQ,CACV,EAEMC,GAAcC,EAAS,SAAqB,CAChD,MAAAC,CACF,EAEG,CACD,GAAM,CAAE,YAAAC,EAAa,cAAAC,CAAc,EAAIF,EACvC,GAAIC,EAAY,SAAW,EACzB,OAAO,KAET,GAAM,CACJ,OAAAE,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,UAAWC,EACX,aAAAC,CACF,EAAIR,EACES,EAAOT,EAAM,gBAAkBU,GACrC,OACEC,EAAC,OACC,MAAOd,GACP,MAAOU,EACP,OAAQC,EACR,cAAY,qBAEZ,SAAAG,EAAC,KACC,UAAW,aAAaN,CAAU,IAAIC,CAAU,WAAWH,CAAM,IAAIC,CAAM,IAE1E,SAAAH,EACE,OACCW,GACE,CAACA,EAAE,QACF,CAACA,EAAE,MACDV,GAAiBW,EAAWD,EAAE,OAAQV,CAAa,EAC1D,EACC,IAAIU,GACHD,EAAC,QAEC,EAAGC,EAAE,KACL,KAAK,OACL,OAAQE,EAAmBF,EAAE,I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M,OAAS,EAC/B,OAAQY,EAAM,MAAQ,EACtB,KAAK,OACL,OAAO,OACP,YAAa,EACf,EACE,MACN,GACF,CAEJ,CAAC,EAEM+B,GAAQlB",
|
|
6
|
-
"names": ["svgStyle", "BubbleHalos", "observer", "model", "bubbleHalos", "hoveredBubble", "scaleX", "scaleY", "translateX", "translateY", "width", "canvasHeight", "halo", "HALO_FACTOR", "jsx", "h", "sameBubble", "BUBBLE_KIND_COLORS", "bubbleKey", "BubbleHalos_default", "SWATCH_PX", "BAR_PX", "UNPLACED_SWATCH", "STRIP_SAMPLES", "TUBE_SWATCH_PX", "FOLD_TICK_BACKING", "WALK_ROW_SWATCH_PX", "swatchWidth", "swatch", "flat", "color", "fillRow", "key", "label", "width", "bandStops", "colors", "i", "haloKeyEntries", "model", "kindsByColor", "h", "BUBBLE_KIND_COLORS", "kinds", "BUBBLE_KIND_NAMES", "names", "openBubbleRows", "open", "halo", "sameBubble", "rampRows", "domain", "start", "end", "offReference", "unplaced", "formatBp", "RAMP_GRADIENT_STOPS", "REFERENCE_RAMP_ALT_CSS", "stripBands", "lift", "w", "encodingStops", "b", "c", "all", "n", "LIFT_BACKDROP_CSS", "_", "stripRows", "rowPerWalk", "haloRows", "geneRows", "pin", "EXON_COLOR", "foldRows", "note", "pathRows", "name", "tubeRow", "tubeMapRows", "roles", "haplotypeTube", "bundled", "values", "logWidths", "foldBp", "forwardReads", "reverseReads", "substitution", "insertion", "deletion", "reads", "rows", "PANEL_REFERENCE_TUBE", "value", "readRow", "FORWARD_READ_COLORS", "REVERSE_READ_COLORS", "deviationInk", "walkRowSwatch", "GENE_INK", "GAP_PX", "walkRowsRows", "bars", "calls", "row", "tick", "walkRowsKey", "entry", "call", "CALL_TICK", "UNBACKED_TICK", "DISAGREES", "walkKeyRow", "walk", "walkKey", "walkReadoutRows", "legendSections", "section", "propName", "name", "_", "c", "toReact", "node", "key", "props", "value", "createElement", "ElTree", "el", "svgStyle", "GenePins", "observer", "model", "id", "useId", "genePins", "walkLift", "nodeInk", "scaleX", "scaleY", "translateX", "translateY", "paneWidth", "canvasHeight", "focus", "pins", "pin", "e", "tree", "exonOutlineTree", "exonStretches", "jsx", "ElTree", "GenePins_default", "LabelChip", "x", "y", "w", "text", "note", "color", "edge", "italic", "small", "dimmed", "title", "testId", "onClick", "onHover", "jsxs", "jsx", "LABEL_PX", "LABEL_PAD", "svgStyle", "GENE_INK", "TICK_PX", "TICK_WIDTH", "LabelLayer", "observer", "model", "bubbles", "genes", "routes", "ticks", "walkLift", "scaleY", "translateY", "contigThickness", "hoveredBubble", "hoveredTick", "t", "sameBubble", "tickAt", "target", "dimmedBubble", "h", "isOpen", "dimmedRoute", "r", "jsxs", "jsx", "e", "tick", "isAlive", "x", "y", "i", "BUBBLE_KIND_COLORS", "bubbleKey", "pin", "w", "text", "gene", "note", "geneCoverageNote", "LABEL_PX", "LabelChip", "EXON_COLOR", "route", "hovered", "labelWidth", "LabelLayer_default", "canvasStyle", "paintReferenceStrip", "ctx", "model", "lit", "dpr", "frame", "drawReferenceStrip", "ReferenceStripOverlay", "observer", "ref", "useRef", "referenceStripShown", "paneWidth", "canvasHeight", "useEffect", "autorun", "canvas", "getDpr", "width", "height", "jsx", "ReferenceStripOverlay_default", "PANEL_TICK_ALPHA", "canvasStyle", "paintTubeMap", "ctx", "model", "highlightNode", "picture", "frame", "width", "panels", "paintPanels", "tubeFrame", "drawTubeMap", "drawn", "drawBundleCounts", "drawSqueezedLengths", "drawDeviationMarks", "drawTubeMapConnectors", "bounds", "drawTubeMapGenes", "boxes", "drawTubeMapRuler", "ink", "p", "PANEL_TITLE_FONT", "last", "TubeMapOverlay", "observer", "ref", "useRef", "tubeMapPicture", "paneWidth", "canvasHeight", "useEffect", "autorun", "canvas", "dpr", "getDpr", "height", "jsx", "TubeMapOverlay_default", "host", "read", "name", "spanMark", "read", "marks_default", "host", "hslRgb", "h", "s", "l", "a", "f", "n", "k", "cssRgb", "css", "v", "b", "c", "abgr", "r", "g", "cssAbgr", "packCss", "runPieces", "run", "ramp", "pxPerBp", "end", "paint", "runPaint", "stops", "hues", "hueSpan", "pieces", "t", "i", "j", "channels", "capacity", "trim", "walkRowSpans", "rows", "coalesceRuns", "total", "runs", "bars", "gaps", "barRows", "gapRows", "row", "x", "x2", "color", "slice", "paintWalkRowSpans", "ctx", "spans", "longest", "block", "frame", "rowHeight", "first", "count", "rowY", "scrollTop", "top", "starts", "barPx", "GAP_PX", "spanMark", "svgStyle", "walkRowTrees", "bars", "sections", "rowY", "frame", "o", "walkRowsTree", "section", "k", "c", "canvasStyle", "WalkRowSpansCanvas", "observer", "model", "rows", "origin", "ref", "useRef", "scaleX", "scaleY", "translateX", "translateY", "paneWidth", "canvasHeight", "place", "pitch", "ramp", "spans", "useMemo", "walkRowSpans", "useEffect", "canvas", "ctx", "dpr", "blocks", "s", "paintWalkRowSpans", "jsx", "WalkRowsOverlay", "vector", "idPrefix", "useId", "drawn", "r", "width", "Y", "y", "hovered", "row", "jsxs", "Fragment", "tree", "i", "ElTree", "header", "SECTION_HEADER_PX", "WalkRowsOverlay_default"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var Q=JBrowseExports["@jbrowse/core/configuration"],ot=e=>Q!=null&&e in Object(Q)?Q[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/core/configuration' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e}),_n=ot("ConfigurationReference"),Cn=ot("ConfigurationSchema");var In=ot("expandTabixShorthand");var On=ot("getConf");var Fn=ot("readConfObject");var Rn=ot("setConf");var Bn=Q&&Q.__esModule?Q.default:Q;var dt;function kt(){return dt??=import("./bandage-layout-3AR6BCUD-SOXMX65M.js").then(e=>e.default()).catch(e=>{throw dt=void 0,e}),dt}var Ut="\0deletion:";var Pt=25*Math.PI/180,Tt=.25,_t=150,en=[0,-.35,.35,-.7,.7,-1.05,1.05,-1.4,1.4],xt=[0,1];function Ct(e){return e?0:1}function ht(e,t){let n=t.x-e.x,o=t.y-e.y,s=Math.hypot(n,o)||1;return{x:n/s,y:o/s}}function yt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Dt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Gt(e){let t=new Float64Array(e.length);for(let n=1;n<e.length;n++)t[n]=t[n-1]+Math.hypot(e[n].x-e[n-1].x,e[n].y-e[n-1].y);return t}function Ht(e){var t;return(t=Gt(e)[e.length-1])!==null&&t!==void 0?t:0}var lt=new Map;function sn(e){let t=lt.get(e);if(t!==void 0)return t;let n=rn(e);return lt.size>1e4&<.clear(),lt.set(e,n),n}function rn(e){let t=1e-6,n=2*Math.PI-1e-6;for(let o=0;o<60;o++){let s=(t+n)/2;s/(2*Math.sin(s/2))<e?t=s:n=s}return(t+n)/2}function an(e,t){if(e<1e-9)return Math.PI*t;let n=(e*e/4+t*t)/(2*t),o=2*Math.asin(Math.min(1,e/(2*n)));return n*(t>n?2*Math.PI-o:o)}function gt(e,t,n,o){let s=t-2*n,i=e<1e-9?2*Math.PI:sn(s/e),r=s/i,l=Math.cos(i/2),p=e/2,c=o+n-r*l;return{at:a=>{if(a<=n)return{u:0,v:o+a};if(a>=t-n)return{u:e,v:o+t-a};let f=(a-n)/r-i/2;return{u:p+r*Math.sin(f),v:c+r*Math.cos(f)}},apex:o+n+r*(1-l),length:t}}function It(e,t,n){if(!n)return e;let o=Math.cos(n),s=Math.sin(n);return{...e,at:i=>{let{u:r,v:l}=e.at(i),p=r-t/2;return{u:t/2+p*o-l*s,v:p*s+l*o}}}}function cn(e){for(let t=0;t<=32;t++)if(e.at(e.length*t/32).v<-1e-6)return!0;return!1}function Ot(e,t,n,o,s){return{at:i=>({u:e+n*i,v:t+o*i}),apex:t+Math.max(0,o)*s,length:s}}var rt=class{constructor(t,n,o=!1){var s;this.pts=t,this.normals=n,this.straight=o,this.arc=Gt(t),this.total=(s=this.arc[t.length-1])!==null&&s!==void 0?s:0}segment(t){let{arc:n}=this,o=1,s=n.length-1;for(;o<s;){let i=o+s>>1;n[i]<t?o=i+1:s=i}return o}fraction(t,n){let o=this.arc[t]-this.arc[t-1];return o>0?(n-this.arc[t-1])/o:0}pointAt(t){let{pts:n}=this,o=n.length-1;if(o===0)return{...n[0]};if(t<=0){let i=ht(n[0],n[1]);return{x:n[0].x+i.x*t,y:n[0].y+i.y*t}}if(t>=this.total){let i=ht(n[o-1],n[o]),r=t-this.total;return{x:n[o].x+i.x*r,y:n[o].y+i.y*r}}let s=this.segment(t);return yt(n[s-1],n[s],this.fraction(s,t))}normalAt(t){let{normals:n}=this;if(n.length===1||t<=0)return n[0];if(t>=this.total)return n[n.length-1];let o=this.segment(t),{x:s,y:i}=yt(n[o-1],n[o],this.fraction(o,t)),r=Math.hypot(s,i)||1;return{x:s/r,y:i/r}}};function ln(e,t){let n=Dt(e);return e.map((o,s)=>{let i=ht(e[Math.max(0,s-1)],e[Math.min(e.length-1,s+1)]),r={x:-i.y,y:i.x},l=o.x-n.x,p=o.y-n.y,c=Math.hypot(l,p),a=r.x*l+r.y*p,f=t[s],h=c>1e-9&&Math.abs(a)>.3*c?Math.sign(a):Math.sign(r.x*f.x+r.y*f.y)||1;return{x:r.x*h,y:r.y*h}})}function Mt(e,t,n,o,s){let i=Math.min(s,Math.max(o.length/24,.5)),r=[],l=[];for(let p=0;p<=o.length+1e-9;p+=i){let{u:c,v:a}=o.at(Math.min(p,o.length)),f=e.pointAt(t+c),h=e.normalAt(t+c),u=h.x*n,m=h.y*n;r.push({x:f.x+u*a,y:f.y+m*a}),l.push({x:u,y:m})}return{pts:r,refs:l}}var Ft=5,fn=10.5/2;function mt(e,t,n,o,s,i){let r=s,l=Mt(e,t,n,o(r),i);if(e.straight)return l;for(let p=0;p<6;p++){let c=Ht(l.pts);if(!(c>0)||Math.abs(c/s-1)<.001)break;r*=s/c,l=Mt(e,t,n,o(r),i)}return l}function ft(e,t){return Array.from({length:t},(n,o)=>e+o*15/2)}function Rt(e){if(e.length===0)return 1/0;let t=1/0,n=-1/0;for(let o of e)t=Math.min(t,o.point.x),n=Math.max(n,o.point.x);return n-t}function Bt(e,t){return e*73856093^t*19349663}var ut=class{constructor(t){this.c=t,this.grid=new Map;let{ids:n,first:o,count:s,per:i,seedX:r,seedY:l,backbone:p}=t,c=n.length;this.points=Array.from({length:c},()=>{}),this.params=Array.from({length:c},()=>{}),this.curves=Array.from({length:c},()=>{}),this.links=t.links.map((h,u)=>h.map(m=>m.filter(([M])=>M!==u))),this.route=n.map(h=>h.startsWith(Ut));let a=1/0,f=-1/0;for(let h=0;h<c;h++){let u=o[h];!p[u]||Number.isNaN(r[u])||(a=Math.min(a,r[u]),f=Math.max(f,r[u]+i[h]*(s[h]-1)))}this.backbone=new rt([{x:a,y:0},{x:f,y:0}],[{x:0,y:1},{x:0,y:1}],!0),this.backboneCentroid={x:(a+f)/2,y:0};for(let h=0;h<c;h++){let u=o[h];if(!p[u]||Number.isNaN(r[u]))continue;let m=[],M=[];for(let N=0;N<s[h];N++){let D=r[u]+N*i[h];m.push({x:D,y:l[u]}),M.push(D-a)}this.points[h]=m,this.params[h]=M,this.curves[h]=this.backbone,this.occupy(m,this.backbone)}}static hasBackbone(t){for(let n=0;n<t.ids.length;n++){let o=t.first[n];if(t.backbone[o]&&!Number.isNaN(t.seedX[o]))return!0}return!1}run(){let t=[];for(let o=0;o<this.points.length;o++)this.points[o]||t.push(o);let n=this.componentsOf(t).map(o=>({members:o,anchors:this.anchorsOf(o)})).filter(o=>o.anchors.length).map(o=>({members:o.members,span:Rt(o.anchors),drawn:o.members.reduce((s,i)=>s+this.drawn(i),0),feet:o.anchors.map(s=>`${s.point.x},${s.point.y}`).sort().join(" ")})).sort((o,s)=>o.span-s.span||(o.feet===s.feet?s.drawn-o.drawn:o.drawn-s.drawn));for(let o of n)this.placePiece(o.members,this.backboneCentroid)}write(t,n){let{first:o}=this.c;this.points.forEach((s,i)=>{s?.forEach((r,l)=>{t[o[i]+l]=r.x,n[o[i]+l]=r.y})})}drawn(t){return this.c.per[t]*(this.c.count[t]-1)}endIndex(t,n){return n?this.c.count[t]-1:0}occupy(t,n){for(let o of t){let s=Bt(Math.floor(o.x/10.5),Math.floor(o.y/10.5)),i=this.grid.get(s),r={x:o.x,y:o.y,curve:n};i?i.push(r):this.grid.set(s,[r])}}violations(t,n,o,s){var i;let r=0;for(let l of t){if(o.some(a=>Math.hypot(l.x-a.x,l.y-a.y)<15))continue;let p=Math.floor(l.x/10.5),c=Math.floor(l.y/10.5);for(let a=p-1;a<=p+1;a++)for(let f=c-1;f<=c+1;f++)for(let h of(i=this.grid.get(Bt(a,f)))!==null&&i!==void 0?i:[])if(h.curve!==n&&Math.hypot(l.x-h.x,l.y-h.y)<10.5&&(r++,r>=s))return r}return r}choose(t,n,o){let s,i=1/0;for(let r of t){let l=this.violations(r(fn).pts,n,o,i);if(l===0)return r(Ft);l<i&&(i=l,s=r)}return s(Ft)}anchorsOf(t){let n=new Set(t),o=[];for(let s of t)for(let i of xt)for(let[r,l]of this.links[s][i]){let p=this.points[r];if(n.has(r)||!p)continue;let c=this.endIndex(r,l);o.push({u:s,uSide:i,v:r,vSide:l,point:p[c],curve:this.curves[r],t:this.params[r][c]})}return o}componentsOf(t){let n=new Set(t),o=new Set,s=[];for(let i of t){if(o.has(i))continue;let r=[i];o.add(i);for(let l of r)for(let p of xt)for(let[c]of this.links[l][p])n.has(c)&&!o.has(c)&&(o.add(c),r.push(c));s.push(r)}return s}spinePath(t,n,o,s,i){let r=new Set(t),l=(u,m)=>u*2+m,p=(u,m)=>u===s&&Ct(m)===i,c=new Map([[l(n,o),-1]]),a=[[n,o]],f=[n,o];for(let[u,m]of a){if(f=[u,m],s!==void 0&&p(u,m))break;for(let[M,N]of this.links[u][Ct(m)])!r.has(M)||c.has(l(M,N))||(c.set(l(M,N),l(u,m)),a.push([M,N]))}if(s!==void 0&&!p(f[0],f[1]))return;let h=[];for(let u=l(f[0],f[1]);u!==-1;u=c.get(u))h.push({k:u>>1,enter:u&1});return h.reverse()}loosePath(t,n,o){let s=new Set(t),i=new Map([[n,-1]]),r=new Map([[n,0]]),l=[n];for(let c of l){if(c===o)break;for(let a of xt)for(let[f,h]of this.links[c][a])!s.has(f)||i.has(f)||(i.set(f,c),r.set(f,h),l.push(f))}let p=[];for(let c=o;c!==-1;c=i.get(c))p.push({k:c,enter:r.get(c)});return p.reverse()}spineLength(t){let{link:n}=this.c;return t.reduce((o,{k:s})=>o+this.drawn(s)+n,n)}layAlong(t,n,o,s){let{count:i,per:r,link:l}=this.c,p=o,c=[];for(let{k:a,enter:f}of t){let h=s??r[a],u=[],m=[];for(let M=0;M<i[a];M++)u.push(n.pointAt(p+M*h)),m.push(p+M*h);f===1&&(u.reverse(),m.reverse()),this.points[a]=u,this.params[a]=m,this.curves[a]=n,c.push(...u),p+=h*(i[a]-1)+l}return c}arcCandidates(t,n,o,s,i){let r=(i-s)/2-1e-6,l=i>2*s?en:[0],p=[];for(let c of ft(0,8))for(let a of l)for(let f=0;f<=16;f++){let h=r*f/16,u=It(gt(s,i,h,c),s,a);f<16&&u.apex<12||cn(u)||p.push(m=>mt(t,n,o,M=>It(gt(s,M,Math.min(h,(M-s)/2-1e-6),c),s,a),i,m))}return p}placePiece(t,n){var o;let{count:s,link:i}=this.c,r=this.anchorsOf(t);if(r.length===0)return;let l=t.every(y=>this.route[y]),p=r.every(y=>y.curve===r[0].curve)?r[0].curve:void 0,c,a,f,h;if(p)r.sort((y,O)=>y.t-O.t),c=p,a=r[0].t,f=r[r.length-1].t,h=c===this.backbone&&l?-1:1;else{r.sort((W,Z)=>W.point.x-Z.point.x||W.point.y-Z.point.y);let y=r[0].point,O=r[r.length-1].point,V=Math.hypot(O.x-y.x,O.y-y.y),R=V>1e-9?ht(y,O):{x:1,y:0},B={x:-R.y,y:R.x},G=yt(y,O,.5);h=r.some(W=>W.curve===this.backbone)?(l?-1:1)*(Math.sign(B.y)||1):(G.x-n.x)*B.x+(G.y-n.y)*B.y>=0?1:-1,c=new rt([y,O],[B,B],!0),a=0,f=V}let u=r[0],m=r[r.length-1],M=f-a,N=r.length===1||u.u===m.u&&u.uSide===m.uSide&&M<1e-9,D=[u.point,m.point],A=y=>this.choose(y,p,D),S,g,L=i,w;if(N){S=this.spinePath(t,u.u,u.uSide);let y=this.spineLength(S),O=u.vSide?Math.max(0,s[u.v]-2):Math.min(1,s[u.v]-1),R=(u.t>=this.params[u.v][O]?1:-1)*Math.cos(Pt),B=Math.sin(Pt);g=A(ft(0,12).map(G=>W=>mt(c,a,h,Z=>Ot(0,G,R,B,Z),y,W)))}else{S=(o=this.spinePath(t,u.u,u.uSide,m.u,m.uSide))!==null&&o!==void 0?o:this.loosePath(t,u.u,m.u);let y=this.spineLength(S);if(l){let O=Math.max(12,Math.min(Tt*M,_t));g=A(ft(O,12).map(R=>B=>Mt(c,a,h,gt(M,an(M,R),0,0),B)));let V=Ht(g.pts);w=Math.max(.001,(V-2*i)/(s[S[0].k]-1))}else if(y>M+1e-6)g=A(this.arcCandidates(c,a,h,M,y));else{let O=y-2*i,V=Math.max(12,Math.min(Tt*(M-O),_t));g=A(ft(V,12).map(R=>B=>mt(c,a,h,G=>Ot(M/2-G/2,R,1,0,G),O,B))),L=0}}let v=new rt(g.pts,ln(g.pts,g.refs)),C=this.layAlong(S,v,L,w);this.occupy(C,v);let T=Dt(C),F=t.filter(y=>!this.points[y]),I=this.componentsOf(F).map(y=>({members:y,span:Rt(this.anchorsOf(y))})).sort((y,O)=>y.span-O.span);for(let y of I)this.placePiece(y.members,T)}};function wt(e){let t=new Float64Array(e.n).fill(NaN),n=new Float64Array(e.n).fill(NaN);if(ut.hasBackbone(e)){let o=new ut(e);o.run(),o.write(t,n)}return{X:t,Y:n}}var hn=[{walks:2,iterations:15},{walks:4,iterations:30},{walks:8,iterations:60},{walks:12,iterations:90},{walks:16,iterations:120}],un=20,pn=3,St=.3,dn=2,xn=200,gn=.1,mn=.5,yn=e=>{var t;return((t=e.stable)===null||t===void 0?void 0:t.rank)===0};function Vt(e,t){let n=t.at(-1);return(e==="+"||e==="-")&&(n==="+"||n==="-")&&e!==n}function Mn(e){let t=Math.imul(e,2654435761)>>>0||1;return()=>(t^=t<<13,t>>>=0,t^=t>>>17,t^=t<<5,t>>>=0,t/4294967296)}function K(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function bt(e,t){return Math.max(K(e.nodeLengthPerMegabase,1e3)*t/1e6,K(e.minimumNodeLength,1))}function Wt(e){let{nodes:t,edges:n}=e.graph,o=e.options,s=K(o.nodeSegmentLength,1),i=K(o.edgeLength,1),r=t.map(w=>w.id),l=new Int32Array(t.length),p=new Int32Array(t.length),c=new Float64Array(t.length),a=0;t.forEach((w,v)=>{let C=bt(o,w.length),T=Math.max(1,Math.ceil(C/s));l[v]=a,p[v]=T+1,c[v]=C/T,a+=T+1});let f=new Int32Array(a),h=new Int32Array(a),u=new Float64Array(a).fill(NaN),m=new Float64Array(a).fill(NaN),M=new Uint8Array(a),N=Array.from({length:a},()=>[]);t.forEach((w,v)=>{let C=typeof w.x=="number"&&typeof w.y=="number",T=yn(w)?1:0;for(let F=0;F<p[v];F++){let I=l[v]+F;f[I]=v,h[I]=F,M[I]=T,C&&(u[I]=w.x+F*c[v],m[I]=w.y),F>0&&(N[I-1].push([I,c[v]]),N[I].push([I-1,c[v]]))}});let D=new Map(r.map((w,v)=>[w,v])),A=t.map(()=>[[],[]]);for(let w of n){let v=D.get(w.from),C=D.get(w.to);if(v===void 0||C===void 0||v===C&&p[v]<=2)continue;let T=Vt(w.fromStrand,w.from)?0:1,F=Vt(w.toStrand,w.to)?1:0,I=l[v]+(T?p[v]-1:0),y=l[C]+(F?p[C]-1:0);N[I].push([y,i]),N[y].push([I,i]),A[v][T].push([C,F]),A[C][F].push([v,T])}let S=new Int32Array(a+1);for(let w=0;w<a;w++)S[w+1]=S[w]+N[w].length;let g=new Int32Array(S[a]),L=new Float64Array(S[a]);for(let w=0;w<a;w++)N[w].forEach(([v,C],T)=>{g[S[w]+T]=v,L[S[w]+T]=C});return{ids:r,first:l,count:p,per:c,links:A,chainOf:f,indexOf:h,seedX:u,seedY:m,backbone:M,off:S,nb:g,wt:L,n:a,link:i}}function wn(e){let{n:t,off:n,nb:o}=e,s=new Int32Array(t).fill(-1),i=[];for(let r=0;r<t;r++){if(s[r]>=0)continue;let l=[r];s[r]=i.length;for(let p of l)for(let c=n[p];c<n[p+1];c++){let a=o[c];s[a]<0&&(s[a]=i.length,l.push(a))}i.push(l)}return{comp:s,members:i}}function At(e,t={}){var n,o,s;let i=Wt(e),{n:r,off:l,nb:p,wt:c,seedX:a,seedY:f,first:h,count:u,per:m,link:M}=i,N=e.options,D=hn[Math.max(0,Math.min(4,K((n=t.quality)!==null&&n!==void 0?n:N.quality,2)))],A=K((o=t.componentSeparation)!==null&&o!==void 0?o:N.componentSeparation,15),S=Mn(K((s=t.seed)!==null&&s!==void 0?s:N.seed,1)),g=new Float64Array(r),L=new Float64Array(r),w={};if(r===0)return{nodePositions:w};let{comp:v,members:C}=wn(i),T=1/0,F=0;for(let d=0;d<p.length;d++)T=Math.min(T,c[d]),F+=c[d];F/=2;let I=!1;for(let d=0;d<r;d++)if(!Number.isNaN(a[d])){I=!0;break}let y=I?wt(i):void 0,O=Math.sqrt(r)*20;for(let d=0;d<r;d++)y&&!Number.isNaN(y.X[d])?(g[d]=y.X[d],L[d]=y.Y[d]):I&&!Number.isNaN(a[d])?(g[d]=a[d]+S()-.5,L[d]=f[d]+S()-.5):(g[d]=S()*O,L[d]=S()*O);let V=C.map(d=>y!==void 0&&d.every(b=>!Number.isNaN(y.X[b]))),R=[],B=!0;for(let d=0;d<r;d++)V[v[d]]||(R.push(d),B&&(B=!Number.isNaN(a[d])));let G=Math.max(F/4,T*10),W=G*G,Z=gn*T*T,{walks:Yt,iterations:at}=D,Zt=Math.log(W/Z)/Math.max(1,at-1),Lt=Math.log(T),Xt=Math.log(G),vt=(d,b,x,E)=>{let P=E/(x*x);P>1&&(P=1);let k=g[d]-g[b],_=L[d]-L[b],J=Math.sqrt(k*k+_*_)||1e-9,U=P*(J-x)/(2*J),q=U*k,H=U*_;g[d]=g[d]-q,L[d]=L[d]-H,g[b]=g[b]+q,L[b]=L[b]+H},st=0,tn=(d,b)=>{let x=i.chainOf[d],E=i.indexOf[d],P=S()<.5?-1:1,k=b;for(let _=0;_<xn;_++){let J=u[x],U=m[x],q=(P>0?J-1-E:E)*U;if(k<=q){let $=Math.round(k/U);return st=b-k+$*U,h[x]+E+P*$}k-=q;let H=i.links[x][P>0?1:0];if(H.length===0)return st=b-k,h[x]+(P>0?J-1:0);let[tt,z]=H[Math.floor(S()*H.length)];if(k-=M,x=tt,P=z===0?1:-1,E=z===0?0:u[tt]-1,k<=0)return st=b-k,h[x]+E}return-1},Et=(d,b)=>{for(let x=l[d];x<l[d+1];x++){let E=p[x];E>d&&vt(d,E,c[x],b)}},X=Int32Array.from(R),nn=B?Math.floor(mn*at):0;for(let d=R.length?nn:at;d<at;d++){let b=W*Math.exp(-Zt*d);for(let x=X.length-1;x>0;x--){let E=Math.floor(S()*(x+1)),P=X[x];X[x]=X[E],X[E]=P}for(let x of X){Et(x,b);for(let E=0;E<Yt;E++){let P=Math.exp(Lt+S()*(Xt-Lt)),k=tn(x,P);k>=0&&k!==x&&st>0&&vt(x,k,st,b)}}}let j=pn*M,on=(d,b)=>Math.floor(d/j)*73856093^Math.floor(b/j)*19349663;for(let d=0;d<(R.length?un:0);d++){let b=new Map;for(let x of R){let E=on(g[x],L[x]),P=b.get(E);P?P.push(x):b.set(E,[x])}for(let x of R){let E=Math.floor(g[x]/j),P=Math.floor(L[x]/j);for(let k=E-1;k<=E+1;k++)for(let _=P-1;_<=P+1;_++){let J=b.get(k*73856093^_*19349663);if(J)for(let U of J){if(U<=x)continue;let q=!1;for(let nt=l[x];nt<l[x+1];nt++)if(p[nt]===U){q=!0;break}if(q)continue;let H=g[x]-g[U],tt=L[x]-L[U],z=Math.sqrt(H*H+tt*tt);if(z>=j)continue;let $,ct;if(z>1e-6){let nt=St*(j-z)/(2*z);$=nt*H,ct=nt*tt}else $=St*j*(S()-.5),ct=St*j*(S()-.5);g[x]=g[x]+$,L[x]=L[x]+ct,g[U]=g[U]-$,L[U]=L[U]-ct}}}for(let x of R)Et(x,1/0)}for(let d=0;d<u.length;d++){let b=h[d],x=u[d];if(!(x<3)){for(let E=0;E<dn;E++){let P=g.slice(b,b+x),k=L.slice(b,b+x);for(let _=1;_+1<x;_++)g[b+_]=.5*P[_]+.25*(P[_-1]+P[_+1]),L[b+_]=.5*k[_]+.25*(k[_-1]+k[_+1])}Sn(g,L,b,x,m[d])}}An(v,C,g,L,I,A);for(let d=0;d<i.ids.length;d++){let b=[];for(let x=0;x<u[d];x++)b.push({x:g[h[d]+x],y:L[h[d]+x]});w[i.ids[d]]=b}return{nodePositions:w}}function Sn(e,t,n,o,s){bn(e,t,n,o,s*(o-1));let i=new Float64Array(o);for(let a=1;a<o;a++)i[a]=i[a-1]+Math.hypot(e[n+a]-e[n+a-1],t[n+a]-t[n+a-1]);if(!i[o-1])return;let r=i[o-1],l=e.slice(n,n+o),p=t.slice(n,n+o),c=1;for(let a=1;a+1<o;a++){let f=r*a/(o-1);for(;c<o-1&&i[c]<f;)c++;let h=i[c]-i[c-1],u=h>0?(f-i[c-1])/h:0;e[n+a]=l[c-1]+(l[c]-l[c-1])*u,t[n+a]=p[c-1]+(p[c]-p[c-1])*u}}function bn(e,t,n,o,s){let i=n+o-1,r=e[n],l=t[n],p=Math.hypot(e[i]-r,t[i]-l),c=p>1e-9?(e[i]-r)/p:1,a=p>1e-9?(t[i]-l)/p:0,f=new Float64Array(o),h=new Float64Array(o),u=!0;for(let A=0;A<o;A++){let S=e[n+A]-r,g=t[n+A]-l;f[A]=S*c+g*a,h[A]=g*c-S*a,u&&(u=Math.abs(h[A])<1e-6)}let m=A=>{let S=0;for(let g=1;g<o;g++)S+=Math.hypot(f[g]-f[g-1],A*(h[g]-h[g-1]));return S};if(u||m(1)>=s)return;let M=1,N=2;for(;m(N)<s&&N<1e6;)M=N,N*=2;for(let A=0;A<40;A++){let S=(M+N)/2;m(S)<s?M=S:N=S}let D=(M+N)/2;for(let A=1;A+1<o;A++)e[n+A]=r+f[A]*c-D*h[A]*a,t[n+A]=l+f[A]*a+D*h[A]*c}function An(e,t,n,o,s,i){if(!s)for(let f of t)Nn(n,o,f);if(t.length<2)return;let r=new Float64Array(t.length).fill(1/0),l=new Float64Array(t.length).fill(1/0),p=new Float64Array(t.length).fill(-1/0);for(let f=0;f<n.length;f++){let h=e[f];r[h]=Math.min(r[h],n[f]),l[h]=Math.min(l[h],o[f]),p[h]=Math.max(p[h],o[f])}let c=new Float64Array(t.length),a=0;for(let f=0;f<t.length;f++)c[f]=a-l[f],a+=p[f]-l[f]+i;for(let f=0;f<n.length;f++){let h=e[f];n[f]=n[f]-r[h],o[f]=o[f]+c[h]}}function Nn(e,t,n){if(n.length<3)return;let o=0,s=0;for(let f of n)o+=e[f],s+=t[f];o/=n.length,s/=n.length;let i=0,r=0,l=0;for(let f of n){let h=e[f]-o,u=t[f]-s;i+=h*h,r+=u*u,l+=h*u}let p=-.5*Math.atan2(2*l,i-r),c=Math.cos(p),a=Math.sin(p);for(let f of n){let h=e[f]-o,u=t[f]-s;e[f]=o+c*h-a*u,t[f]=s+a*h+c*u}}var jt=[{value:"fmmm",label:"Bandage (FMMM)",description:"Bandage's force-directed layout: OGDF's fast multipole multilevel method, compiled to wasm."},{value:"stress",label:"Stress",description:"Plain JS: the reference drawn straight and each variant placed against it, an allele as a lens, a repeat loop as a ring, a deletion as an arch; stress by stochastic gradient descent for components with no reference."}],Ln=jt.map(e=>e.value);var vn=async e=>{if(e.options.engine==="stress"){let s=performance.now();return{result:At(e),duration:performance.now()-s}}let t=await kt(),n=performance.now();return{result:t.computeLayout(e.graph,e.options),duration:performance.now()-n}};var it=40,qt=500,pt=5;function En(e,t){return Math.max(e.nodeLengthPerMegabase*t/1e6,e.minimumNodeLength)}function Kt(e,t=pt){let o=e.nodes.reduce((i,r)=>i+r.length,0)/1e6,s=Math.max(e.nodes.length*it,qt);return{nodeLengthPerMegabase:o>0?s/o:1e4,minimumNodeLength:Math.max(pt,t),edgeLength:5,nodeSegmentLength:20}}var et={power:1,effect:1};function zt(e){return e.power===1&&e.effect===1}function $t(e,t){let n=e.nodes.length,o=e.nodes.reduce((r,l)=>r+l.length,0),s=n>0?o/n:0,i=n>0?Math.max(n*it,qt)/n:it;return r=>{if(s<=0)return i;let l=(r/s)**t.power;return Math.max(i*((l-1)*t.effect+1),pt)}}var Jt=1e3,Qt={law:et,minNodeLength:0};function eo(e,t=Qt){let{law:n,minNodeLength:o}=t,s=Kt(e,o);if(zt(n))return{nodes:e.nodes,opts:s};let i=$t(e,n);return{nodes:e.nodes.map(r=>({...r,length:Math.round(i(r.length)*Jt)})),opts:{...s,nodeLengthPerMegabase:1e6/Jt,minimumNodeLength:pt}}}function so(e,t=Qt){if(zt(t.law)){let n=Kt(e,t.minNodeLength);return o=>En(n,o)}return $t(e,t.law)}var Nt=[{value:"auto",label:"Proportional",description:"Bandage's own scale: a node draws proportional to its length, so a 1 bp allele is a speck.",law:et,minNodeFactor:0},{value:"open",label:"Open bubbles",description:"Give every allele a drawn length, so a bubble reads as two arms rather than a knot.",law:et,minNodeFactor:2.5},{value:"wide",label:"Wide bubbles",description:"As open, spread further. Best on a window of a dozen bubbles.",law:et,minNodeFactor:10},{value:"compress",label:"Compress lengths",description:"Pull the longest and shortest nodes towards the graph\u2019s mean, so a cut spanning kb and bp fits one pane.",law:{power:.5,effect:.5},minNodeFactor:0}],kn=Nt.map(e=>e.value);function Pn(e){let t=Nt.find(n=>n.value===e);return{law:t?.law??et,minNodeLength:(t?.minNodeFactor??0)*it}}var Y=JBrowseExports["tss-react/mui"],Tn=e=>Y!=null&&e in Object(Y)?Y[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from 'tss-react/mui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var Wo=Tn("makeStyles"),jo=Y&&Y.__esModule?Y.default:Y;export{_n as a,Cn as b,In as c,On as d,Fn as e,Rn as f,Ut as g,jt as h,Ln as i,vn as j,En as k,eo as l,so as m,Nt as n,kn as o,Pn as p,Wo as q};
|
|
2
|
-
//# sourceMappingURL=chunk-OTU3GXFO.js.map
|