@jbrowse/plugin-alignments 2.16.1 → 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 +1 -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 +40 -40
- 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 -327
- 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 +6 -3
- package/dist/util.js +24 -29
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +1 -2
- 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 +40 -40
- 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 -317
- 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 +6 -3
- package/esm/util.js +22 -26
- 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
package/dist/shared/util.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultFilterFlags = void 0;
|
|
3
4
|
exports.hasPairedReads = hasPairedReads;
|
|
5
|
+
exports.alphaColor = alphaColor;
|
|
6
|
+
exports.cacheGetter = cacheGetter;
|
|
7
|
+
const colord_1 = require("@jbrowse/core/util/colord");
|
|
4
8
|
function hasPairedReads(features) {
|
|
5
9
|
for (const f of features.chains.values()) {
|
|
6
10
|
if (f[0].flags & 1) {
|
|
@@ -9,3 +13,25 @@ function hasPairedReads(features) {
|
|
|
9
13
|
}
|
|
10
14
|
return false;
|
|
11
15
|
}
|
|
16
|
+
function alphaColor(baseColor, p) {
|
|
17
|
+
return p !== 1
|
|
18
|
+
? (0, colord_1.colord)(baseColor)
|
|
19
|
+
.alpha(p * p)
|
|
20
|
+
.toHslString()
|
|
21
|
+
: baseColor;
|
|
22
|
+
}
|
|
23
|
+
exports.defaultFilterFlags = {
|
|
24
|
+
flagInclude: 0,
|
|
25
|
+
flagExclude: 1540,
|
|
26
|
+
};
|
|
27
|
+
function cacheGetter(ctor, prop) {
|
|
28
|
+
const desc = Object.getOwnPropertyDescriptor(ctor.prototype, prop);
|
|
29
|
+
const getter = desc.get;
|
|
30
|
+
Object.defineProperty(ctor.prototype, prop, {
|
|
31
|
+
get() {
|
|
32
|
+
const ret = getter.call(this);
|
|
33
|
+
Object.defineProperty(this, prop, { value: ret });
|
|
34
|
+
return ret;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
package/dist/util.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
|
2
2
|
import { Feature, AugmentedRegion } from '@jbrowse/core/util';
|
|
3
3
|
import { IAnyStateTreeNode } from 'mobx-state-tree';
|
|
4
4
|
import { IAutorunOptions } from 'mobx';
|
|
5
|
-
export declare function getTag(feature: Feature, tag: string): any;
|
|
6
5
|
export declare function getTagAlt(feature: Feature, tag: string, alt: string): any;
|
|
7
6
|
export declare const orientationTypes: {
|
|
8
7
|
fr: Record<string, string>;
|
|
@@ -17,11 +16,15 @@ export declare const pairMap: {
|
|
|
17
16
|
};
|
|
18
17
|
export declare function getColorWGBS(strand: number, base: string): "#f00" | "#00f" | "#888";
|
|
19
18
|
export declare function fetchSequence(region: AugmentedRegion, adapter: BaseFeatureDataAdapter): Promise<any>;
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
interface ModificationData {
|
|
20
|
+
color: string;
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const modificationData: Record<string, ModificationData>;
|
|
22
24
|
type DisplayModel = IAnyStateTreeNode & {
|
|
23
25
|
setError: (arg: unknown) => void;
|
|
24
26
|
};
|
|
25
27
|
export declare function createAutorun(self: DisplayModel, cb: () => Promise<void>, opts?: IAutorunOptions): void;
|
|
26
28
|
export declare function randomColor(str: string): string;
|
|
29
|
+
export declare function getColorForModification(str: string): string;
|
|
27
30
|
export {};
|
package/dist/util.js
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getTag = getTag;
|
|
3
|
+
exports.modificationData = exports.pairMap = exports.orientationTypes = void 0;
|
|
5
4
|
exports.getTagAlt = getTagAlt;
|
|
6
5
|
exports.getColorWGBS = getColorWGBS;
|
|
7
6
|
exports.fetchSequence = fetchSequence;
|
|
8
|
-
exports.shouldFetchReferenceSequence = shouldFetchReferenceSequence;
|
|
9
7
|
exports.createAutorun = createAutorun;
|
|
10
8
|
exports.randomColor = randomColor;
|
|
9
|
+
exports.getColorForModification = getColorForModification;
|
|
11
10
|
const operators_1 = require("rxjs/operators");
|
|
12
11
|
const rxjs_1 = require("rxjs");
|
|
13
12
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
14
13
|
const mobx_1 = require("mobx");
|
|
15
|
-
// get tag from BAM or CRAM feature, where CRAM uses feature.get('tags') and
|
|
16
|
-
// BAM does not
|
|
17
|
-
function getTag(feature, tag) {
|
|
18
|
-
const tags = feature.get('tags');
|
|
19
|
-
return tags !== undefined ? tags[tag] : feature.get(tag);
|
|
20
|
-
}
|
|
21
14
|
// use fallback alt tag, used in situations where upper case/lower case tags
|
|
22
15
|
// exist e.g. Mm/MM for base modifications
|
|
23
16
|
function getTagAlt(feature, tag, alt) {
|
|
24
17
|
var _a;
|
|
25
|
-
|
|
18
|
+
const tags = feature.get('tags');
|
|
19
|
+
return (_a = tags[tag]) !== null && _a !== void 0 ? _a : tags[alt];
|
|
26
20
|
}
|
|
27
21
|
// orientation definitions from igv.js, see also
|
|
28
22
|
// https://software.broadinstitute.org/software/igv/interpreting_pair_orientations
|
|
@@ -83,8 +77,6 @@ function getColorWGBS(strand, base) {
|
|
|
83
77
|
}
|
|
84
78
|
return '#888';
|
|
85
79
|
}
|
|
86
|
-
// fetches region sequence augmenting by +/- 1bp for CpG on either side of
|
|
87
|
-
// requested region
|
|
88
80
|
async function fetchSequence(region, adapter) {
|
|
89
81
|
var _a;
|
|
90
82
|
const { start, end, originalRefName, refName } = region;
|
|
@@ -92,28 +84,27 @@ async function fetchSequence(region, adapter) {
|
|
|
92
84
|
.getFeatures({
|
|
93
85
|
...region,
|
|
94
86
|
refName: originalRefName || refName,
|
|
95
|
-
end
|
|
96
|
-
start
|
|
87
|
+
end,
|
|
88
|
+
start,
|
|
97
89
|
})
|
|
98
90
|
.pipe((0, operators_1.toArray)()));
|
|
99
91
|
return (_a = feats[0]) === null || _a === void 0 ? void 0 : _a.get('seq');
|
|
100
92
|
}
|
|
101
|
-
// has to check underlying C-G (aka CpG) on the reference sequence
|
|
102
|
-
function shouldFetchReferenceSequence(type) {
|
|
103
|
-
return type === 'methylation';
|
|
104
|
-
}
|
|
105
93
|
// adapted from IGV
|
|
106
|
-
// https://github.com/igvteam/igv/blob/
|
|
107
|
-
exports.
|
|
108
|
-
m: 'rgb(255,0,0)',
|
|
109
|
-
h: 'rgb(
|
|
110
|
-
o: 'rgb(111, 78, 129)',
|
|
111
|
-
f: 'rgb(246, 200, 95)',
|
|
112
|
-
c: 'rgb(157, 216, 102)',
|
|
113
|
-
g: 'rgb(255, 160, 86)',
|
|
114
|
-
e: 'rgb(141, 221, 208)',
|
|
115
|
-
b: 'rgb(
|
|
116
|
-
a: '
|
|
94
|
+
// https://github.com/igvteam/igv/blob/af07c3b1be8806cfd77343ee04982aeff17d2beb/src/main/resources/org/broad/igv/prefs/preferences.tab#L230-L242
|
|
95
|
+
exports.modificationData = {
|
|
96
|
+
m: { color: 'rgb(255,0,0)', name: '5mC' },
|
|
97
|
+
h: { color: 'rgb(255,0,255)', name: '5hmC' },
|
|
98
|
+
o: { color: 'rgb(111, 78, 129)', name: '8oxoG' },
|
|
99
|
+
f: { color: 'rgb(246, 200, 95)', name: '5fC' },
|
|
100
|
+
c: { color: 'rgb(157, 216, 102)', name: '5cac' },
|
|
101
|
+
g: { color: 'rgb(255, 160, 86)', name: '5hmu' },
|
|
102
|
+
e: { color: 'rgb(141, 221, 208)', name: '5fU' },
|
|
103
|
+
b: { color: 'rgb(0,100,47)', name: '5caU' },
|
|
104
|
+
a: { color: 'rgb(51,0,111)', name: '6mA' },
|
|
105
|
+
17082: { color: 'rgb(51,153,255)', name: 'pseU' },
|
|
106
|
+
17596: { color: 'rgb(102,153,0)', name: 'inosine' },
|
|
107
|
+
21839: { color: 'rgb(153,0,153)', name: '4mC' },
|
|
117
108
|
};
|
|
118
109
|
function createAutorun(self, cb, opts) {
|
|
119
110
|
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
@@ -134,3 +125,7 @@ function randomColor(str) {
|
|
|
134
125
|
}
|
|
135
126
|
return `hsl(${sum * 10}, 20%, 50%)`;
|
|
136
127
|
}
|
|
128
|
+
function getColorForModification(str) {
|
|
129
|
+
var _a;
|
|
130
|
+
return ((_a = exports.modificationData[str]) === null || _a === void 0 ? void 0 : _a.color) || randomColor(str);
|
|
131
|
+
}
|
|
@@ -13,7 +13,6 @@ import Formatter from './Formatter';
|
|
|
13
13
|
// lazies
|
|
14
14
|
const SupplementaryAlignments = lazy(() => import('./SupplementaryAlignments'));
|
|
15
15
|
const LinkedPairedAlignments = lazy(() => import('./LinkedPairedAlignments'));
|
|
16
|
-
const omit = ['clipPos', 'flags'];
|
|
17
16
|
const AlignmentsFeatureDetails = observer(function (props) {
|
|
18
17
|
const { model } = props;
|
|
19
18
|
const { featureData } = model;
|
|
@@ -21,7 +20,7 @@ const AlignmentsFeatureDetails = observer(function (props) {
|
|
|
21
20
|
const SA = getTag('SA', feat);
|
|
22
21
|
const { flags } = feat;
|
|
23
22
|
return (React.createElement(Paper, { "data-testid": "alignment-side-drawer" },
|
|
24
|
-
React.createElement(FeatureDetails, { ...props,
|
|
23
|
+
React.createElement(FeatureDetails, { ...props,
|
|
25
24
|
// @ts-expect-error
|
|
26
25
|
descriptions: { ...tags, tags: tags }, feature: feat, formatter: (value, key) => key === 'next_segment_position' ? (React.createElement(PairLink, { model: model, locString: value })) : (React.createElement(Formatter, { value: value })) }),
|
|
27
26
|
SA !== undefined ? (React.createElement(SupplementaryAlignments, { model: model, tag: SA, feature: feat })) : null,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getSession } from '@jbrowse/core/util';
|
|
2
2
|
// locals
|
|
3
3
|
import { featurizeSA, getClip, getLengthSansClipping } from '../MismatchParser';
|
|
4
|
-
import { getTag } from '../util';
|
|
5
4
|
export async function getSAFeatures({ view, feature, }) {
|
|
5
|
+
var _a;
|
|
6
6
|
const { assemblyManager } = getSession(view);
|
|
7
7
|
const cigar = feature.get('CIGAR');
|
|
8
8
|
const origStrand = feature.get('strand');
|
|
9
|
-
const SA =
|
|
9
|
+
const SA = ((_a = feature.get('tags')) === null || _a === void 0 ? void 0 : _a.SA) || '';
|
|
10
10
|
const readName = feature.get('name');
|
|
11
11
|
const clipPos = getClip(cigar, 1);
|
|
12
12
|
// get the canonical refname for the read because if the read.get('refName')
|
|
@@ -92,8 +92,8 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
92
92
|
trackId: string | undefined;
|
|
93
93
|
trackType: string | undefined;
|
|
94
94
|
maxDepth: number | undefined;
|
|
95
|
-
formattedFields: any;
|
|
96
95
|
sequenceFeatureDetails: import("mobx-state-tree").ModelSnapshotType<{}>;
|
|
96
|
+
formattedFields: any;
|
|
97
97
|
finalizedFeatureData: any;
|
|
98
98
|
} & import("mobx-state-tree")._NotCustomized>;
|
|
99
99
|
export type AlignmentFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
|
|
@@ -2,7 +2,7 @@ import { BamFile } from '@gmod/bam';
|
|
|
2
2
|
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
3
|
import { Region } from '@jbrowse/core/util/types';
|
|
4
4
|
import { Feature } from '@jbrowse/core/util';
|
|
5
|
-
import {
|
|
5
|
+
import { FilterBy } from '../shared/types';
|
|
6
6
|
interface Header {
|
|
7
7
|
idToName: string[];
|
|
8
8
|
nameToId: Record<string, number>;
|
|
@@ -10,6 +10,7 @@ interface Header {
|
|
|
10
10
|
export default class BamAdapter extends BaseFeatureDataAdapter {
|
|
11
11
|
private samHeader?;
|
|
12
12
|
private setupP?;
|
|
13
|
+
private ultraLongFeatureCache;
|
|
13
14
|
private configureP?;
|
|
14
15
|
protected configurePre(): Promise<{
|
|
15
16
|
bam: BamFile;
|
|
@@ -30,7 +31,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
|
|
|
30
31
|
getFeatures(region: Region & {
|
|
31
32
|
originalRefName?: string;
|
|
32
33
|
}, opts?: BaseOptions & {
|
|
33
|
-
filterBy:
|
|
34
|
+
filterBy: FilterBy;
|
|
34
35
|
}): import("rxjs").Observable<Feature>;
|
|
35
36
|
getMultiRegionFeatureDensityStats(regions: Region[], opts?: BaseOptions): Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | {
|
|
36
37
|
bytes: number;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { BamFile } from '@gmod/bam';
|
|
2
|
+
import { toArray } from 'rxjs/operators';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
// jbrowse
|
|
2
5
|
import { BaseFeatureDataAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
6
|
import { bytesForRegions, updateStatus } from '@jbrowse/core/util';
|
|
4
7
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
8
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
|
-
import
|
|
7
|
-
import { firstValueFrom } from 'rxjs';
|
|
9
|
+
import QuickLRU from '@jbrowse/core/util/QuickLRU';
|
|
8
10
|
// locals
|
|
9
11
|
import BamSlightlyLazyFeature from './BamSlightlyLazyFeature';
|
|
10
12
|
export default class BamAdapter extends BaseFeatureDataAdapter {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
// used for avoiding re-creation new BamSlightlyLazyFeatures, keeping
|
|
16
|
+
// mismatches in cache. at an average of 100kb-300kb, keeping even just 500
|
|
17
|
+
// of these in memory is memory intensive but can reduce recomputation on
|
|
18
|
+
// these objects
|
|
19
|
+
this.ultraLongFeatureCache = new QuickLRU({
|
|
20
|
+
maxSize: 500,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
11
23
|
// derived classes may not use the same configuration so a custom configure
|
|
12
24
|
// method allows derived classes to override this behavior
|
|
13
25
|
async configurePre() {
|
|
@@ -124,26 +136,37 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
|
|
|
124
136
|
const { flagInclude = 0, flagExclude = 0, tagFilter, readName, } = filterBy || {};
|
|
125
137
|
for (const record of records) {
|
|
126
138
|
let ref;
|
|
127
|
-
if (!record.
|
|
128
|
-
ref = await this.seqFetch(originalRefName || refName, record.
|
|
139
|
+
if (!record.tags.MD) {
|
|
140
|
+
ref = await this.seqFetch(originalRefName || refName, record.start, record.end);
|
|
129
141
|
}
|
|
130
142
|
const flags = record.flags;
|
|
131
143
|
if ((flags & flagInclude) !== flagInclude && !(flags & flagExclude)) {
|
|
132
144
|
continue;
|
|
133
145
|
}
|
|
134
146
|
if (tagFilter) {
|
|
135
|
-
const readVal = record.
|
|
147
|
+
const readVal = record.tags[tagFilter.tag];
|
|
136
148
|
const filterVal = tagFilter.value;
|
|
137
149
|
if (filterVal === '*'
|
|
138
|
-
? readVal
|
|
150
|
+
? readVal === undefined
|
|
139
151
|
: `${readVal}` !== `${filterVal}`) {
|
|
140
152
|
continue;
|
|
141
153
|
}
|
|
142
154
|
}
|
|
143
|
-
if (readName && record.
|
|
155
|
+
if (readName && record.name !== readName) {
|
|
144
156
|
continue;
|
|
145
157
|
}
|
|
146
|
-
|
|
158
|
+
// retrieve a feature from our feature cache if it is available, the
|
|
159
|
+
// features in the cache have pre-computed mismatches objects that
|
|
160
|
+
// can be re-used across blocks
|
|
161
|
+
const ret = this.ultraLongFeatureCache.get(`${record.id}`);
|
|
162
|
+
if (!ret) {
|
|
163
|
+
const elt = new BamSlightlyLazyFeature(record, this, ref);
|
|
164
|
+
this.ultraLongFeatureCache.set(`${record.id}`, elt);
|
|
165
|
+
observer.next(elt);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
observer.next(ret);
|
|
169
|
+
}
|
|
147
170
|
}
|
|
148
171
|
observer.complete();
|
|
149
172
|
});
|
|
@@ -6,26 +6,12 @@ export default class BamSlightlyLazyFeature implements Feature {
|
|
|
6
6
|
private adapter;
|
|
7
7
|
private ref?;
|
|
8
8
|
constructor(record: BamRecord, adapter: BamAdapter, ref?: string | undefined);
|
|
9
|
-
_get_name(): any;
|
|
10
|
-
_get_type(): string;
|
|
11
|
-
_get_score(): number;
|
|
12
|
-
_get_flags(): string;
|
|
13
|
-
_get_strand(): number;
|
|
14
|
-
_get_pair_orientation(): string | undefined;
|
|
15
|
-
_get_next_ref(): string | undefined;
|
|
16
|
-
_get_next_pos(): number | undefined;
|
|
17
|
-
_get_next_segment_position(): string | undefined;
|
|
18
|
-
_get_seq(): string;
|
|
19
|
-
qualRaw(): Buffer | undefined;
|
|
20
|
-
set(): void;
|
|
21
|
-
tags(): string[];
|
|
22
9
|
id(): string;
|
|
10
|
+
get mismatches(): import("../shared/types").Mismatch[];
|
|
11
|
+
get qual(): string | undefined;
|
|
23
12
|
get(field: string): any;
|
|
24
|
-
_get_refName(): string | undefined;
|
|
25
13
|
parent(): undefined;
|
|
26
14
|
children(): undefined;
|
|
27
|
-
|
|
15
|
+
get fields(): SimpleFeatureSerialized;
|
|
28
16
|
toJSON(): SimpleFeatureSerialized;
|
|
29
|
-
_get_mismatches(): import("../MismatchParser").Mismatch[];
|
|
30
|
-
_get_clipPos(): number;
|
|
31
17
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// locals
|
|
2
|
-
import {
|
|
2
|
+
import { getMismatches } from '../MismatchParser';
|
|
3
|
+
import { cacheGetter } from '../shared/util';
|
|
3
4
|
export default class BamSlightlyLazyFeature {
|
|
4
5
|
// uses parameter properties to automatically create fields on the class
|
|
5
6
|
// https://www.typescriptlang.org/docs/handbook/classes.html#parameter-properties
|
|
@@ -8,69 +9,22 @@ export default class BamSlightlyLazyFeature {
|
|
|
8
9
|
this.adapter = adapter;
|
|
9
10
|
this.ref = ref;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
return this.record.
|
|
13
|
-
}
|
|
14
|
-
_get_type() {
|
|
15
|
-
return 'match';
|
|
16
|
-
}
|
|
17
|
-
_get_score() {
|
|
18
|
-
return this.record.get('mq');
|
|
19
|
-
}
|
|
20
|
-
_get_flags() {
|
|
21
|
-
return this.record.flags;
|
|
22
|
-
}
|
|
23
|
-
_get_strand() {
|
|
24
|
-
return this.record.isReverseComplemented() ? -1 : 1;
|
|
25
|
-
}
|
|
26
|
-
_get_pair_orientation() {
|
|
27
|
-
return this.record.isPaired() ? this.record.getPairOrientation() : undefined;
|
|
28
|
-
}
|
|
29
|
-
_get_next_ref() {
|
|
30
|
-
return this.record.isPaired()
|
|
31
|
-
? this.adapter.refIdToName(this.record._next_refid())
|
|
32
|
-
: undefined;
|
|
33
|
-
}
|
|
34
|
-
_get_next_pos() {
|
|
35
|
-
return this.record.isPaired() ? this.record._next_pos() : undefined;
|
|
36
|
-
}
|
|
37
|
-
_get_next_segment_position() {
|
|
38
|
-
return this.record.isPaired()
|
|
39
|
-
? `${this.adapter.refIdToName(this.record._next_refid())}:${this.record._next_pos() + 1}`
|
|
40
|
-
: undefined;
|
|
41
|
-
}
|
|
42
|
-
_get_seq() {
|
|
43
|
-
return this.record.getReadBases();
|
|
44
|
-
}
|
|
45
|
-
qualRaw() {
|
|
46
|
-
return this.record.qualRaw();
|
|
12
|
+
id() {
|
|
13
|
+
return `${this.adapter.id}-${this.record.id}`;
|
|
47
14
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const properties = Object.getOwnPropertyNames(BamSlightlyLazyFeature.prototype);
|
|
51
|
-
return [
|
|
52
|
-
...new Set(properties
|
|
53
|
-
.filter(prop => prop.startsWith('_get_') &&
|
|
54
|
-
prop !== '_get_mismatches' &&
|
|
55
|
-
prop !== '_get_tags')
|
|
56
|
-
.map(methodName => methodName.replace('_get_', ''))
|
|
57
|
-
.concat(this.record._tags())),
|
|
58
|
-
];
|
|
15
|
+
get mismatches() {
|
|
16
|
+
return getMismatches(this.record.CIGAR, this.record.tags.MD, this.record.seq, this.ref, this.record.qual);
|
|
59
17
|
}
|
|
60
|
-
|
|
61
|
-
|
|
18
|
+
get qual() {
|
|
19
|
+
var _a;
|
|
20
|
+
return (_a = this.record.qual) === null || _a === void 0 ? void 0 : _a.join(' ');
|
|
62
21
|
}
|
|
63
22
|
get(field) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
return this.record.get(field);
|
|
71
|
-
}
|
|
72
|
-
_get_refName() {
|
|
73
|
-
return this.adapter.refIdToName(this.record.seq_id());
|
|
23
|
+
return field === 'mismatches'
|
|
24
|
+
? this.mismatches
|
|
25
|
+
: field === 'qual'
|
|
26
|
+
? this.qual
|
|
27
|
+
: this.fields[field];
|
|
74
28
|
}
|
|
75
29
|
parent() {
|
|
76
30
|
return undefined;
|
|
@@ -78,22 +32,38 @@ export default class BamSlightlyLazyFeature {
|
|
|
78
32
|
children() {
|
|
79
33
|
return undefined;
|
|
80
34
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
35
|
+
get fields() {
|
|
36
|
+
const r = this.record;
|
|
37
|
+
const a = this.adapter;
|
|
38
|
+
const p = r.isPaired();
|
|
85
39
|
return {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
40
|
+
start: r.start,
|
|
41
|
+
name: r.name,
|
|
42
|
+
end: r.end,
|
|
43
|
+
score: r.score,
|
|
44
|
+
strand: r.strand,
|
|
45
|
+
template_length: r.template_length,
|
|
46
|
+
flags: r.flags,
|
|
47
|
+
tags: r.tags,
|
|
48
|
+
refName: a.refIdToName(r.ref_id),
|
|
49
|
+
CIGAR: r.CIGAR,
|
|
50
|
+
seq: r.seq,
|
|
51
|
+
type: 'match',
|
|
52
|
+
pair_orientation: r.pair_orientation,
|
|
53
|
+
next_ref: p ? a.refIdToName(r.next_refid) : undefined,
|
|
54
|
+
next_pos: p ? r.next_pos : undefined,
|
|
55
|
+
next_segment_position: p
|
|
56
|
+
? `${a.refIdToName(r.next_refid)}:${r.next_pos + 1}`
|
|
57
|
+
: undefined,
|
|
89
58
|
uniqueId: this.id(),
|
|
90
59
|
};
|
|
91
60
|
}
|
|
92
|
-
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return getClip(cigar, this.get('strand'));
|
|
61
|
+
toJSON() {
|
|
62
|
+
return {
|
|
63
|
+
...this.fields,
|
|
64
|
+
qual: this.qual,
|
|
65
|
+
};
|
|
98
66
|
}
|
|
99
67
|
}
|
|
68
|
+
cacheGetter(BamSlightlyLazyFeature, 'fields');
|
|
69
|
+
cacheGetter(BamSlightlyLazyFeature, 'mismatches');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IndexedCramFile, CramRecord } from '@gmod/cram';
|
|
2
2
|
import { BaseFeatureDataAdapter, BaseOptions, BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { Region, Feature } from '@jbrowse/core/util';
|
|
3
|
+
import type { Region, Feature } from '@jbrowse/core/util';
|
|
4
4
|
import CramSlightlyLazyFeature from './CramSlightlyLazyFeature';
|
|
5
|
-
import {
|
|
5
|
+
import { FilterBy } from '../shared/types';
|
|
6
6
|
interface Header {
|
|
7
7
|
idToName?: string[];
|
|
8
8
|
nameToId?: Record<string, number>;
|
|
@@ -12,6 +12,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
12
12
|
samHeader: Header;
|
|
13
13
|
private setupP?;
|
|
14
14
|
private configureP?;
|
|
15
|
+
private ultraLongFeatureCache;
|
|
15
16
|
private seqIdToRefName;
|
|
16
17
|
private seqIdToOriginalRefName;
|
|
17
18
|
configurePre(): Promise<{
|
|
@@ -33,7 +34,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
33
34
|
getFeatures(region: Region & {
|
|
34
35
|
originalRefName?: string;
|
|
35
36
|
}, opts?: BaseOptions & {
|
|
36
|
-
filterBy:
|
|
37
|
+
filterBy: FilterBy;
|
|
37
38
|
}): import("rxjs").Observable<Feature>;
|
|
38
39
|
freeResources(): void;
|
|
39
40
|
cramRecordToFeature(record: CramRecord): CramSlightlyLazyFeature;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { CraiIndex, IndexedCramFile } from '@gmod/cram';
|
|
2
|
+
import { toArray } from 'rxjs/operators';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
// jbrowse
|
|
2
5
|
import { BaseFeatureDataAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { checkAbortSignal, updateStatus, toLocale
|
|
6
|
+
import { checkAbortSignal, updateStatus, toLocale } from '@jbrowse/core/util';
|
|
4
7
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
8
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
|
-
import
|
|
7
|
-
import { firstValueFrom } from 'rxjs';
|
|
9
|
+
import QuickLRU from '@jbrowse/core/util/QuickLRU';
|
|
8
10
|
// locals
|
|
9
11
|
import CramSlightlyLazyFeature from './CramSlightlyLazyFeature';
|
|
10
12
|
export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
11
13
|
constructor() {
|
|
12
14
|
super(...arguments);
|
|
13
15
|
this.samHeader = {};
|
|
16
|
+
// used for avoiding re-creation new BamSlightlyLazyFeatures, keeping
|
|
17
|
+
// mismatches in cache. at an average of 100kb-300kb, keeping even just 500
|
|
18
|
+
// of these in memory is fairly intensive but can reduce recomputation on
|
|
19
|
+
// these objects
|
|
20
|
+
this.ultraLongFeatureCache = new QuickLRU({
|
|
21
|
+
maxSize: 500,
|
|
22
|
+
});
|
|
14
23
|
// maps a seqId to original refname, passed specially to render args, to a seqid
|
|
15
24
|
this.seqIdToOriginalRefName = [];
|
|
16
25
|
}
|
|
@@ -177,7 +186,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
177
186
|
: record.tags[tagFilter.tag];
|
|
178
187
|
const filterVal = tagFilter.value;
|
|
179
188
|
if (filterVal === '*'
|
|
180
|
-
? readVal
|
|
189
|
+
? readVal === undefined
|
|
181
190
|
: `${readVal}` !== `${filterVal}`) {
|
|
182
191
|
continue;
|
|
183
192
|
}
|
|
@@ -185,7 +194,15 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
185
194
|
if (readName && record.readName !== readName) {
|
|
186
195
|
continue;
|
|
187
196
|
}
|
|
188
|
-
|
|
197
|
+
const ret = this.ultraLongFeatureCache.get(`${record.uniqueId}`);
|
|
198
|
+
if (!ret) {
|
|
199
|
+
const elt = this.cramRecordToFeature(record);
|
|
200
|
+
this.ultraLongFeatureCache.set(`${record.uniqueId}`, elt);
|
|
201
|
+
observer.next(elt);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
observer.next(ret);
|
|
205
|
+
}
|
|
189
206
|
}
|
|
190
207
|
observer.complete();
|
|
191
208
|
});
|
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util
|
|
1
|
+
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
2
2
|
import { CramRecord } from '@gmod/cram';
|
|
3
3
|
import CramAdapter from './CramAdapter';
|
|
4
4
|
export default class CramSlightlyLazyFeature implements Feature {
|
|
5
5
|
private record;
|
|
6
6
|
private _store;
|
|
7
7
|
constructor(record: CramRecord, _store: CramAdapter);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_get_tags(): Record<string, string>;
|
|
27
|
-
_get_seq(): string | null | undefined;
|
|
28
|
-
_get_CIGAR(): string;
|
|
29
|
-
tags(): string[];
|
|
8
|
+
get name(): string | undefined;
|
|
9
|
+
get start(): number;
|
|
10
|
+
get end(): number;
|
|
11
|
+
get score(): number | undefined;
|
|
12
|
+
get flags(): number;
|
|
13
|
+
get strand(): 1 | -1;
|
|
14
|
+
get qual(): string;
|
|
15
|
+
get qualRaw(): number[] | null | undefined;
|
|
16
|
+
get refName(): string;
|
|
17
|
+
get pair_orientation(): string | null | undefined;
|
|
18
|
+
get template_length(): number | undefined;
|
|
19
|
+
get next_ref(): string | undefined;
|
|
20
|
+
get next_segment_position(): string | undefined;
|
|
21
|
+
get is_paired(): boolean;
|
|
22
|
+
get next_pos(): number | undefined;
|
|
23
|
+
get tags(): Record<string, string>;
|
|
24
|
+
get seq(): string | null | undefined;
|
|
25
|
+
get CIGAR(): string;
|
|
30
26
|
id(): string;
|
|
31
27
|
get(field: string): any;
|
|
32
28
|
parent(): undefined;
|
|
33
29
|
children(): undefined;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_get_clipPos(): any;
|
|
30
|
+
get mismatches(): import("../shared/types").Mismatch[];
|
|
31
|
+
get fields(): SimpleFeatureSerialized;
|
|
37
32
|
toJSON(): SimpleFeatureSerialized;
|
|
38
|
-
_get_mismatches(): import("./util").Mismatch[];
|
|
39
33
|
}
|