@jbrowse/plugin-alignments 2.16.0 → 2.17.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 +2 -3
- package/dist/AlignmentsFeatureDetail/Flags.js +2 -2
- package/dist/AlignmentsFeatureDetail/LinkedPairedAlignments.js +2 -2
- package/dist/AlignmentsFeatureDetail/SupplementaryAlignments.js +2 -2
- package/dist/AlignmentsFeatureDetail/getSAFeatures.js +2 -2
- package/dist/AlignmentsFeatureDetail/stateModelFactory.d.ts +1 -1
- package/dist/BamAdapter/BamAdapter.d.ts +3 -2
- package/dist/BamAdapter/BamAdapter.js +34 -11
- package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -17
- package/dist/BamAdapter/BamSlightlyLazyFeature.js +42 -72
- package/dist/CramAdapter/CramAdapter.d.ts +4 -3
- package/dist/CramAdapter/CramAdapter.js +24 -7
- package/dist/CramAdapter/CramSlightlyLazyFeature.d.ts +21 -27
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +74 -73
- package/dist/CramAdapter/util.d.ts +1 -10
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +1 -1
- package/dist/LinearAlignmentsDisplay/index.js +2 -2
- package/dist/LinearAlignmentsDisplay/{models/model.d.ts → model.d.ts} +6 -3
- package/dist/LinearAlignmentsDisplay/{models/model.js → model.js} +11 -7
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +6 -27
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +43 -21
- package/dist/LinearPileupDisplay/components/ColorByTagDialog.d.ts +5 -4
- package/dist/LinearPileupDisplay/components/ColorByTagDialog.js +3 -1
- package/dist/LinearPileupDisplay/components/GroupByDialog.js +8 -6
- package/dist/LinearPileupDisplay/components/SortByTagDialog.js +6 -4
- package/dist/LinearPileupDisplay/model.d.ts +41 -45
- package/dist/LinearPileupDisplay/model.js +118 -41
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js +1 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +22 -21
- package/dist/LinearReadArcsDisplay/model.js +13 -14
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js +1 -1
- package/dist/LinearReadCloudDisplay/model.d.ts +14 -22
- package/dist/LinearReadCloudDisplay/model.js +12 -13
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +49 -19
- package/dist/LinearSNPCoverageDisplay/index.js +3 -2
- package/dist/LinearSNPCoverageDisplay/{models/model.d.ts → model.d.ts} +3 -13
- package/dist/LinearSNPCoverageDisplay/{models/model.js → model.js} +71 -45
- package/dist/MismatchParser/cigarToMismatches.d.ts +3 -0
- package/dist/MismatchParser/cigarToMismatches.js +94 -0
- package/dist/MismatchParser/getNextRefPos.d.ts +4 -0
- package/dist/MismatchParser/getNextRefPos.js +40 -0
- package/dist/MismatchParser/index.d.ts +4 -29
- package/dist/MismatchParser/index.js +10 -321
- package/dist/MismatchParser/mdToMismatches.d.ts +3 -0
- package/dist/MismatchParser/mdToMismatches.js +80 -0
- package/dist/ModificationParser/index.d.ts +19 -0
- package/dist/ModificationParser/index.js +144 -0
- package/dist/PileupRPC/methods/GetGlobalValueForTag.js +1 -2
- package/dist/PileupRPC/methods/GetReducedFeatures.d.ts +1 -1
- package/dist/PileupRPC/methods/GetReducedFeatures.js +19 -16
- package/dist/PileupRPC/methods/GetVisibleModifications.d.ts +2 -1
- package/dist/PileupRPC/methods/GetVisibleModifications.js +9 -6
- package/dist/PileupRenderer/PileupLayoutSession.d.ts +8 -7
- package/dist/PileupRenderer/PileupRenderer.d.ts +6 -14
- package/dist/PileupRenderer/PileupRenderer.js +7 -5
- package/dist/PileupRenderer/renderAlignment.js +17 -4
- package/dist/PileupRenderer/renderAlignmentShape.js +102 -21
- package/dist/PileupRenderer/renderMethylation.d.ts +2 -1
- package/dist/PileupRenderer/renderMethylation.js +17 -9
- package/dist/PileupRenderer/renderMismatches.js +19 -19
- package/dist/PileupRenderer/renderModifications.d.ts +3 -2
- package/dist/PileupRenderer/renderModifications.js +31 -34
- package/dist/PileupRenderer/renderPerBaseLettering.d.ts +2 -1
- package/dist/PileupRenderer/renderPerBaseLettering.js +1 -3
- package/dist/PileupRenderer/renderPerBaseQuality.d.ts +2 -1
- package/dist/PileupRenderer/renderPerBaseQuality.js +1 -3
- package/dist/PileupRenderer/renderSoftClipping.js +6 -6
- package/dist/PileupRenderer/sortUtil.d.ts +2 -7
- package/dist/PileupRenderer/sortUtil.js +13 -13
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +10 -5
- package/dist/SNPCoverageAdapter/generateCoverageBins.d.ts +13 -9
- package/dist/SNPCoverageAdapter/generateCoverageBins.js +269 -166
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +2 -1
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +171 -54
- package/dist/shared/color.d.ts +0 -10
- package/dist/shared/color.js +1 -7
- package/{esm/shared → dist/shared/components}/BaseDisplayComponent.d.ts +2 -2
- package/{esm/shared → dist/shared/components}/FilterByTagDialog.d.ts +3 -3
- package/dist/shared/{FilterByTagDialog.js → components/FilterByTagDialog.js} +5 -1
- package/dist/shared/fetchChains.js +1 -2
- package/dist/shared/getMaximumModificationAtEachPosition.d.ts +8 -0
- package/dist/shared/getMaximumModificationAtEachPosition.js +42 -0
- package/dist/shared/getUniqueModifications.d.ts +14 -0
- package/dist/shared/getUniqueModifications.js +16 -0
- package/dist/shared/getUniqueTags.d.ts +15 -0
- package/dist/shared/getUniqueTags.js +18 -0
- package/dist/shared/types.d.ts +94 -0
- package/dist/shared/util.d.ts +8 -0
- package/dist/shared/util.js +26 -0
- package/dist/util.d.ts +7 -4
- package/dist/util.js +30 -30
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +2 -3
- package/esm/AlignmentsFeatureDetail/Flags.js +1 -1
- package/esm/AlignmentsFeatureDetail/LinkedPairedAlignments.js +1 -1
- package/esm/AlignmentsFeatureDetail/SupplementaryAlignments.js +1 -1
- package/esm/AlignmentsFeatureDetail/getSAFeatures.js +2 -2
- package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +1 -1
- package/esm/BamAdapter/BamAdapter.d.ts +3 -2
- package/esm/BamAdapter/BamAdapter.js +31 -8
- package/esm/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -17
- package/esm/BamAdapter/BamSlightlyLazyFeature.js +43 -73
- package/esm/CramAdapter/CramAdapter.d.ts +4 -3
- package/esm/CramAdapter/CramAdapter.js +22 -5
- package/esm/CramAdapter/CramSlightlyLazyFeature.d.ts +21 -27
- package/esm/CramAdapter/CramSlightlyLazyFeature.js +74 -73
- package/esm/CramAdapter/util.d.ts +1 -10
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +1 -1
- package/esm/LinearAlignmentsDisplay/index.js +2 -2
- package/esm/LinearAlignmentsDisplay/{models/model.d.ts → model.d.ts} +6 -3
- package/esm/LinearAlignmentsDisplay/{models/model.js → model.js} +11 -7
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +6 -27
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +45 -23
- package/esm/LinearPileupDisplay/components/ColorByTagDialog.d.ts +5 -4
- package/esm/LinearPileupDisplay/components/ColorByTagDialog.js +3 -1
- package/esm/LinearPileupDisplay/components/GroupByDialog.js +8 -6
- package/esm/LinearPileupDisplay/components/SortByTagDialog.js +6 -4
- package/esm/LinearPileupDisplay/model.d.ts +41 -45
- package/esm/LinearPileupDisplay/model.js +119 -42
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js +1 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +22 -21
- package/esm/LinearReadArcsDisplay/model.js +14 -15
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js +1 -1
- package/esm/LinearReadCloudDisplay/model.d.ts +14 -22
- package/esm/LinearReadCloudDisplay/model.js +13 -14
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +49 -19
- package/esm/LinearSNPCoverageDisplay/index.js +3 -2
- package/esm/LinearSNPCoverageDisplay/{models/model.d.ts → model.d.ts} +3 -13
- package/esm/LinearSNPCoverageDisplay/{models/model.js → model.js} +72 -46
- package/esm/MismatchParser/cigarToMismatches.d.ts +3 -0
- package/esm/MismatchParser/cigarToMismatches.js +91 -0
- package/esm/MismatchParser/getNextRefPos.d.ts +4 -0
- package/esm/MismatchParser/getNextRefPos.js +37 -0
- package/esm/MismatchParser/index.d.ts +4 -29
- package/esm/MismatchParser/index.js +5 -311
- package/esm/MismatchParser/mdToMismatches.d.ts +3 -0
- package/esm/MismatchParser/mdToMismatches.js +77 -0
- package/esm/ModificationParser/index.d.ts +19 -0
- package/esm/ModificationParser/index.js +138 -0
- package/esm/PileupRPC/methods/GetGlobalValueForTag.js +1 -2
- package/esm/PileupRPC/methods/GetReducedFeatures.d.ts +1 -1
- package/esm/PileupRPC/methods/GetReducedFeatures.js +19 -16
- package/esm/PileupRPC/methods/GetVisibleModifications.d.ts +2 -1
- package/esm/PileupRPC/methods/GetVisibleModifications.js +9 -6
- package/esm/PileupRenderer/PileupLayoutSession.d.ts +8 -7
- package/esm/PileupRenderer/PileupRenderer.d.ts +6 -14
- package/esm/PileupRenderer/PileupRenderer.js +8 -6
- package/esm/PileupRenderer/renderAlignment.js +17 -4
- package/esm/PileupRenderer/renderAlignmentShape.js +102 -21
- package/esm/PileupRenderer/renderMethylation.d.ts +2 -1
- package/esm/PileupRenderer/renderMethylation.js +17 -9
- package/esm/PileupRenderer/renderMismatches.js +19 -19
- package/esm/PileupRenderer/renderModifications.d.ts +3 -2
- package/esm/PileupRenderer/renderModifications.js +30 -33
- package/esm/PileupRenderer/renderPerBaseLettering.d.ts +2 -1
- package/esm/PileupRenderer/renderPerBaseLettering.js +1 -3
- package/esm/PileupRenderer/renderPerBaseQuality.d.ts +2 -1
- package/esm/PileupRenderer/renderPerBaseQuality.js +1 -3
- package/esm/PileupRenderer/renderSoftClipping.js +6 -6
- package/esm/PileupRenderer/sortUtil.d.ts +2 -7
- package/esm/PileupRenderer/sortUtil.js +13 -13
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js +10 -5
- package/esm/SNPCoverageAdapter/generateCoverageBins.d.ts +13 -9
- package/esm/SNPCoverageAdapter/generateCoverageBins.js +269 -166
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +2 -1
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +171 -54
- package/esm/shared/color.d.ts +0 -10
- package/esm/shared/color.js +0 -6
- package/{dist/shared → esm/shared/components}/BaseDisplayComponent.d.ts +2 -2
- package/{dist/shared → esm/shared/components}/FilterByTagDialog.d.ts +3 -3
- package/esm/shared/{FilterByTagDialog.js → components/FilterByTagDialog.js} +5 -1
- package/esm/shared/fetchChains.js +1 -2
- package/esm/shared/getMaximumModificationAtEachPosition.d.ts +8 -0
- package/esm/shared/getMaximumModificationAtEachPosition.js +39 -0
- package/esm/shared/getUniqueModifications.d.ts +14 -0
- package/esm/shared/getUniqueModifications.js +13 -0
- package/esm/shared/getUniqueTags.d.ts +15 -0
- package/esm/shared/getUniqueTags.js +15 -0
- package/esm/shared/types.d.ts +94 -0
- package/esm/shared/util.d.ts +8 -0
- package/esm/shared/util.js +23 -0
- package/esm/util.d.ts +7 -4
- package/esm/util.js +28 -27
- package/package.json +4 -4
- package/dist/LinearPileupDisplay/components/ColorByModificationsDialog.d.ts +0 -15
- package/dist/LinearPileupDisplay/components/ColorByModificationsDialog.js +0 -41
- package/dist/LinearPileupDisplay/components/ModificationsTable.d.ts +0 -4
- package/dist/LinearPileupDisplay/components/ModificationsTable.js +0 -28
- package/dist/SNPCoverageAdapter/util.d.ts +0 -25
- package/dist/shared/index.d.ts +0 -49
- package/dist/shared/index.js +0 -41
- package/esm/LinearPileupDisplay/components/ColorByModificationsDialog.d.ts +0 -15
- package/esm/LinearPileupDisplay/components/ColorByModificationsDialog.js +0 -36
- package/esm/LinearPileupDisplay/components/ModificationsTable.d.ts +0 -4
- package/esm/LinearPileupDisplay/components/ModificationsTable.js +0 -22
- package/esm/SNPCoverageAdapter/util.d.ts +0 -25
- package/esm/shared/index.d.ts +0 -49
- package/esm/shared/index.js +0 -36
- /package/dist/LinearAlignmentsDisplay/{models/alignmentsModel.d.ts → alignmentsModel.d.ts} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/alignmentsModel.js → alignmentsModel.js} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/util.d.ts → util.d.ts} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/util.js → util.js} +0 -0
- /package/dist/LinearSNPCoverageDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/dist/LinearSNPCoverageDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/dist/shared/{BaseDisplayComponent.js → components/BaseDisplayComponent.js} +0 -0
- /package/dist/shared/{renderSvg.d.ts → renderSvgUtil.d.ts} +0 -0
- /package/dist/shared/{renderSvg.js → renderSvgUtil.js} +0 -0
- /package/dist/{SNPCoverageAdapter/util.js → shared/types.js} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/alignmentsModel.d.ts → alignmentsModel.d.ts} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/alignmentsModel.js → alignmentsModel.js} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/util.d.ts → util.d.ts} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/util.js → util.js} +0 -0
- /package/esm/LinearSNPCoverageDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/esm/LinearSNPCoverageDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/esm/shared/{BaseDisplayComponent.js → components/BaseDisplayComponent.js} +0 -0
- /package/esm/shared/{renderSvg.d.ts → renderSvgUtil.d.ts} +0 -0
- /package/esm/shared/{renderSvg.js → renderSvgUtil.js} +0 -0
- /package/esm/{SNPCoverageAdapter/util.js → shared/types.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import { getContainingView } from '@jbrowse/core/util';
|
|
4
|
-
import BaseDisplayComponent from '../../shared/BaseDisplayComponent';
|
|
4
|
+
import BaseDisplayComponent from '../../shared/components/BaseDisplayComponent';
|
|
5
5
|
const Cloud = observer(function ({ model, }) {
|
|
6
6
|
const view = getContainingView(model);
|
|
7
7
|
const width = Math.round(view.dynamicBlocks.totalWidthPx);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Instance } from 'mobx-state-tree';
|
|
3
3
|
import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
4
|
-
import {
|
|
4
|
+
import { ColorBy, FilterBy } from '../shared/types';
|
|
5
5
|
import { ChainData } from '../shared/fetchChains';
|
|
6
6
|
/**
|
|
7
7
|
* #stateModel LinearReadCloudDisplay
|
|
@@ -23,20 +23,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
23
23
|
} & {
|
|
24
24
|
type: import("mobx-state-tree").ISimpleType<"LinearReadCloudDisplay">;
|
|
25
25
|
configuration: AnyConfigurationSchemaType;
|
|
26
|
-
filterBy: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").
|
|
27
|
-
|
|
28
|
-
flagExclude: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
29
|
-
readName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
30
|
-
tagFilter: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IModelType<{
|
|
31
|
-
tag: import("mobx-state-tree").ISimpleType<string>;
|
|
32
|
-
value: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
33
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
34
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
35
|
-
colorBy: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IModelType<{
|
|
36
|
-
type: import("mobx-state-tree").ISimpleType<string>;
|
|
37
|
-
tag: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
38
|
-
extra: import("mobx-state-tree").IType<any, any, any>;
|
|
39
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
26
|
+
filterBy: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<FilterBy, FilterBy, FilterBy>, [undefined]>;
|
|
27
|
+
colorBy: import("mobx-state-tree").IType<ColorBy | undefined, ColorBy | undefined, ColorBy | undefined>;
|
|
40
28
|
drawSingletons: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
41
29
|
}, {
|
|
42
30
|
rendererTypeName: string;
|
|
@@ -55,9 +43,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
55
43
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
56
44
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
57
45
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
58
|
-
rpcDriverName: import("mobx-state-tree"
|
|
59
|
-
* #property
|
|
60
|
-
*/).IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
46
|
+
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
61
47
|
}, {
|
|
62
48
|
rendererTypeName: string;
|
|
63
49
|
error: unknown;
|
|
@@ -76,14 +62,20 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
76
62
|
error: unknown;
|
|
77
63
|
message: string | undefined;
|
|
78
64
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
79
|
-
id: import(
|
|
65
|
+
id: import(
|
|
66
|
+
/**
|
|
67
|
+
* #action
|
|
68
|
+
*/
|
|
69
|
+
"mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
80
70
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
81
71
|
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
82
72
|
}, {
|
|
83
73
|
rendererTypeName: string;
|
|
84
74
|
error: unknown;
|
|
85
75
|
message: string | undefined;
|
|
86
|
-
}, import("mobx-state-tree"
|
|
76
|
+
}, import("mobx-state-tree" /**
|
|
77
|
+
* #action
|
|
78
|
+
*/)._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
87
79
|
}> | null;
|
|
88
80
|
readonly adapterConfig: any;
|
|
89
81
|
readonly parentTrack: any;
|
|
@@ -164,7 +156,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
164
156
|
* the canvas
|
|
165
157
|
*/
|
|
166
158
|
setRef(ref: HTMLCanvasElement | null): void;
|
|
167
|
-
setColorScheme(
|
|
159
|
+
setColorScheme(colorBy: {
|
|
168
160
|
type: string;
|
|
169
161
|
}): void;
|
|
170
162
|
/**
|
|
@@ -174,7 +166,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
174
166
|
/**
|
|
175
167
|
* #action
|
|
176
168
|
*/
|
|
177
|
-
setFilterBy(filter:
|
|
169
|
+
setFilterBy(filter: FilterBy): void;
|
|
178
170
|
} & {
|
|
179
171
|
readonly drawn: boolean;
|
|
180
172
|
} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { types } from 'mobx-state-tree';
|
|
3
3
|
import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes';
|
|
4
4
|
import { ConfigurationReference, } from '@jbrowse/core/configuration';
|
|
5
5
|
import { getSession } from '@jbrowse/core/util';
|
|
@@ -7,10 +7,9 @@ import { FeatureDensityMixin, TrackHeightMixin, } from '@jbrowse/plugin-linear-g
|
|
|
7
7
|
// icons
|
|
8
8
|
import PaletteIcon from '@mui/icons-material/Palette';
|
|
9
9
|
import FilterListIcon from '@mui/icons-material/ClearAll';
|
|
10
|
-
|
|
11
|
-
import { FilterModel } from '../shared';
|
|
10
|
+
import { defaultFilterFlags } from '../shared/util';
|
|
12
11
|
// async
|
|
13
|
-
const FilterByTagDialog = lazy(() => import('../shared/FilterByTagDialog'));
|
|
12
|
+
const FilterByTagDialog = lazy(() => import('../shared/components/FilterByTagDialog'));
|
|
14
13
|
/**
|
|
15
14
|
* #stateModel LinearReadCloudDisplay
|
|
16
15
|
* it is not a block based track, hence not BaseLinearDisplay
|
|
@@ -33,15 +32,11 @@ function stateModelFactory(configSchema) {
|
|
|
33
32
|
/**
|
|
34
33
|
* #property
|
|
35
34
|
*/
|
|
36
|
-
filterBy: types.optional(
|
|
35
|
+
filterBy: types.optional(types.frozen(), defaultFilterFlags),
|
|
37
36
|
/**
|
|
38
37
|
* #property
|
|
39
38
|
*/
|
|
40
|
-
colorBy: types.
|
|
41
|
-
type: types.string,
|
|
42
|
-
tag: types.maybe(types.string),
|
|
43
|
-
extra: types.frozen(),
|
|
44
|
-
})),
|
|
39
|
+
colorBy: types.frozen(),
|
|
45
40
|
/**
|
|
46
41
|
* #property
|
|
47
42
|
*/
|
|
@@ -93,8 +88,10 @@ function stateModelFactory(configSchema) {
|
|
|
93
88
|
setRef(ref) {
|
|
94
89
|
self.ref = ref;
|
|
95
90
|
},
|
|
96
|
-
setColorScheme(
|
|
97
|
-
self.colorBy =
|
|
91
|
+
setColorScheme(colorBy) {
|
|
92
|
+
self.colorBy = {
|
|
93
|
+
...colorBy,
|
|
94
|
+
};
|
|
98
95
|
},
|
|
99
96
|
/**
|
|
100
97
|
* #action
|
|
@@ -106,7 +103,9 @@ function stateModelFactory(configSchema) {
|
|
|
106
103
|
* #action
|
|
107
104
|
*/
|
|
108
105
|
setFilterBy(filter) {
|
|
109
|
-
self.filterBy =
|
|
106
|
+
self.filterBy = {
|
|
107
|
+
...filter,
|
|
108
|
+
};
|
|
110
109
|
},
|
|
111
110
|
}))
|
|
112
111
|
.views(self => ({
|
|
@@ -185,7 +184,7 @@ function stateModelFactory(configSchema) {
|
|
|
185
184
|
* #method
|
|
186
185
|
*/
|
|
187
186
|
async renderSvg(opts) {
|
|
188
|
-
const { renderSvg } = await import('../shared/
|
|
187
|
+
const { renderSvg } = await import('../shared/renderSvgUtil');
|
|
189
188
|
const { drawFeats } = await import('./drawFeats');
|
|
190
189
|
return renderSvg(self, opts, drawFeats);
|
|
191
190
|
},
|
|
@@ -2,13 +2,21 @@ import React from 'react';
|
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import { toLocale } from '@jbrowse/core/util';
|
|
4
4
|
import { Tooltip } from '@jbrowse/plugin-wiggle';
|
|
5
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
|
+
const useStyles = makeStyles()(() => ({
|
|
7
|
+
td: {
|
|
8
|
+
whiteSpace: 'nowrap',
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
5
11
|
const toP = (s = 0) => +(+s).toFixed(1);
|
|
6
|
-
const pct = (n, total) => `${toP((n / (total || 1)) * 100)}%`;
|
|
7
|
-
const TooltipContents = React.forwardRef(function TooltipContents2(
|
|
8
|
-
const
|
|
12
|
+
const pct = (n, total = 1) => `${toP((n / (total || 1)) * 100)}%`;
|
|
13
|
+
const TooltipContents = React.forwardRef(function TooltipContents2(props, reactRef) {
|
|
14
|
+
const { feature, model } = props;
|
|
15
|
+
const { classes } = useStyles();
|
|
16
|
+
const start = feature.get('start') + 1;
|
|
9
17
|
const end = feature.get('end');
|
|
10
18
|
const name = feature.get('refName');
|
|
11
|
-
const { refbase,
|
|
19
|
+
const { refbase, readsCounted, depth, ref, ...info } = feature.get('snpinfo');
|
|
12
20
|
const loc = [
|
|
13
21
|
name,
|
|
14
22
|
start === end ? toLocale(start) : `${toLocale(start)}..${toLocale(end)}`,
|
|
@@ -20,36 +28,58 @@ const TooltipContents = React.forwardRef(function TooltipContents2({ feature },
|
|
|
20
28
|
React.createElement("caption", null, loc),
|
|
21
29
|
React.createElement("thead", null,
|
|
22
30
|
React.createElement("tr", null,
|
|
31
|
+
React.createElement("th", null),
|
|
23
32
|
React.createElement("th", null, "Base"),
|
|
24
33
|
React.createElement("th", null, "Count"),
|
|
25
34
|
React.createElement("th", null, "% of Total"),
|
|
26
|
-
React.createElement("th", null, "Strands"),
|
|
27
|
-
React.createElement("th", null, "Source"))),
|
|
35
|
+
React.createElement("th", null, "Strands"))),
|
|
28
36
|
React.createElement("tbody", null,
|
|
29
37
|
React.createElement("tr", null,
|
|
38
|
+
React.createElement("td", null),
|
|
30
39
|
React.createElement("td", null, "Total"),
|
|
31
|
-
React.createElement("td", null,
|
|
40
|
+
React.createElement("td", null, readsCounted),
|
|
41
|
+
React.createElement("td", null, " "),
|
|
42
|
+
React.createElement("td", null, " ")),
|
|
32
43
|
React.createElement("tr", null,
|
|
44
|
+
React.createElement("td", null),
|
|
33
45
|
React.createElement("td", null,
|
|
34
46
|
"REF ",
|
|
35
47
|
refbase ? `(${refbase.toUpperCase()})` : ''),
|
|
36
|
-
React.createElement("td", null, ref),
|
|
37
|
-
React.createElement("td", null, pct(ref,
|
|
48
|
+
React.createElement("td", null, ref.entryDepth),
|
|
49
|
+
React.createElement("td", null, pct(ref.entryDepth, readsCounted)),
|
|
38
50
|
React.createElement("td", null,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
React.createElement("td", null,
|
|
45
|
-
|
|
51
|
+
ref['-1'] ? `${ref['-1']}(-)` : '',
|
|
52
|
+
ref['1'] ? `${ref['1']}(+)` : '')),
|
|
53
|
+
Object.entries(info).map(([key, entry]) => Object.entries(entry).map(([base, score]) => (React.createElement("tr", { key: `${key}_${base}` },
|
|
54
|
+
React.createElement("td", null,
|
|
55
|
+
React.createElement(ColorSquare, { model: model, base: base })),
|
|
56
|
+
React.createElement("td", null,
|
|
57
|
+
base.toUpperCase(),
|
|
58
|
+
" "),
|
|
59
|
+
React.createElement("td", { className: classes.td }, [
|
|
60
|
+
score.entryDepth,
|
|
61
|
+
score.avgProbability !== undefined
|
|
62
|
+
? `(avg. ${pct(score.avgProbability)} prob.)`
|
|
63
|
+
: '',
|
|
64
|
+
]
|
|
65
|
+
.filter(f => !!f)
|
|
66
|
+
.join(' ')),
|
|
67
|
+
React.createElement("td", null, base === 'depth' || base === 'skip'
|
|
46
68
|
? '---'
|
|
47
|
-
: pct(score.
|
|
69
|
+
: pct(score.entryDepth, readsCounted)),
|
|
48
70
|
React.createElement("td", null,
|
|
49
71
|
score['-1'] ? `${score['-1']}(-)` : '',
|
|
50
|
-
score['1'] ? `${score['1']}(+)` : '')
|
|
51
|
-
React.createElement("td", null, key)))))))));
|
|
72
|
+
score['1'] ? `${score['1']}(+)` : '')))))))));
|
|
52
73
|
});
|
|
74
|
+
function ColorSquare({ base, model, }) {
|
|
75
|
+
var _a;
|
|
76
|
+
const { visibleModifications } = model;
|
|
77
|
+
return base.startsWith('mod_') ? (React.createElement("div", { style: {
|
|
78
|
+
width: 10,
|
|
79
|
+
height: 10,
|
|
80
|
+
background: (_a = visibleModifications.get(base.replace('mod_', ''))) === null || _a === void 0 ? void 0 : _a.color,
|
|
81
|
+
} })) : null;
|
|
82
|
+
}
|
|
53
83
|
const SNPCoverageTooltip = observer(function (props) {
|
|
54
84
|
const { model } = props;
|
|
55
85
|
const { featureUnderMouse: feat } = model;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import configSchemaFactory from './models/configSchema';
|
|
2
|
-
import modelFactory from './models/model';
|
|
3
1
|
import { LinearWiggleDisplayReactComponent } from '@jbrowse/plugin-wiggle';
|
|
4
2
|
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
3
|
+
// locals
|
|
4
|
+
import configSchemaFactory from './configSchema';
|
|
5
|
+
import modelFactory from './model';
|
|
5
6
|
export default function register(pluginManager) {
|
|
6
7
|
pluginManager.addDisplayType(() => {
|
|
7
8
|
const configSchema = configSchemaFactory(pluginManager);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
3
|
+
import { ColorBy, FilterBy } from '../shared/types';
|
|
3
4
|
/**
|
|
4
5
|
* #stateModel LinearSNPCoverageDisplay
|
|
5
6
|
* extends
|
|
@@ -136,22 +137,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
136
137
|
/**
|
|
137
138
|
* #property
|
|
138
139
|
*/
|
|
139
|
-
filterBy: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").
|
|
140
|
-
flagInclude: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
141
|
-
flagExclude: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
142
|
-
readName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
143
|
-
tagFilter: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IModelType<{
|
|
144
|
-
tag: import("mobx-state-tree").ISimpleType<string>;
|
|
145
|
-
value: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
146
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
147
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
140
|
+
filterBy: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<FilterBy, FilterBy, FilterBy>, [undefined]>;
|
|
148
141
|
/**
|
|
149
142
|
* #property
|
|
150
143
|
*/
|
|
151
|
-
colorBy: import("mobx-state-tree").
|
|
152
|
-
type: import("mobx-state-tree").ISimpleType<string>;
|
|
153
|
-
tag: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
154
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
144
|
+
colorBy: import("mobx-state-tree").IType<ColorBy | undefined, ColorBy | undefined, ColorBy | undefined>;
|
|
155
145
|
/**
|
|
156
146
|
* #property
|
|
157
147
|
*/
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import { types, cast, getEnv,
|
|
2
|
+
import { types, cast, getEnv, isAlive } from 'mobx-state-tree';
|
|
3
3
|
import { observable } from 'mobx';
|
|
4
4
|
import { getConf, readConfObject, } from '@jbrowse/core/configuration';
|
|
5
5
|
import { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle';
|
|
6
6
|
import { getContainingView } from '@jbrowse/core/util';
|
|
7
7
|
import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
|
|
8
8
|
// locals
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { randomColor } from '../../util';
|
|
9
|
+
import { createAutorun, getColorForModification } from '../util';
|
|
10
|
+
import { getUniqueModifications } from '../shared/getUniqueModifications';
|
|
12
11
|
// lazies
|
|
13
|
-
const Tooltip = lazy(() => import('
|
|
12
|
+
const Tooltip = lazy(() => import('./components/Tooltip'));
|
|
14
13
|
// using a map because it preserves order
|
|
15
14
|
const rendererTypes = new Map([['snpcoverage', 'SNPCoverageRenderer']]);
|
|
16
15
|
/**
|
|
@@ -40,21 +39,27 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
40
39
|
/**
|
|
41
40
|
* #property
|
|
42
41
|
*/
|
|
43
|
-
filterBy: types.optional(
|
|
42
|
+
filterBy: types.optional(types.frozen(), {
|
|
43
|
+
flagInclude: 0,
|
|
44
|
+
flagExclude: 1540,
|
|
45
|
+
}),
|
|
44
46
|
/**
|
|
45
47
|
* #property
|
|
46
48
|
*/
|
|
47
|
-
colorBy: types.
|
|
48
|
-
type: types.string,
|
|
49
|
-
tag: types.maybe(types.string),
|
|
50
|
-
})),
|
|
49
|
+
colorBy: types.frozen(),
|
|
51
50
|
/**
|
|
52
51
|
* #property
|
|
53
52
|
*/
|
|
54
53
|
jexlFilters: types.optional(types.array(types.string), []),
|
|
55
54
|
}))
|
|
56
55
|
.volatile(() => ({
|
|
57
|
-
|
|
56
|
+
/**
|
|
57
|
+
* #volatile
|
|
58
|
+
*/
|
|
59
|
+
visibleModifications: observable.map({}),
|
|
60
|
+
/**
|
|
61
|
+
* #volatile
|
|
62
|
+
*/
|
|
58
63
|
modificationsReady: false,
|
|
59
64
|
}))
|
|
60
65
|
.actions(self => ({
|
|
@@ -68,13 +73,19 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
68
73
|
* #action
|
|
69
74
|
*/
|
|
70
75
|
setFilterBy(filter) {
|
|
71
|
-
self.filterBy =
|
|
76
|
+
self.filterBy = {
|
|
77
|
+
...filter,
|
|
78
|
+
};
|
|
72
79
|
},
|
|
73
80
|
/**
|
|
74
81
|
* #action
|
|
75
82
|
*/
|
|
76
|
-
|
|
77
|
-
self.colorBy =
|
|
83
|
+
setColorScheme(colorBy) {
|
|
84
|
+
self.colorBy = colorBy
|
|
85
|
+
? {
|
|
86
|
+
...colorBy,
|
|
87
|
+
}
|
|
88
|
+
: undefined;
|
|
78
89
|
},
|
|
79
90
|
/**
|
|
80
91
|
* #action
|
|
@@ -85,28 +96,31 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
85
96
|
/**
|
|
86
97
|
* #action
|
|
87
98
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!self.
|
|
91
|
-
self.
|
|
99
|
+
updateVisibleModifications(uniqueModifications) {
|
|
100
|
+
for (const modification of uniqueModifications) {
|
|
101
|
+
if (!self.visibleModifications.has(modification.type)) {
|
|
102
|
+
self.visibleModifications.set(modification.type, {
|
|
103
|
+
...modification,
|
|
104
|
+
color: getColorForModification(modification.type),
|
|
105
|
+
});
|
|
92
106
|
}
|
|
93
|
-
}
|
|
107
|
+
}
|
|
94
108
|
},
|
|
95
109
|
}))
|
|
96
110
|
.views(self => {
|
|
97
|
-
const {
|
|
111
|
+
const { adapterProps: superAdapterProps } = self;
|
|
98
112
|
return {
|
|
99
113
|
/**
|
|
100
114
|
* #getter
|
|
101
115
|
*/
|
|
102
116
|
get rendererConfig() {
|
|
103
|
-
var _a, _b, _c;
|
|
104
117
|
const configBlob = getConf(self, ['renderers', self.rendererTypeName]) || {};
|
|
118
|
+
const { drawArcs, drawInterbaseCounts, drawIndicators } = self;
|
|
105
119
|
return self.rendererType.configSchema.create({
|
|
106
120
|
...configBlob,
|
|
107
|
-
drawInterbaseCounts:
|
|
108
|
-
drawIndicators:
|
|
109
|
-
drawArcs:
|
|
121
|
+
drawInterbaseCounts: drawInterbaseCounts !== null && drawInterbaseCounts !== void 0 ? drawInterbaseCounts : configBlob.drawInterbaseCounts,
|
|
122
|
+
drawIndicators: drawIndicators !== null && drawIndicators !== void 0 ? drawIndicators : configBlob.drawIndicators,
|
|
123
|
+
drawArcs: drawArcs !== null && drawArcs !== void 0 ? drawArcs : configBlob.drawArcs,
|
|
110
124
|
}, getEnv(self));
|
|
111
125
|
},
|
|
112
126
|
/**
|
|
@@ -140,28 +154,16 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
140
154
|
!self.regionTooLarge &&
|
|
141
155
|
!self.error);
|
|
142
156
|
},
|
|
143
|
-
get renderReady() {
|
|
144
|
-
const superProps = superRenderProps();
|
|
145
|
-
return !superProps.notReady && self.modificationsReady;
|
|
146
|
-
},
|
|
147
|
-
get ready() {
|
|
148
|
-
return this.renderReady;
|
|
149
|
-
},
|
|
150
157
|
/**
|
|
151
158
|
* #method
|
|
152
159
|
*/
|
|
153
|
-
|
|
154
|
-
const superProps =
|
|
155
|
-
const {
|
|
160
|
+
adapterProps() {
|
|
161
|
+
const superProps = superAdapterProps();
|
|
162
|
+
const { filters, filterBy } = self;
|
|
156
163
|
return {
|
|
157
164
|
...superProps,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
modificationTagMap: Object.fromEntries(modificationTagMap.toJSON()),
|
|
161
|
-
// must use getSnapshot because otherwise changes to e.g. just the
|
|
162
|
-
// colorBy.type are not read
|
|
163
|
-
colorBy: colorBy ? getSnapshot(colorBy) : undefined,
|
|
164
|
-
filterBy: getSnapshot(filterBy),
|
|
165
|
+
filters,
|
|
166
|
+
filterBy,
|
|
165
167
|
};
|
|
166
168
|
},
|
|
167
169
|
};
|
|
@@ -203,14 +205,13 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
203
205
|
const { staticBlocks } = view;
|
|
204
206
|
const { colorBy } = self;
|
|
205
207
|
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications') {
|
|
206
|
-
const
|
|
207
|
-
const vals = await getUniqueModificationValues({
|
|
208
|
+
const vals = await getUniqueModifications({
|
|
208
209
|
self,
|
|
209
|
-
adapterConfig: adapter,
|
|
210
|
+
adapterConfig: getConf(self.parentTrack, 'adapter'),
|
|
210
211
|
blocks: staticBlocks,
|
|
211
212
|
});
|
|
212
213
|
if (isAlive(self)) {
|
|
213
|
-
self.
|
|
214
|
+
self.updateVisibleModifications(vals);
|
|
214
215
|
self.setModificationsReady(true);
|
|
215
216
|
}
|
|
216
217
|
}
|
|
@@ -221,8 +222,33 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
221
222
|
},
|
|
222
223
|
}))
|
|
223
224
|
.views(self => {
|
|
224
|
-
const { trackMenuItems: superTrackMenuItems } = self;
|
|
225
|
+
const { renderProps: superRenderProps, trackMenuItems: superTrackMenuItems, } = self;
|
|
225
226
|
return {
|
|
227
|
+
/**
|
|
228
|
+
* #getter
|
|
229
|
+
*/
|
|
230
|
+
get renderReady() {
|
|
231
|
+
const superProps = superRenderProps();
|
|
232
|
+
return !superProps.notReady && self.modificationsReady;
|
|
233
|
+
},
|
|
234
|
+
/**
|
|
235
|
+
* #getter
|
|
236
|
+
*/
|
|
237
|
+
get ready() {
|
|
238
|
+
return this.renderReady;
|
|
239
|
+
},
|
|
240
|
+
/**
|
|
241
|
+
* #method
|
|
242
|
+
*/
|
|
243
|
+
renderProps() {
|
|
244
|
+
const { colorBy, visibleModifications } = self;
|
|
245
|
+
return {
|
|
246
|
+
...superRenderProps(),
|
|
247
|
+
notReady: !this.ready,
|
|
248
|
+
colorBy,
|
|
249
|
+
visibleModifications: Object.fromEntries(visibleModifications.toJSON()),
|
|
250
|
+
};
|
|
251
|
+
},
|
|
226
252
|
/**
|
|
227
253
|
* #getter
|
|
228
254
|
*/
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export function cigarToMismatches(ops, seq, ref, qual) {
|
|
2
|
+
let roffset = 0; // reference offset
|
|
3
|
+
let soffset = 0; // seq offset
|
|
4
|
+
const mismatches = [];
|
|
5
|
+
const hasRefAndSeq = ref && seq;
|
|
6
|
+
for (let i = 0; i < ops.length; i += 2) {
|
|
7
|
+
const len = +ops[i];
|
|
8
|
+
const op = ops[i + 1];
|
|
9
|
+
if (op === 'M' || op === '=' || op === 'E') {
|
|
10
|
+
if (hasRefAndSeq) {
|
|
11
|
+
for (let j = 0; j < len; j++) {
|
|
12
|
+
if (
|
|
13
|
+
// @ts-ignore in the full yarn build of the repo, this says that
|
|
14
|
+
// object is possibly undefined for some reason, ignored
|
|
15
|
+
seq[soffset + j].toUpperCase() !== ref[roffset + j].toUpperCase()) {
|
|
16
|
+
mismatches.push({
|
|
17
|
+
start: roffset + j,
|
|
18
|
+
type: 'mismatch',
|
|
19
|
+
base: seq[soffset + j],
|
|
20
|
+
altbase: ref[roffset + j],
|
|
21
|
+
length: 1,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
soffset += len;
|
|
27
|
+
}
|
|
28
|
+
if (op === 'I') {
|
|
29
|
+
mismatches.push({
|
|
30
|
+
start: roffset,
|
|
31
|
+
type: 'insertion',
|
|
32
|
+
base: `${len}`,
|
|
33
|
+
length: 0,
|
|
34
|
+
});
|
|
35
|
+
soffset += len;
|
|
36
|
+
}
|
|
37
|
+
else if (op === 'D') {
|
|
38
|
+
mismatches.push({
|
|
39
|
+
start: roffset,
|
|
40
|
+
type: 'deletion',
|
|
41
|
+
base: '*',
|
|
42
|
+
length: len,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (op === 'N') {
|
|
46
|
+
mismatches.push({
|
|
47
|
+
start: roffset,
|
|
48
|
+
type: 'skip',
|
|
49
|
+
base: 'N',
|
|
50
|
+
length: len,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (op === 'X') {
|
|
54
|
+
const r = (seq === null || seq === void 0 ? void 0 : seq.slice(soffset, soffset + len)) || [];
|
|
55
|
+
const q = (qual === null || qual === void 0 ? void 0 : qual.subarray(soffset, soffset + len)) || [];
|
|
56
|
+
for (let j = 0; j < len; j++) {
|
|
57
|
+
mismatches.push({
|
|
58
|
+
start: roffset + j,
|
|
59
|
+
type: 'mismatch',
|
|
60
|
+
base: r[j],
|
|
61
|
+
qual: q[j],
|
|
62
|
+
length: 1,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
soffset += len;
|
|
66
|
+
}
|
|
67
|
+
else if (op === 'H') {
|
|
68
|
+
mismatches.push({
|
|
69
|
+
start: roffset,
|
|
70
|
+
type: 'hardclip',
|
|
71
|
+
base: `H${len}`,
|
|
72
|
+
cliplen: len,
|
|
73
|
+
length: 1,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else if (op === 'S') {
|
|
77
|
+
mismatches.push({
|
|
78
|
+
start: roffset,
|
|
79
|
+
type: 'softclip',
|
|
80
|
+
base: `S${len}`,
|
|
81
|
+
cliplen: len,
|
|
82
|
+
length: 1,
|
|
83
|
+
});
|
|
84
|
+
soffset += len;
|
|
85
|
+
}
|
|
86
|
+
if (op !== 'I' && op !== 'S' && op !== 'H') {
|
|
87
|
+
roffset += len;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return mismatches;
|
|
91
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// get relative reference sequence positions for positions given relative to
|
|
2
|
+
// the read sequence
|
|
3
|
+
export function getNextRefPos(cigarOps, positions) {
|
|
4
|
+
let readPos = 0;
|
|
5
|
+
let refPos = 0;
|
|
6
|
+
let currPos = 0;
|
|
7
|
+
const ret = [];
|
|
8
|
+
for (let i = 0; i < cigarOps.length && currPos < positions.length; i += 2) {
|
|
9
|
+
const len = +cigarOps[i];
|
|
10
|
+
const op = cigarOps[i + 1];
|
|
11
|
+
if (op === 'S' || op === 'I') {
|
|
12
|
+
for (let i = 0; i < len && currPos < positions.length; i++) {
|
|
13
|
+
if (positions[currPos] === readPos + i) {
|
|
14
|
+
currPos++;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
readPos += len;
|
|
18
|
+
}
|
|
19
|
+
else if (op === 'D' || op === 'N') {
|
|
20
|
+
refPos += len;
|
|
21
|
+
}
|
|
22
|
+
else if (op === 'M' || op === 'X' || op === '=') {
|
|
23
|
+
for (let i = 0; i < len && currPos < positions.length; i++) {
|
|
24
|
+
if (positions[currPos] === readPos + i) {
|
|
25
|
+
ret.push({
|
|
26
|
+
ref: refPos + i,
|
|
27
|
+
idx: currPos,
|
|
28
|
+
});
|
|
29
|
+
currPos++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
readPos += len;
|
|
33
|
+
refPos += len;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return ret;
|
|
37
|
+
}
|