@jbrowse/plugin-alignments 2.2.1 → 2.3.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/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +1 -1
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js.map +1 -1
- package/dist/AlignmentsTrack/index.js +1 -0
- package/dist/AlignmentsTrack/index.js.map +1 -1
- package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -4
- package/dist/BamAdapter/BamSlightlyLazyFeature.js +11 -18
- package/dist/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
- package/dist/BamAdapter/index.js +1 -0
- package/dist/BamAdapter/index.js.map +1 -1
- package/dist/CramAdapter/CramSlightlyLazyFeature.d.ts +5 -7
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +6 -8
- package/dist/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
- package/dist/CramAdapter/CramTestAdapters.js +2 -1
- package/dist/CramAdapter/CramTestAdapters.js.map +1 -1
- package/dist/CramAdapter/index.js +1 -0
- package/dist/CramAdapter/index.js.map +1 -1
- package/dist/GuessAlignmentsTypes/index.d.ts +3 -0
- package/dist/GuessAlignmentsTypes/index.js +56 -0
- package/dist/GuessAlignmentsTypes/index.js.map +1 -0
- package/dist/HtsgetBamAdapter/index.js +11 -11
- package/dist/HtsgetBamAdapter/index.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +10 -13
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/index.js +1 -0
- package/dist/LinearAlignmentsDisplay/index.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/models/configSchema.d.ts +6 -3
- package/dist/LinearAlignmentsDisplay/models/configSchema.js +2 -3
- package/dist/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +22 -36
- package/dist/LinearAlignmentsDisplay/models/model.js +166 -151
- package/dist/LinearAlignmentsDisplay/models/model.js.map +1 -1
- package/dist/LinearPileupDisplay/components/ColorByModifications.d.ts +3 -1
- package/dist/LinearPileupDisplay/components/ColorByModifications.js +7 -22
- package/dist/LinearPileupDisplay/components/ColorByModifications.js.map +1 -1
- package/dist/LinearPileupDisplay/components/ColorByTag.js +2 -22
- package/dist/LinearPileupDisplay/components/ColorByTag.js.map +1 -1
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.d.ts +2 -2
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.js +3 -22
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.js.map +1 -1
- package/dist/LinearPileupDisplay/components/SetMaxHeight.js +2 -18
- package/dist/LinearPileupDisplay/components/SetMaxHeight.js.map +1 -1
- package/dist/LinearPileupDisplay/components/SortByTag.js +2 -23
- package/dist/LinearPileupDisplay/components/SortByTag.js.map +1 -1
- package/dist/LinearPileupDisplay/configSchema.d.ts +0 -3
- package/dist/LinearPileupDisplay/configSchema.js.map +1 -1
- package/dist/LinearPileupDisplay/index.js +2 -0
- package/dist/LinearPileupDisplay/index.js.map +1 -1
- package/dist/LinearPileupDisplay/model.d.ts +19 -16
- package/dist/LinearPileupDisplay/model.js +28 -13
- package/dist/LinearPileupDisplay/model.js.map +1 -1
- package/dist/LinearReadArcsDisplay/components/ReactComponent.d.ts +6 -0
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js +49 -0
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -0
- package/dist/LinearReadArcsDisplay/configSchema.d.ts +6 -0
- package/dist/LinearReadArcsDisplay/configSchema.js +52 -0
- package/dist/LinearReadArcsDisplay/configSchema.js.map +1 -0
- package/dist/LinearReadArcsDisplay/drawFeats.d.ts +14 -0
- package/dist/LinearReadArcsDisplay/drawFeats.js +162 -0
- package/dist/LinearReadArcsDisplay/drawFeats.js.map +1 -0
- package/dist/LinearReadArcsDisplay/index.d.ts +2 -0
- package/dist/LinearReadArcsDisplay/index.js +27 -0
- package/dist/LinearReadArcsDisplay/index.js.map +1 -0
- package/dist/LinearReadArcsDisplay/model.d.ts +342 -0
- package/dist/LinearReadArcsDisplay/model.js +327 -0
- package/dist/LinearReadArcsDisplay/model.js.map +1 -0
- package/dist/LinearReadCloudDisplay/components/ReactComponent.d.ts +6 -0
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js +49 -0
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js.map +1 -0
- package/dist/LinearReadCloudDisplay/configSchema.d.ts +6 -0
- package/dist/LinearReadCloudDisplay/configSchema.js +51 -0
- package/dist/LinearReadCloudDisplay/configSchema.js.map +1 -0
- package/dist/LinearReadCloudDisplay/drawFeats.d.ts +10 -0
- package/dist/LinearReadCloudDisplay/drawFeats.js +159 -0
- package/dist/LinearReadCloudDisplay/drawFeats.js.map +1 -0
- package/dist/LinearReadCloudDisplay/index.d.ts +2 -0
- package/dist/LinearReadCloudDisplay/index.js +27 -0
- package/dist/LinearReadCloudDisplay/index.js.map +1 -0
- package/dist/LinearReadCloudDisplay/model.d.ts +320 -0
- package/dist/LinearReadCloudDisplay/model.js +252 -0
- package/dist/LinearReadCloudDisplay/model.js.map +1 -0
- package/dist/LinearSNPCoverageDisplay/index.js +1 -0
- package/dist/LinearSNPCoverageDisplay/index.js.map +1 -1
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +22 -19
- package/dist/LinearSNPCoverageDisplay/models/model.js +9 -12
- package/dist/LinearSNPCoverageDisplay/models/model.js.map +1 -1
- package/dist/{BamAdapter/MismatchParser.d.ts → MismatchParser/index.d.ts} +23 -0
- package/dist/{BamAdapter/MismatchParser.js → MismatchParser/index.js} +116 -3
- package/dist/MismatchParser/index.js.map +1 -0
- package/dist/PileupRPC/base.d.ts +8 -0
- package/dist/PileupRPC/base.js +22 -0
- package/dist/PileupRPC/base.js.map +1 -0
- package/dist/PileupRPC/index.d.ts +3 -0
- package/dist/PileupRPC/index.js +9 -0
- package/dist/PileupRPC/index.js.map +1 -0
- package/dist/PileupRPC/methods/GetGlobalValueForTag.d.ts +14 -0
- package/dist/PileupRPC/methods/GetGlobalValueForTag.js +29 -0
- package/dist/PileupRPC/methods/GetGlobalValueForTag.js.map +1 -0
- package/dist/PileupRPC/methods/GetReducedFeatures.d.ts +25 -0
- package/dist/PileupRPC/methods/GetReducedFeatures.js +61 -0
- package/dist/PileupRPC/methods/GetReducedFeatures.js.map +1 -0
- package/dist/PileupRPC/methods/GetVisibleModifications.d.ts +14 -0
- package/dist/PileupRPC/methods/GetVisibleModifications.js +32 -0
- package/dist/PileupRPC/methods/GetVisibleModifications.js.map +1 -0
- package/dist/PileupRPC/rpcMethods.d.ts +4 -34
- package/dist/PileupRPC/rpcMethods.js +7 -77
- package/dist/PileupRPC/rpcMethods.js.map +1 -1
- package/dist/PileupRPC/util.d.ts +8 -0
- package/dist/PileupRPC/util.js +20 -0
- package/dist/PileupRPC/util.js.map +1 -0
- package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
- package/dist/PileupRenderer/PileupRenderer.js +5 -5
- package/dist/PileupRenderer/PileupRenderer.js.map +1 -1
- package/dist/PileupRenderer/configSchema.js +1 -1
- package/dist/PileupRenderer/configSchema.js.map +1 -1
- package/dist/PileupRenderer/index.js +1 -0
- package/dist/PileupRenderer/index.js.map +1 -1
- package/dist/PileupRenderer/sortUtil.d.ts +1 -1
- package/dist/PileupRenderer/sortUtil.js +2 -2
- package/dist/PileupRenderer/sortUtil.js.map +1 -1
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +0 -51
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +3 -182
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js.map +1 -1
- package/dist/SNPCoverageAdapter/generateCoverageBins.d.ts +53 -0
- package/dist/SNPCoverageAdapter/generateCoverageBins.js +185 -0
- package/dist/SNPCoverageAdapter/generateCoverageBins.js.map +1 -0
- package/dist/SNPCoverageAdapter/index.js +1 -3
- package/dist/SNPCoverageAdapter/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -58
- package/dist/index.js.map +1 -1
- package/dist/{LinearPileupDisplay/components → shared}/FilterByTag.d.ts +0 -0
- package/dist/{LinearPileupDisplay/components → shared}/FilterByTag.js +5 -24
- package/dist/shared/FilterByTag.js.map +1 -0
- package/dist/shared/color.d.ts +17 -0
- package/dist/shared/color.js +43 -0
- package/dist/shared/color.js.map +1 -0
- package/dist/shared/fetchChains.d.ts +27 -0
- package/dist/shared/fetchChains.js +30 -0
- package/dist/shared/fetchChains.js.map +1 -0
- package/dist/shared/index.d.ts +36 -0
- package/dist/{shared.js → shared/index.js} +12 -2
- package/dist/shared/index.js.map +1 -0
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +1 -1
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js.map +1 -1
- package/esm/AlignmentsTrack/index.js +1 -0
- package/esm/AlignmentsTrack/index.js.map +1 -1
- package/esm/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -4
- package/esm/BamAdapter/BamSlightlyLazyFeature.js +11 -18
- package/esm/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
- package/esm/BamAdapter/index.js +1 -0
- package/esm/BamAdapter/index.js.map +1 -1
- package/esm/CramAdapter/CramSlightlyLazyFeature.d.ts +5 -7
- package/esm/CramAdapter/CramSlightlyLazyFeature.js +6 -8
- package/esm/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
- package/esm/CramAdapter/CramTestAdapters.js +2 -1
- package/esm/CramAdapter/CramTestAdapters.js.map +1 -1
- package/esm/CramAdapter/index.js +1 -0
- package/esm/CramAdapter/index.js.map +1 -1
- package/esm/GuessAlignmentsTypes/index.d.ts +3 -0
- package/esm/GuessAlignmentsTypes/index.js +54 -0
- package/esm/GuessAlignmentsTypes/index.js.map +1 -0
- package/esm/HtsgetBamAdapter/index.js +11 -11
- package/esm/HtsgetBamAdapter/index.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +10 -13
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/index.js +1 -0
- package/esm/LinearAlignmentsDisplay/index.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/models/configSchema.d.ts +6 -3
- package/esm/LinearAlignmentsDisplay/models/configSchema.js +2 -4
- package/esm/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/models/model.d.ts +22 -36
- package/esm/LinearAlignmentsDisplay/models/model.js +167 -152
- package/esm/LinearAlignmentsDisplay/models/model.js.map +1 -1
- package/esm/LinearPileupDisplay/components/ColorByModifications.d.ts +3 -1
- package/esm/LinearPileupDisplay/components/ColorByModifications.js +8 -23
- package/esm/LinearPileupDisplay/components/ColorByModifications.js.map +1 -1
- package/esm/LinearPileupDisplay/components/ColorByTag.js +3 -20
- package/esm/LinearPileupDisplay/components/ColorByTag.js.map +1 -1
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.d.ts +2 -2
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.js +4 -20
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.js.map +1 -1
- package/esm/LinearPileupDisplay/components/SetMaxHeight.js +3 -16
- package/esm/LinearPileupDisplay/components/SetMaxHeight.js.map +1 -1
- package/esm/LinearPileupDisplay/components/SortByTag.js +3 -21
- package/esm/LinearPileupDisplay/components/SortByTag.js.map +1 -1
- package/esm/LinearPileupDisplay/configSchema.d.ts +0 -3
- package/esm/LinearPileupDisplay/configSchema.js.map +1 -1
- package/esm/LinearPileupDisplay/index.js +2 -0
- package/esm/LinearPileupDisplay/index.js.map +1 -1
- package/esm/LinearPileupDisplay/model.d.ts +19 -16
- package/esm/LinearPileupDisplay/model.js +29 -14
- package/esm/LinearPileupDisplay/model.js.map +1 -1
- package/esm/LinearReadArcsDisplay/components/ReactComponent.d.ts +6 -0
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js +44 -0
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -0
- package/esm/LinearReadArcsDisplay/configSchema.d.ts +6 -0
- package/esm/LinearReadArcsDisplay/configSchema.js +50 -0
- package/esm/LinearReadArcsDisplay/configSchema.js.map +1 -0
- package/esm/LinearReadArcsDisplay/drawFeats.d.ts +14 -0
- package/esm/LinearReadArcsDisplay/drawFeats.js +157 -0
- package/esm/LinearReadArcsDisplay/drawFeats.js.map +1 -0
- package/esm/LinearReadArcsDisplay/index.d.ts +2 -0
- package/esm/LinearReadArcsDisplay/index.js +21 -0
- package/esm/LinearReadArcsDisplay/index.js.map +1 -0
- package/esm/LinearReadArcsDisplay/model.d.ts +342 -0
- package/esm/LinearReadArcsDisplay/model.js +299 -0
- package/esm/LinearReadArcsDisplay/model.js.map +1 -0
- package/esm/LinearReadCloudDisplay/components/ReactComponent.d.ts +6 -0
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js +44 -0
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js.map +1 -0
- package/esm/LinearReadCloudDisplay/configSchema.d.ts +6 -0
- package/esm/LinearReadCloudDisplay/configSchema.js +49 -0
- package/esm/LinearReadCloudDisplay/configSchema.js.map +1 -0
- package/esm/LinearReadCloudDisplay/drawFeats.d.ts +10 -0
- package/esm/LinearReadCloudDisplay/drawFeats.js +156 -0
- package/esm/LinearReadCloudDisplay/drawFeats.js.map +1 -0
- package/esm/LinearReadCloudDisplay/index.d.ts +2 -0
- package/esm/LinearReadCloudDisplay/index.js +21 -0
- package/esm/LinearReadCloudDisplay/index.js.map +1 -0
- package/esm/LinearReadCloudDisplay/model.d.ts +320 -0
- package/esm/LinearReadCloudDisplay/model.js +224 -0
- package/esm/LinearReadCloudDisplay/model.js.map +1 -0
- package/esm/LinearSNPCoverageDisplay/index.js +1 -0
- package/esm/LinearSNPCoverageDisplay/index.js.map +1 -1
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +22 -19
- package/esm/LinearSNPCoverageDisplay/models/model.js +11 -14
- package/esm/LinearSNPCoverageDisplay/models/model.js.map +1 -1
- package/esm/{BamAdapter/MismatchParser.d.ts → MismatchParser/index.d.ts} +23 -0
- package/esm/{BamAdapter/MismatchParser.js → MismatchParser/index.js} +107 -2
- package/esm/MismatchParser/index.js.map +1 -0
- package/esm/PileupRPC/base.d.ts +8 -0
- package/esm/PileupRPC/base.js +16 -0
- package/esm/PileupRPC/base.js.map +1 -0
- package/esm/PileupRPC/index.d.ts +3 -0
- package/esm/PileupRPC/index.js +7 -0
- package/esm/PileupRPC/index.js.map +1 -0
- package/esm/PileupRPC/methods/GetGlobalValueForTag.d.ts +14 -0
- package/esm/PileupRPC/methods/GetGlobalValueForTag.js +23 -0
- package/esm/PileupRPC/methods/GetGlobalValueForTag.js.map +1 -0
- package/esm/PileupRPC/methods/GetReducedFeatures.d.ts +25 -0
- package/esm/PileupRPC/methods/GetReducedFeatures.js +55 -0
- package/esm/PileupRPC/methods/GetReducedFeatures.js.map +1 -0
- package/esm/PileupRPC/methods/GetVisibleModifications.d.ts +14 -0
- package/esm/PileupRPC/methods/GetVisibleModifications.js +26 -0
- package/esm/PileupRPC/methods/GetVisibleModifications.js.map +1 -0
- package/esm/PileupRPC/rpcMethods.d.ts +4 -34
- package/esm/PileupRPC/rpcMethods.js +4 -74
- package/esm/PileupRPC/rpcMethods.js.map +1 -1
- package/esm/PileupRPC/util.d.ts +8 -0
- package/esm/PileupRPC/util.js +15 -0
- package/esm/PileupRPC/util.js.map +1 -0
- package/esm/PileupRenderer/PileupRenderer.d.ts +1 -1
- package/esm/PileupRenderer/PileupRenderer.js +5 -5
- package/esm/PileupRenderer/PileupRenderer.js.map +1 -1
- package/esm/PileupRenderer/configSchema.js +1 -1
- package/esm/PileupRenderer/configSchema.js.map +1 -1
- package/esm/PileupRenderer/index.js +1 -0
- package/esm/PileupRenderer/index.js.map +1 -1
- package/esm/PileupRenderer/sortUtil.d.ts +1 -1
- package/esm/PileupRenderer/sortUtil.js +1 -1
- package/esm/PileupRenderer/sortUtil.js.map +1 -1
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +0 -51
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js +4 -183
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js.map +1 -1
- package/esm/SNPCoverageAdapter/generateCoverageBins.d.ts +53 -0
- package/esm/SNPCoverageAdapter/generateCoverageBins.js +182 -0
- package/esm/SNPCoverageAdapter/generateCoverageBins.js.map +1 -0
- package/esm/SNPCoverageAdapter/index.js +1 -3
- package/esm/SNPCoverageAdapter/index.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +10 -56
- package/esm/index.js.map +1 -1
- package/esm/{LinearPileupDisplay/components → shared}/FilterByTag.d.ts +0 -0
- package/esm/{LinearPileupDisplay/components → shared}/FilterByTag.js +6 -22
- package/esm/shared/FilterByTag.js.map +1 -0
- package/esm/shared/color.d.ts +17 -0
- package/esm/shared/color.js +37 -0
- package/esm/shared/color.js.map +1 -0
- package/esm/shared/fetchChains.d.ts +27 -0
- package/esm/shared/fetchChains.js +26 -0
- package/esm/shared/fetchChains.js.map +1 -0
- package/esm/shared/index.d.ts +36 -0
- package/esm/{shared.js → shared/index.js} +11 -1
- package/esm/shared/index.js.map +1 -0
- package/package.json +5 -5
- package/src/AlignmentsFeatureDetail/AlignmentsFeatureDetail.tsx +1 -1
- package/src/AlignmentsTrack/index.ts +1 -0
- package/src/BamAdapter/BamSlightlyLazyFeature.ts +13 -19
- package/src/BamAdapter/index.ts +1 -0
- package/src/CramAdapter/CramSlightlyLazyFeature.ts +13 -15
- package/src/CramAdapter/CramTestAdapters.ts +1 -0
- package/src/CramAdapter/__snapshots__/CramAdapter.test.ts.snap +0 -10
- package/src/CramAdapter/index.ts +1 -0
- package/src/GuessAlignmentsTypes/index.ts +79 -0
- package/src/HtsgetBamAdapter/index.ts +11 -15
- package/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx +21 -29
- package/src/LinearAlignmentsDisplay/index.ts +1 -0
- package/src/LinearAlignmentsDisplay/models/configSchema.ts +2 -6
- package/src/LinearAlignmentsDisplay/models/model.tsx +238 -199
- package/src/LinearPileupDisplay/components/ColorByModifications.tsx +5 -34
- package/src/LinearPileupDisplay/components/ColorByTag.tsx +2 -29
- package/src/LinearPileupDisplay/components/SetFeatureHeight.tsx +5 -27
- package/src/LinearPileupDisplay/components/SetMaxHeight.tsx +2 -24
- package/src/LinearPileupDisplay/components/SortByTag.tsx +2 -31
- package/src/LinearPileupDisplay/configSchema.ts +1 -3
- package/src/LinearPileupDisplay/index.ts +2 -0
- package/src/LinearPileupDisplay/model.ts +36 -23
- package/src/LinearReadArcsDisplay/components/ReactComponent.tsx +86 -0
- package/src/LinearReadArcsDisplay/configSchema.ts +58 -0
- package/src/LinearReadArcsDisplay/declare.d.ts +1 -0
- package/src/LinearReadArcsDisplay/drawFeats.ts +199 -0
- package/src/LinearReadArcsDisplay/index.ts +23 -0
- package/src/LinearReadArcsDisplay/model.tsx +370 -0
- package/src/LinearReadCloudDisplay/components/ReactComponent.tsx +86 -0
- package/src/LinearReadCloudDisplay/configSchema.ts +57 -0
- package/src/LinearReadCloudDisplay/drawFeats.ts +201 -0
- package/src/LinearReadCloudDisplay/index.ts +23 -0
- package/src/LinearReadCloudDisplay/model.tsx +289 -0
- package/src/LinearSNPCoverageDisplay/index.ts +1 -0
- package/src/LinearSNPCoverageDisplay/models/model.ts +15 -21
- package/src/{BamAdapter/MismatchParser.test.ts → MismatchParser/index.test.ts} +1 -1
- package/src/{BamAdapter/MismatchParser.ts → MismatchParser/index.ts} +129 -2
- package/src/PileupRPC/base.ts +24 -0
- package/src/PileupRPC/index.ts +12 -0
- package/src/PileupRPC/methods/GetGlobalValueForTag.ts +41 -0
- package/src/PileupRPC/methods/GetReducedFeatures.ts +76 -0
- package/src/PileupRPC/methods/GetVisibleModifications.ts +45 -0
- package/src/PileupRPC/rpcMethods.ts +8 -113
- package/src/PileupRPC/util.ts +19 -0
- package/src/PileupRenderer/PileupRenderer.ts +5 -8
- package/src/PileupRenderer/configSchema.ts +1 -1
- package/src/PileupRenderer/index.ts +1 -0
- package/src/PileupRenderer/sortUtil.ts +2 -3
- package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +5 -249
- package/src/SNPCoverageAdapter/generateCoverageBins.ts +245 -0
- package/src/SNPCoverageAdapter/index.ts +1 -3
- package/src/index.ts +12 -93
- package/src/{LinearPileupDisplay/components → shared}/FilterByTag.tsx +5 -31
- package/src/shared/color.ts +47 -0
- package/src/shared/fetchChains.ts +63 -0
- package/src/{shared.ts → shared/index.ts} +17 -4
- package/dist/BamAdapter/MismatchParser.js.map +0 -1
- package/dist/LinearPileupDisplay/components/FilterByTag.js.map +0 -1
- package/dist/shared.d.ts +0 -25
- package/dist/shared.js.map +0 -1
- package/esm/BamAdapter/MismatchParser.js.map +0 -1
- package/esm/LinearPileupDisplay/components/FilterByTag.js.map +0 -1
- package/esm/shared.d.ts +0 -25
- package/esm/shared.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
3
|
+
import { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'
|
|
4
|
+
import { types } from 'mobx-state-tree'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* #config LinearReadCloudDisplay
|
|
8
|
+
*/
|
|
9
|
+
function configSchemaF(pluginManager: PluginManager) {
|
|
10
|
+
return ConfigurationSchema(
|
|
11
|
+
'LinearReadCloudDisplay',
|
|
12
|
+
{
|
|
13
|
+
/**
|
|
14
|
+
* #slot
|
|
15
|
+
*/
|
|
16
|
+
maxFeatureScreenDensity: {
|
|
17
|
+
type: 'number',
|
|
18
|
+
description: 'maximum features per pixel that is displayed in the view',
|
|
19
|
+
defaultValue: 5,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* #slot
|
|
24
|
+
*/
|
|
25
|
+
featureHeight: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
defaultValue: 7,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* #slot
|
|
32
|
+
*/
|
|
33
|
+
colorScheme: {
|
|
34
|
+
type: 'stringEnum',
|
|
35
|
+
model: types.enumeration('colorScheme', [
|
|
36
|
+
'strand',
|
|
37
|
+
'normal',
|
|
38
|
+
'insertSize',
|
|
39
|
+
'insertSizeAndOrientation',
|
|
40
|
+
'mappingQuality',
|
|
41
|
+
'tag',
|
|
42
|
+
]),
|
|
43
|
+
description: 'color scheme to use',
|
|
44
|
+
defaultValue: 'normal',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
/**
|
|
49
|
+
* #baseConfiguration
|
|
50
|
+
*/
|
|
51
|
+
baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),
|
|
52
|
+
explicitlyTyped: true,
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default configSchemaF
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { getConf } from '@jbrowse/core/configuration'
|
|
2
|
+
import { getContainingView } from '@jbrowse/core/util'
|
|
3
|
+
|
|
4
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
5
|
+
// locals
|
|
6
|
+
import {
|
|
7
|
+
getOrientationColor,
|
|
8
|
+
getInsertSizeColor,
|
|
9
|
+
getInsertSizeAndOrientationColor,
|
|
10
|
+
} from '../shared/color'
|
|
11
|
+
import { ChainData, ReducedFeature } from '../shared/fetchChains'
|
|
12
|
+
|
|
13
|
+
type LGV = LinearGenomeViewModel
|
|
14
|
+
|
|
15
|
+
interface ChainCoord {
|
|
16
|
+
distance: number
|
|
17
|
+
r1s: number
|
|
18
|
+
r1e: number
|
|
19
|
+
r2s: number
|
|
20
|
+
r2e: number
|
|
21
|
+
v0: ReducedFeature
|
|
22
|
+
v1: ReducedFeature
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// avoid drawing negative width features for SVG exports
|
|
26
|
+
function fillRectCtx(
|
|
27
|
+
x: number,
|
|
28
|
+
y: number,
|
|
29
|
+
width: number,
|
|
30
|
+
height: number,
|
|
31
|
+
ctx: CanvasRenderingContext2D,
|
|
32
|
+
color?: string,
|
|
33
|
+
) {
|
|
34
|
+
if (width < 0) {
|
|
35
|
+
x += width
|
|
36
|
+
width = -width
|
|
37
|
+
}
|
|
38
|
+
if (height < 0) {
|
|
39
|
+
y += height
|
|
40
|
+
height = -height
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (color) {
|
|
44
|
+
ctx.fillStyle = color
|
|
45
|
+
}
|
|
46
|
+
ctx.fillRect(x, y, width, height)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default async function drawFeats(
|
|
50
|
+
self: {
|
|
51
|
+
setLastDrawnOffsetPx: (n: number) => void
|
|
52
|
+
setError: (e: unknown) => void
|
|
53
|
+
colorBy?: { type: string }
|
|
54
|
+
height: number
|
|
55
|
+
chainData?: ChainData
|
|
56
|
+
},
|
|
57
|
+
ctx: CanvasRenderingContext2D,
|
|
58
|
+
) {
|
|
59
|
+
const { chainData } = self
|
|
60
|
+
if (!chainData) {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
const featureHeight = getConf(self, 'featureHeight')
|
|
64
|
+
const displayHeight = self.height
|
|
65
|
+
const view = getContainingView(self) as LGV
|
|
66
|
+
|
|
67
|
+
self.setLastDrawnOffsetPx(view.offsetPx)
|
|
68
|
+
|
|
69
|
+
const { chains, stats } = chainData
|
|
70
|
+
const coords: ChainCoord[] = []
|
|
71
|
+
for (let i = 0; i < chains.length; i++) {
|
|
72
|
+
const chain = chains[i]
|
|
73
|
+
// if we're looking at a paired read (flag 1) then assume it is just two
|
|
74
|
+
// reads (some small cases may defy this assumption such as secondary
|
|
75
|
+
// alignments but this may be uncommon)
|
|
76
|
+
if (chain[0].flags & 1 && chain.length > 1) {
|
|
77
|
+
const v0 = chain[0]
|
|
78
|
+
const v1 = chain[1]
|
|
79
|
+
const r1s = view.bpToPx({
|
|
80
|
+
refName: v0.refName,
|
|
81
|
+
coord: v0.start,
|
|
82
|
+
})
|
|
83
|
+
const r1e = view.bpToPx({
|
|
84
|
+
refName: v0.refName,
|
|
85
|
+
coord: v0.end,
|
|
86
|
+
})
|
|
87
|
+
const r2s = view.bpToPx({
|
|
88
|
+
refName: v1.refName,
|
|
89
|
+
coord: v1.start,
|
|
90
|
+
})
|
|
91
|
+
const r2e = view.bpToPx({
|
|
92
|
+
refName: v1.refName,
|
|
93
|
+
coord: v1.end,
|
|
94
|
+
})
|
|
95
|
+
let distance = 0
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
r1s !== undefined &&
|
|
99
|
+
r1e !== undefined &&
|
|
100
|
+
r2s !== undefined &&
|
|
101
|
+
r2e !== undefined
|
|
102
|
+
) {
|
|
103
|
+
if (v0.refName === v1.refName) {
|
|
104
|
+
const s = Math.min(v0.start, v1.start)
|
|
105
|
+
const e = Math.max(v0.end, v1.end)
|
|
106
|
+
distance = Math.abs(e - s)
|
|
107
|
+
}
|
|
108
|
+
coords.push({
|
|
109
|
+
r1s: r1s.offsetPx,
|
|
110
|
+
r1e: r1e.offsetPx,
|
|
111
|
+
r2s: r2s.offsetPx,
|
|
112
|
+
r2e: r2e.offsetPx,
|
|
113
|
+
v0,
|
|
114
|
+
v1,
|
|
115
|
+
distance,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
// if we're not looking at pairs, then it could be a multiply-split-long
|
|
120
|
+
// read, so traverse chain
|
|
121
|
+
for (let i = 1; i < chain.length; i++) {
|
|
122
|
+
const v0 = chain[i - 1]
|
|
123
|
+
const v1 = chain[i]
|
|
124
|
+
const r1s = view.bpToPx({
|
|
125
|
+
refName: v0.refName,
|
|
126
|
+
coord: v0.start,
|
|
127
|
+
})
|
|
128
|
+
const r1e = view.bpToPx({
|
|
129
|
+
refName: v0.refName,
|
|
130
|
+
coord: v0.end,
|
|
131
|
+
})
|
|
132
|
+
const r2s = view.bpToPx({
|
|
133
|
+
refName: v1.refName,
|
|
134
|
+
coord: v1.start,
|
|
135
|
+
})
|
|
136
|
+
const r2e = view.bpToPx({
|
|
137
|
+
refName: v1.refName,
|
|
138
|
+
coord: v1.end,
|
|
139
|
+
})
|
|
140
|
+
let distance = 0
|
|
141
|
+
|
|
142
|
+
if (
|
|
143
|
+
r1s !== undefined &&
|
|
144
|
+
r1e !== undefined &&
|
|
145
|
+
r2s !== undefined &&
|
|
146
|
+
r2e !== undefined
|
|
147
|
+
) {
|
|
148
|
+
if (v0.refName === v1.refName) {
|
|
149
|
+
const s = Math.min(v0.start, v1.start)
|
|
150
|
+
const e = Math.max(v0.end, v1.end)
|
|
151
|
+
distance = Math.abs(e - s)
|
|
152
|
+
}
|
|
153
|
+
coords.push({
|
|
154
|
+
r1s: r1s.offsetPx,
|
|
155
|
+
r1e: r1e.offsetPx,
|
|
156
|
+
r2s: r2s.offsetPx,
|
|
157
|
+
r2e: r2e.offsetPx,
|
|
158
|
+
v0,
|
|
159
|
+
v1,
|
|
160
|
+
distance,
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let max = 0
|
|
168
|
+
for (let i = 0; i < coords.length; i++) {
|
|
169
|
+
const { distance } = coords[i]
|
|
170
|
+
max = Math.max(max, distance)
|
|
171
|
+
}
|
|
172
|
+
const halfHeight = featureHeight / 2 - 0.5
|
|
173
|
+
const scaler = (displayHeight - 20) / Math.log(max)
|
|
174
|
+
|
|
175
|
+
for (let i = 0; i < coords.length; i++) {
|
|
176
|
+
const { r1s, r1e, r2s, r2e, v0, v1, distance } = coords[i]
|
|
177
|
+
const type = self.colorBy?.type || 'insertSizeAndOrientation'
|
|
178
|
+
|
|
179
|
+
const top = Math.log(distance) * scaler
|
|
180
|
+
ctx.fillStyle = 'black'
|
|
181
|
+
const w = r2s - r1e
|
|
182
|
+
fillRectCtx(r1e - view.offsetPx, top + halfHeight, w, 1, ctx)
|
|
183
|
+
|
|
184
|
+
if (type === 'insertSizeAndOrientation') {
|
|
185
|
+
ctx.fillStyle = getInsertSizeAndOrientationColor(v0, v1, stats)
|
|
186
|
+
} else if (type === 'orientation') {
|
|
187
|
+
ctx.fillStyle = getOrientationColor(v0)
|
|
188
|
+
} else if (type === 'insertSize') {
|
|
189
|
+
ctx.fillStyle = getInsertSizeColor(v0, v1, stats) || 'grey'
|
|
190
|
+
} else if (type === 'gradient') {
|
|
191
|
+
const s = Math.min(v0.start, v1.start)
|
|
192
|
+
const e = Math.max(v0.end, v1.end)
|
|
193
|
+
ctx.fillStyle = `hsl(${Math.log10(Math.abs(e - s)) * 10},50%,50%)`
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const w1 = Math.max(r1e - r1s, 2)
|
|
197
|
+
const w2 = Math.max(r2e - r2s, 2)
|
|
198
|
+
fillRectCtx(r1s - view.offsetPx, top, w1, featureHeight, ctx)
|
|
199
|
+
fillRectCtx(r2s - view.offsetPx, top, w2, featureHeight, ctx)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
+
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
|
|
3
|
+
|
|
4
|
+
// locals
|
|
5
|
+
import ReactComponent from './components/ReactComponent'
|
|
6
|
+
import configSchemaF from './configSchema'
|
|
7
|
+
import stateModelF from './model'
|
|
8
|
+
|
|
9
|
+
export default function register(pluginManager: PluginManager) {
|
|
10
|
+
pluginManager.addDisplayType(() => {
|
|
11
|
+
const configSchema = configSchemaF(pluginManager)
|
|
12
|
+
return new DisplayType({
|
|
13
|
+
name: 'LinearReadCloudDisplay',
|
|
14
|
+
displayName: 'Read cloud display',
|
|
15
|
+
configSchema,
|
|
16
|
+
stateModel: stateModelF(configSchema),
|
|
17
|
+
trackType: 'AlignmentsTrack',
|
|
18
|
+
viewType: 'LinearGenomeView',
|
|
19
|
+
subDisplay: { type: 'LinearAlignmentsDisplay', lowerPanel: true },
|
|
20
|
+
ReactComponent,
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import React, { lazy } from 'react'
|
|
2
|
+
import { autorun } from 'mobx'
|
|
3
|
+
import { addDisposer, cast, types, Instance } from 'mobx-state-tree'
|
|
4
|
+
import {
|
|
5
|
+
AnyConfigurationSchemaType,
|
|
6
|
+
ConfigurationReference,
|
|
7
|
+
ConfigurationSchema,
|
|
8
|
+
} from '@jbrowse/core/configuration'
|
|
9
|
+
import { getContainingView, getSession } from '@jbrowse/core/util'
|
|
10
|
+
import { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view'
|
|
11
|
+
|
|
12
|
+
// icons
|
|
13
|
+
import PaletteIcon from '@mui/icons-material/Palette'
|
|
14
|
+
import FilterListIcon from '@mui/icons-material/ClearAll'
|
|
15
|
+
|
|
16
|
+
// locals
|
|
17
|
+
import { FilterModel } from '../shared'
|
|
18
|
+
import { fetchChains, ChainData } from '../shared/fetchChains'
|
|
19
|
+
import drawFeats from './drawFeats'
|
|
20
|
+
import {
|
|
21
|
+
ExportSvgOptions,
|
|
22
|
+
LinearGenomeViewModel,
|
|
23
|
+
} from '@jbrowse/plugin-linear-genome-view/src/LinearGenomeView'
|
|
24
|
+
|
|
25
|
+
// async
|
|
26
|
+
const FilterByTagDlg = lazy(() => import('../shared/FilterByTag'))
|
|
27
|
+
|
|
28
|
+
interface Filter {
|
|
29
|
+
flagInclude: number
|
|
30
|
+
flagExclude: number
|
|
31
|
+
readName?: string
|
|
32
|
+
tagFilter?: { tag: string; value: string }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* #stateModel LinearReadCloudDisplay
|
|
37
|
+
* extends `BaseLinearDisplay`
|
|
38
|
+
*/
|
|
39
|
+
function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
40
|
+
return types
|
|
41
|
+
.compose(
|
|
42
|
+
'LinearReadCloudDisplay',
|
|
43
|
+
BaseLinearDisplay,
|
|
44
|
+
types.model({
|
|
45
|
+
/**
|
|
46
|
+
* #property
|
|
47
|
+
*/
|
|
48
|
+
type: types.literal('LinearReadCloudDisplay'),
|
|
49
|
+
/**
|
|
50
|
+
* #property
|
|
51
|
+
*/
|
|
52
|
+
configuration: ConfigurationReference(configSchema),
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* #property
|
|
56
|
+
*/
|
|
57
|
+
filterBy: types.optional(FilterModel, {}),
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* #property
|
|
61
|
+
*/
|
|
62
|
+
colorBy: types.maybe(
|
|
63
|
+
types.model({
|
|
64
|
+
type: types.string,
|
|
65
|
+
tag: types.maybe(types.string),
|
|
66
|
+
extra: types.frozen(),
|
|
67
|
+
}),
|
|
68
|
+
),
|
|
69
|
+
}),
|
|
70
|
+
)
|
|
71
|
+
.volatile(() => ({
|
|
72
|
+
loading: false,
|
|
73
|
+
drawn: false,
|
|
74
|
+
chainData: undefined as ChainData | undefined,
|
|
75
|
+
ref: null as HTMLCanvasElement | null,
|
|
76
|
+
lastDrawnOffsetPx: 0,
|
|
77
|
+
}))
|
|
78
|
+
.actions(self => ({
|
|
79
|
+
/**
|
|
80
|
+
* #action
|
|
81
|
+
* internal, a reference to a HTMLCanvas because we use a autorun to draw the canvas
|
|
82
|
+
*/
|
|
83
|
+
reload() {
|
|
84
|
+
self.error = undefined
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* #action
|
|
88
|
+
*/
|
|
89
|
+
setRef(ref: HTMLCanvasElement | null) {
|
|
90
|
+
self.ref = ref
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
setColorScheme(s: { type: string }) {
|
|
94
|
+
self.colorBy = cast(s)
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* #action
|
|
99
|
+
*/
|
|
100
|
+
setChainData(args: ChainData) {
|
|
101
|
+
self.chainData = args
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* #action
|
|
106
|
+
*/
|
|
107
|
+
setLoading(f: boolean) {
|
|
108
|
+
self.loading = f
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* #action
|
|
113
|
+
*/
|
|
114
|
+
setDrawn(f: boolean) {
|
|
115
|
+
self.drawn = f
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* #action
|
|
120
|
+
*/
|
|
121
|
+
setFilterBy(filter: Filter) {
|
|
122
|
+
self.filterBy = cast(filter)
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* #action
|
|
127
|
+
*/
|
|
128
|
+
setLastDrawnOffsetPx(n: number) {
|
|
129
|
+
self.lastDrawnOffsetPx = n
|
|
130
|
+
},
|
|
131
|
+
}))
|
|
132
|
+
|
|
133
|
+
.views(self => {
|
|
134
|
+
const {
|
|
135
|
+
trackMenuItems: superTrackMenuItems,
|
|
136
|
+
renderProps: superRenderProps,
|
|
137
|
+
} = self
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
/**
|
|
141
|
+
* #getter
|
|
142
|
+
*/
|
|
143
|
+
get ready() {
|
|
144
|
+
return !!self.chainData
|
|
145
|
+
},
|
|
146
|
+
// we don't use a server side renderer, but we need to provide this
|
|
147
|
+
// to avoid confusing the system currently
|
|
148
|
+
get rendererTypeName() {
|
|
149
|
+
return 'PileupRenderer'
|
|
150
|
+
},
|
|
151
|
+
// we don't use a server side renderer, so this fills in minimal
|
|
152
|
+
// info so as not to crash
|
|
153
|
+
renderProps() {
|
|
154
|
+
return {
|
|
155
|
+
...superRenderProps(),
|
|
156
|
+
// never ready, we don't want to use server side render
|
|
157
|
+
notReady: true,
|
|
158
|
+
config: ConfigurationSchema('empty', {}).create(),
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* #method
|
|
164
|
+
*/
|
|
165
|
+
trackMenuItems() {
|
|
166
|
+
return [
|
|
167
|
+
...superTrackMenuItems(),
|
|
168
|
+
{
|
|
169
|
+
label: 'Filter by',
|
|
170
|
+
icon: FilterListIcon,
|
|
171
|
+
onClick: () => {
|
|
172
|
+
getSession(self).queueDialog(handleClose => [
|
|
173
|
+
FilterByTagDlg,
|
|
174
|
+
{ model: self, handleClose },
|
|
175
|
+
])
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
{
|
|
180
|
+
label: 'Color scheme',
|
|
181
|
+
icon: PaletteIcon,
|
|
182
|
+
subMenu: [
|
|
183
|
+
{
|
|
184
|
+
label: 'Insert size ± 3σ and orientation',
|
|
185
|
+
onClick: () =>
|
|
186
|
+
self.setColorScheme({ type: 'insertSizeAndOrientation' }),
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
label: 'Insert size ± 3σ',
|
|
190
|
+
onClick: () => self.setColorScheme({ type: 'insertSize' }),
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: 'Orientation',
|
|
194
|
+
onClick: () => self.setColorScheme({ type: 'orientation' }),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'Insert size gradient',
|
|
198
|
+
onClick: () => self.setColorScheme({ type: 'gradient' }),
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* #method
|
|
207
|
+
*/
|
|
208
|
+
async renderSvg(opts: ExportSvgOptions) {
|
|
209
|
+
const view = getContainingView(self) as LinearGenomeViewModel
|
|
210
|
+
const width = view.dynamicBlocks.totalWidthPx
|
|
211
|
+
const height = self.height
|
|
212
|
+
let str
|
|
213
|
+
if (opts.rasterizeLayers) {
|
|
214
|
+
const canvas = document.createElement('canvas')
|
|
215
|
+
canvas.width = width * 2
|
|
216
|
+
canvas.height = height * 2
|
|
217
|
+
const ctx = canvas.getContext('2d')
|
|
218
|
+
if (!ctx) {
|
|
219
|
+
return
|
|
220
|
+
}
|
|
221
|
+
ctx.scale(2, 2)
|
|
222
|
+
await drawFeats(self, ctx)
|
|
223
|
+
str = (
|
|
224
|
+
<image
|
|
225
|
+
width={width}
|
|
226
|
+
height={height}
|
|
227
|
+
xlinkHref={canvas.toDataURL('image/png')}
|
|
228
|
+
/>
|
|
229
|
+
)
|
|
230
|
+
} else {
|
|
231
|
+
// @ts-ignore
|
|
232
|
+
const C2S = await import('canvas2svg')
|
|
233
|
+
const ctx = new C2S.default(width, height)
|
|
234
|
+
await drawFeats(self, ctx)
|
|
235
|
+
str = (
|
|
236
|
+
// eslint-disable-next-line react/no-danger
|
|
237
|
+
<g dangerouslySetInnerHTML={{ __html: ctx.getSvg().innerHTML }} />
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return <g>{str}</g>
|
|
242
|
+
},
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
.actions(self => ({
|
|
246
|
+
afterAttach() {
|
|
247
|
+
addDisposer(
|
|
248
|
+
self,
|
|
249
|
+
autorun(() => fetchChains(self), { delay: 1000 }),
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
addDisposer(
|
|
253
|
+
self,
|
|
254
|
+
autorun(
|
|
255
|
+
async () => {
|
|
256
|
+
try {
|
|
257
|
+
const canvas = self.ref
|
|
258
|
+
if (!canvas) {
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
const ctx = canvas.getContext('2d')
|
|
262
|
+
if (!ctx) {
|
|
263
|
+
return
|
|
264
|
+
}
|
|
265
|
+
ctx.clearRect(0, 0, canvas.width, self.height * 2)
|
|
266
|
+
ctx.resetTransform()
|
|
267
|
+
ctx.scale(2, 2)
|
|
268
|
+
|
|
269
|
+
await drawFeats(self, ctx)
|
|
270
|
+
self.setDrawn(true)
|
|
271
|
+
} catch (e) {
|
|
272
|
+
console.error(e)
|
|
273
|
+
self.setError(e)
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{ delay: 1000 },
|
|
277
|
+
),
|
|
278
|
+
)
|
|
279
|
+
},
|
|
280
|
+
}))
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export type LinearReadCloudDisplayStateModel = ReturnType<
|
|
284
|
+
typeof stateModelFactory
|
|
285
|
+
>
|
|
286
|
+
export type LinearReadCloudDisplayModel =
|
|
287
|
+
Instance<LinearReadCloudDisplayStateModel>
|
|
288
|
+
|
|
289
|
+
export default stateModelFactory
|
|
@@ -9,6 +9,7 @@ export default function register(pluginManager: PluginManager) {
|
|
|
9
9
|
const configSchema = configSchemaFactory(pluginManager)
|
|
10
10
|
return new DisplayType({
|
|
11
11
|
name: 'LinearSNPCoverageDisplay',
|
|
12
|
+
displayName: 'SNPCoverage display',
|
|
12
13
|
configSchema,
|
|
13
14
|
stateModel: modelFactory(pluginManager, configSchema),
|
|
14
15
|
trackType: 'AlignmentsTrack',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { addDisposer, types, cast, getEnv, getSnapshot } from 'mobx-state-tree'
|
|
2
|
-
import
|
|
2
|
+
import clone from 'clone'
|
|
3
|
+
import { autorun } from 'mobx'
|
|
4
|
+
|
|
5
|
+
// jbrowse
|
|
6
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
7
|
import {
|
|
4
8
|
getConf,
|
|
5
9
|
readConfObject,
|
|
@@ -7,13 +11,12 @@ import {
|
|
|
7
11
|
AnyConfigurationModel,
|
|
8
12
|
} from '@jbrowse/core/configuration'
|
|
9
13
|
import { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle'
|
|
10
|
-
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
11
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
12
14
|
import { getContainingView } from '@jbrowse/core/util'
|
|
15
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
13
16
|
|
|
14
17
|
// locals
|
|
15
18
|
import Tooltip from '../components/Tooltip'
|
|
16
|
-
import { getUniqueModificationValues } from '../../shared'
|
|
19
|
+
import { FilterModel, getUniqueModificationValues } from '../../shared'
|
|
17
20
|
|
|
18
21
|
// using a map because it preserves order
|
|
19
22
|
const rendererTypes = new Map([['snpcoverage', 'SNPCoverageRenderer']])
|
|
@@ -52,17 +55,7 @@ function stateModelFactory(
|
|
|
52
55
|
/**
|
|
53
56
|
* #property
|
|
54
57
|
*/
|
|
55
|
-
filterBy: types.optional(
|
|
56
|
-
types.model({
|
|
57
|
-
flagInclude: types.optional(types.number, 0),
|
|
58
|
-
flagExclude: types.optional(types.number, 1540),
|
|
59
|
-
readName: types.maybe(types.string),
|
|
60
|
-
tagFilter: types.maybe(
|
|
61
|
-
types.model({ tag: types.string, value: types.string }),
|
|
62
|
-
),
|
|
63
|
-
}),
|
|
64
|
-
{},
|
|
65
|
-
),
|
|
58
|
+
filterBy: types.optional(FilterModel, {}),
|
|
66
59
|
/**
|
|
67
60
|
* #property
|
|
68
61
|
*/
|
|
@@ -75,7 +68,7 @@ function stateModelFactory(
|
|
|
75
68
|
}),
|
|
76
69
|
)
|
|
77
70
|
.volatile(() => ({
|
|
78
|
-
modificationTagMap:
|
|
71
|
+
modificationTagMap: undefined as Record<string, string> | undefined,
|
|
79
72
|
}))
|
|
80
73
|
.actions(self => ({
|
|
81
74
|
/**
|
|
@@ -109,12 +102,14 @@ function stateModelFactory(
|
|
|
109
102
|
const colorPalette = ['red', 'blue', 'green', 'orange', 'purple']
|
|
110
103
|
let i = 0
|
|
111
104
|
|
|
105
|
+
const newMap = clone(self.modificationTagMap) || {}
|
|
112
106
|
uniqueModifications.forEach(value => {
|
|
113
|
-
if (!
|
|
107
|
+
if (!newMap[value]) {
|
|
114
108
|
const newColor = colorPalette[i++]
|
|
115
|
-
|
|
109
|
+
newMap[value] = newColor
|
|
116
110
|
}
|
|
117
111
|
})
|
|
112
|
+
self.modificationTagMap = newMap
|
|
118
113
|
},
|
|
119
114
|
}))
|
|
120
115
|
.views(self => {
|
|
@@ -170,8 +165,7 @@ function stateModelFactory(
|
|
|
170
165
|
*/
|
|
171
166
|
get modificationsReady() {
|
|
172
167
|
return self.colorBy?.type === 'modifications'
|
|
173
|
-
?
|
|
174
|
-
.length > 0
|
|
168
|
+
? self.modificationTagMap !== undefined
|
|
175
169
|
: true
|
|
176
170
|
},
|
|
177
171
|
|
|
@@ -184,7 +178,7 @@ function stateModelFactory(
|
|
|
184
178
|
return {
|
|
185
179
|
...superProps,
|
|
186
180
|
notReady: superProps.notReady || !this.modificationsReady,
|
|
187
|
-
modificationTagMap:
|
|
181
|
+
modificationTagMap: modificationTagMap,
|
|
188
182
|
|
|
189
183
|
// must use getSnapshot because otherwise changes to e.g. just the
|
|
190
184
|
// colorBy.type are not read
|