@jbrowse/plugin-alignments 2.2.2 → 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/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/SetFeatureHeight.d.ts +2 -2
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.js +2 -4
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.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 +19 -20
- package/dist/LinearSNPCoverageDisplay/models/model.js +1 -6
- 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/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/generateCoverageBins.js +1 -1
- package/dist/SNPCoverageAdapter/generateCoverageBins.js.map +1 -1
- 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 +3 -9
- 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/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/SetFeatureHeight.d.ts +2 -2
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.js +2 -4
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.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 +19 -20
- package/esm/LinearSNPCoverageDisplay/models/model.js +2 -7
- 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/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/generateCoverageBins.js +1 -1
- package/esm/SNPCoverageAdapter/generateCoverageBins.js.map +1 -1
- 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 +3 -9
- 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 +4 -4
- 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/__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/SetFeatureHeight.tsx +4 -6
- 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 +3 -13
- 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/index.ts +1 -0
- package/src/PileupRenderer/sortUtil.ts +2 -3
- package/src/SNPCoverageAdapter/generateCoverageBins.ts +1 -1
- package/src/SNPCoverageAdapter/index.ts +1 -3
- package/src/index.ts +12 -93
- package/src/{LinearPileupDisplay/components → shared}/FilterByTag.tsx +3 -9
- 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,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',
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
AnyConfigurationModel,
|
|
12
12
|
} from '@jbrowse/core/configuration'
|
|
13
13
|
import { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle'
|
|
14
|
-
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
15
14
|
import { getContainingView } from '@jbrowse/core/util'
|
|
15
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
16
16
|
|
|
17
17
|
// locals
|
|
18
18
|
import Tooltip from '../components/Tooltip'
|
|
19
|
-
import { getUniqueModificationValues } from '../../shared'
|
|
19
|
+
import { FilterModel, getUniqueModificationValues } from '../../shared'
|
|
20
20
|
|
|
21
21
|
// using a map because it preserves order
|
|
22
22
|
const rendererTypes = new Map([['snpcoverage', 'SNPCoverageRenderer']])
|
|
@@ -55,17 +55,7 @@ function stateModelFactory(
|
|
|
55
55
|
/**
|
|
56
56
|
* #property
|
|
57
57
|
*/
|
|
58
|
-
filterBy: types.optional(
|
|
59
|
-
types.model({
|
|
60
|
-
flagInclude: types.optional(types.number, 0),
|
|
61
|
-
flagExclude: types.optional(types.number, 1540),
|
|
62
|
-
readName: types.maybe(types.string),
|
|
63
|
-
tagFilter: types.maybe(
|
|
64
|
-
types.model({ tag: types.string, value: types.string }),
|
|
65
|
-
),
|
|
66
|
-
}),
|
|
67
|
-
{},
|
|
68
|
-
),
|
|
58
|
+
filterBy: types.optional(FilterModel, {}),
|
|
69
59
|
/**
|
|
70
60
|
* #property
|
|
71
61
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { revcom } from '@jbrowse/core/util'
|
|
1
|
+
import { revcom, Feature } from '@jbrowse/core/util'
|
|
2
|
+
|
|
2
3
|
export interface Mismatch {
|
|
3
4
|
qual?: number
|
|
4
5
|
start: number
|
|
@@ -11,9 +12,14 @@ export interface Mismatch {
|
|
|
11
12
|
}
|
|
12
13
|
const mdRegex = new RegExp(/(\d+|\^[a-z]+|[a-z])/gi)
|
|
13
14
|
const modificationRegex = new RegExp(/([A-Z])([-+])([^,.?]+)([.?])?/)
|
|
15
|
+
const cigarRegex = new RegExp(/([MIDNSHPX=])/)
|
|
16
|
+
const startClip = new RegExp(/(\d+)[SH]$/)
|
|
17
|
+
const endClip = new RegExp(/^(\d+)([SH])/)
|
|
18
|
+
|
|
14
19
|
export function parseCigar(cigar = '') {
|
|
15
|
-
return cigar.split(
|
|
20
|
+
return cigar.split(cigarRegex).slice(0, -1)
|
|
16
21
|
}
|
|
22
|
+
|
|
17
23
|
export function cigarToMismatches(
|
|
18
24
|
ops: string[],
|
|
19
25
|
seq?: string,
|
|
@@ -339,3 +345,124 @@ export function getModificationTypes(mm: string) {
|
|
|
339
345
|
})
|
|
340
346
|
.flat()
|
|
341
347
|
}
|
|
348
|
+
|
|
349
|
+
export function getOrientedCigar(flip: boolean, cigar: string[]) {
|
|
350
|
+
if (flip) {
|
|
351
|
+
const ret = []
|
|
352
|
+
for (let i = 0; i < cigar.length; i += 2) {
|
|
353
|
+
const len = cigar[i]
|
|
354
|
+
let op = cigar[i + 1]
|
|
355
|
+
if (op === 'D') {
|
|
356
|
+
op = 'I'
|
|
357
|
+
} else if (op === 'I') {
|
|
358
|
+
op = 'D'
|
|
359
|
+
}
|
|
360
|
+
ret.push(len)
|
|
361
|
+
ret.push(op)
|
|
362
|
+
}
|
|
363
|
+
return ret
|
|
364
|
+
} else {
|
|
365
|
+
return cigar
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export function getOrientedMismatches(flip: boolean, cigar: string) {
|
|
370
|
+
const p = parseCigar(cigar)
|
|
371
|
+
return cigarToMismatches(flip ? getOrientedCigar(flip, p) : p)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export function getLengthOnRef(cigar: string) {
|
|
375
|
+
const cigarOps = parseCigar(cigar)
|
|
376
|
+
let lengthOnRef = 0
|
|
377
|
+
for (let i = 0; i < cigarOps.length; i += 2) {
|
|
378
|
+
const len = +cigarOps[i]
|
|
379
|
+
const op = cigarOps[i + 1]
|
|
380
|
+
if (op !== 'H' && op !== 'S' && op !== 'I') {
|
|
381
|
+
lengthOnRef += len
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return lengthOnRef
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export function getLength(cigar: string) {
|
|
388
|
+
const cigarOps = parseCigar(cigar)
|
|
389
|
+
let length = 0
|
|
390
|
+
for (let i = 0; i < cigarOps.length; i += 2) {
|
|
391
|
+
const len = +cigarOps[i]
|
|
392
|
+
const op = cigarOps[i + 1]
|
|
393
|
+
if (op !== 'D' && op !== 'N') {
|
|
394
|
+
length += len
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return length
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export function getLengthSansClipping(cigar: string) {
|
|
401
|
+
const cigarOps = parseCigar(cigar)
|
|
402
|
+
let length = 0
|
|
403
|
+
for (let i = 0; i < cigarOps.length; i += 2) {
|
|
404
|
+
const len = +cigarOps[i]
|
|
405
|
+
const op = cigarOps[i + 1]
|
|
406
|
+
if (op !== 'H' && op !== 'S' && op !== 'D' && op !== 'N') {
|
|
407
|
+
length += len
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return length
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export function getClip(cigar: string, strand: number) {
|
|
414
|
+
return strand === -1
|
|
415
|
+
? +(cigar.match(startClip) || [])[1] || 0
|
|
416
|
+
: +(cigar.match(endClip) || [])[1] || 0
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export function getTag(f: Feature, tag: string) {
|
|
420
|
+
const tags = f.get('tags')
|
|
421
|
+
return tags ? tags[tag] : f.get(tag)
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// produces a list of "feature-like" object from parsing supplementary
|
|
425
|
+
// alignments in the SA tag
|
|
426
|
+
//
|
|
427
|
+
// @param normalize - used specifically in the linear-read-vs-ref context, it
|
|
428
|
+
// flips features around relative to the original feature. other contexts of
|
|
429
|
+
// usage can keep this false
|
|
430
|
+
export function featurizeSA(
|
|
431
|
+
SA: string | undefined,
|
|
432
|
+
id: string,
|
|
433
|
+
strand: number,
|
|
434
|
+
readName: string,
|
|
435
|
+
normalize?: boolean,
|
|
436
|
+
) {
|
|
437
|
+
return (
|
|
438
|
+
SA?.split(';')
|
|
439
|
+
.filter(aln => !!aln)
|
|
440
|
+
.map((aln, index) => {
|
|
441
|
+
const [saRef, saStart, saStrand, saCigar] = aln.split(',')
|
|
442
|
+
const saLengthOnRef = getLengthOnRef(saCigar)
|
|
443
|
+
const saLength = getLength(saCigar)
|
|
444
|
+
const saLengthSansClipping = getLengthSansClipping(saCigar)
|
|
445
|
+
const saStrandNormalized = saStrand === '-' ? -1 : 1
|
|
446
|
+
const saClipPos = getClip(
|
|
447
|
+
saCigar,
|
|
448
|
+
(normalize ? strand : 1) * saStrandNormalized,
|
|
449
|
+
)
|
|
450
|
+
const saRealStart = +saStart - 1
|
|
451
|
+
return {
|
|
452
|
+
refName: saRef,
|
|
453
|
+
start: saRealStart,
|
|
454
|
+
end: saRealStart + saLengthOnRef,
|
|
455
|
+
seqLength: saLength,
|
|
456
|
+
clipPos: saClipPos,
|
|
457
|
+
CIGAR: saCigar,
|
|
458
|
+
strand: (normalize ? strand : 1) * saStrandNormalized,
|
|
459
|
+
uniqueId: `${id}_SA${index}`,
|
|
460
|
+
mate: {
|
|
461
|
+
start: saClipPos,
|
|
462
|
+
end: saClipPos + saLengthSansClipping,
|
|
463
|
+
refName: readName,
|
|
464
|
+
},
|
|
465
|
+
}
|
|
466
|
+
}) || []
|
|
467
|
+
)
|
|
468
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'
|
|
2
|
+
import { renameRegionsIfNeeded } from '@jbrowse/core/util'
|
|
3
|
+
import { RenderArgs } from '@jbrowse/core/rpc/coreRpcMethods'
|
|
4
|
+
|
|
5
|
+
// specialized get features to return limited data about alignments
|
|
6
|
+
export default abstract class PileupBaseRPC extends RpcMethodType {
|
|
7
|
+
async serializeArguments(
|
|
8
|
+
args: RenderArgs & {
|
|
9
|
+
signal?: AbortSignal
|
|
10
|
+
statusCallback?: (arg: string) => void
|
|
11
|
+
},
|
|
12
|
+
rpcDriver: string,
|
|
13
|
+
) {
|
|
14
|
+
const { rootModel } = this.pluginManager
|
|
15
|
+
const assemblyManager = rootModel?.session?.assemblyManager
|
|
16
|
+
if (!assemblyManager) {
|
|
17
|
+
throw new Error('no assembly manager available')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const renamedArgs = await renameRegionsIfNeeded(assemblyManager, args)
|
|
21
|
+
|
|
22
|
+
return super.serializeArguments(renamedArgs, rpcDriver)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
+
import {
|
|
3
|
+
PileupGetGlobalValueForTag,
|
|
4
|
+
PileupGetVisibleModifications,
|
|
5
|
+
PileupGetReducedFeatures,
|
|
6
|
+
} from './rpcMethods'
|
|
7
|
+
|
|
8
|
+
export default (pm: PluginManager) => {
|
|
9
|
+
pm.addRpcMethod(() => new PileupGetGlobalValueForTag(pm))
|
|
10
|
+
pm.addRpcMethod(() => new PileupGetVisibleModifications(pm))
|
|
11
|
+
pm.addRpcMethod(() => new PileupGetReducedFeatures(pm))
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'
|
|
2
|
+
import { Region } from '@jbrowse/core/util'
|
|
3
|
+
import { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'
|
|
4
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
|
+
import { toArray } from 'rxjs/operators'
|
|
6
|
+
import PileupBaseRPC from '../base'
|
|
7
|
+
import { getTag } from '../../util'
|
|
8
|
+
|
|
9
|
+
export default class PileupGetGlobalValueForTag extends PileupBaseRPC {
|
|
10
|
+
name = 'PileupGetGlobalValueForTag'
|
|
11
|
+
|
|
12
|
+
async execute(
|
|
13
|
+
args: {
|
|
14
|
+
adapterConfig: {}
|
|
15
|
+
signal?: RemoteAbortSignal
|
|
16
|
+
headers?: Record<string, string>
|
|
17
|
+
regions: Region[]
|
|
18
|
+
sessionId: string
|
|
19
|
+
tag: string
|
|
20
|
+
},
|
|
21
|
+
rpcDriver: string,
|
|
22
|
+
) {
|
|
23
|
+
const { adapterConfig, sessionId, regions, tag } =
|
|
24
|
+
await this.deserializeArguments(args, rpcDriver)
|
|
25
|
+
|
|
26
|
+
const dataAdapter = (
|
|
27
|
+
await getAdapter(this.pluginManager, sessionId, adapterConfig)
|
|
28
|
+
).dataAdapter as BaseFeatureDataAdapter
|
|
29
|
+
|
|
30
|
+
const features = dataAdapter.getFeaturesInMultipleRegions(regions)
|
|
31
|
+
const featuresArray = await features.pipe(toArray()).toPromise()
|
|
32
|
+
return [
|
|
33
|
+
...new Set(
|
|
34
|
+
featuresArray
|
|
35
|
+
.map(feature => getTag(feature, tag))
|
|
36
|
+
.filter(f => f !== undefined)
|
|
37
|
+
.map(f => `${f}`),
|
|
38
|
+
),
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'
|
|
2
|
+
import { Region, dedupe } from '@jbrowse/core/util'
|
|
3
|
+
import { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'
|
|
4
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
|
+
import { toArray } from 'rxjs/operators'
|
|
6
|
+
|
|
7
|
+
// locals
|
|
8
|
+
import { filterForPairs, getInsertSizeStats } from '../util'
|
|
9
|
+
import { ReducedFeature } from '../../shared/fetchChains'
|
|
10
|
+
import PileupBaseRPC from '../base'
|
|
11
|
+
import { getTag } from '../../util'
|
|
12
|
+
|
|
13
|
+
// specialized get features to return limited data about alignments
|
|
14
|
+
export default class PileupGetReducedFeatures extends PileupBaseRPC {
|
|
15
|
+
name = 'PileupGetReducedFeatures'
|
|
16
|
+
|
|
17
|
+
async execute(
|
|
18
|
+
args: {
|
|
19
|
+
adapterConfig: {}
|
|
20
|
+
signal?: RemoteAbortSignal
|
|
21
|
+
headers?: Record<string, string>
|
|
22
|
+
regions: Region[]
|
|
23
|
+
sessionId: string
|
|
24
|
+
tag: string
|
|
25
|
+
},
|
|
26
|
+
rpcDriver: string,
|
|
27
|
+
) {
|
|
28
|
+
const des = await this.deserializeArguments(args, rpcDriver)
|
|
29
|
+
const { adapterConfig, sessionId, regions } = des
|
|
30
|
+
const dataAdapter = (
|
|
31
|
+
await getAdapter(this.pluginManager, sessionId, adapterConfig)
|
|
32
|
+
).dataAdapter as BaseFeatureDataAdapter
|
|
33
|
+
|
|
34
|
+
const featuresArray = await dataAdapter
|
|
35
|
+
.getFeaturesInMultipleRegions(regions, des)
|
|
36
|
+
.pipe(toArray())
|
|
37
|
+
.toPromise()
|
|
38
|
+
|
|
39
|
+
const reduced = dedupe(
|
|
40
|
+
featuresArray.map(f => ({
|
|
41
|
+
id: f.id(),
|
|
42
|
+
refName: f.get('refName'),
|
|
43
|
+
name: f.get('name'),
|
|
44
|
+
start: f.get('start'),
|
|
45
|
+
strand: f.get('strand'),
|
|
46
|
+
end: f.get('end'),
|
|
47
|
+
flags: f.get('flags'),
|
|
48
|
+
tlen: f.get('template_length'),
|
|
49
|
+
pair_orientation: f.get('pair_orientation'),
|
|
50
|
+
next_ref: f.get('next_ref'),
|
|
51
|
+
next_pos: f.get('next_pos'),
|
|
52
|
+
clipPos: f.get('clipPos'),
|
|
53
|
+
SA: getTag(f, 'SA'),
|
|
54
|
+
})),
|
|
55
|
+
f => f.id,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
const filtered = filterForPairs(reduced)
|
|
59
|
+
const stats = filtered.length ? getInsertSizeStats(filtered) : undefined
|
|
60
|
+
const chains = {} as { [key: string]: ReducedFeature[] }
|
|
61
|
+
|
|
62
|
+
// pair features
|
|
63
|
+
reduced.forEach(f => {
|
|
64
|
+
if (!chains[f.name]) {
|
|
65
|
+
chains[f.name] = []
|
|
66
|
+
}
|
|
67
|
+
chains[f.name].push(f)
|
|
68
|
+
})
|
|
69
|
+
return {
|
|
70
|
+
chains: Object.values(chains),
|
|
71
|
+
stats,
|
|
72
|
+
hasPaired: !!stats,
|
|
73
|
+
containsNoTransferables: true,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|