@jbrowse/plugin-alignments 3.2.0 → 3.4.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 +7 -3
- package/dist/AlignmentsFeatureDetail/Flags.d.ts +1 -3
- package/dist/AlignmentsFeatureDetail/Flags.js +1 -2
- package/dist/AlignmentsFeatureDetail/LinkedPairedAlignments.d.ts +1 -1
- package/dist/AlignmentsFeatureDetail/LinkedPairedAlignments.js +1 -1
- package/dist/AlignmentsFeatureDetail/stateModelFactory.d.ts +9 -6
- package/dist/AlignmentsFeatureDetail/stateModelFactory.js +1 -2
- package/dist/BamAdapter/BamAdapter.d.ts +0 -1
- package/dist/BamAdapter/BamAdapter.js +0 -1
- package/dist/CramAdapter/CramAdapter.d.ts +0 -1
- package/dist/CramAdapter/CramAdapter.js +0 -1
- package/dist/CramAdapter/CramTestAdapters.d.ts +0 -1
- package/dist/CramAdapter/CramTestAdapters.js +0 -1
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +1 -1
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +6 -4
- package/dist/LinearPileupDisplay/model.d.ts +1 -1
- package/dist/PileupRenderer/PileupRenderer.d.ts +4 -4
- package/dist/PileupRenderer/makeImageData.js +9 -14
- package/dist/PileupRenderer/renderModifications.js +25 -29
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +0 -1
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +0 -1
- package/dist/SNPCoverageAdapter/processModifications.js +34 -38
- package/dist/SNPCoverageRenderer/makeImage.js +25 -36
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +8 -4
- package/esm/AlignmentsFeatureDetail/Flags.d.ts +1 -3
- package/esm/AlignmentsFeatureDetail/Flags.js +1 -2
- package/esm/AlignmentsFeatureDetail/LinkedPairedAlignments.d.ts +1 -1
- package/esm/AlignmentsFeatureDetail/LinkedPairedAlignments.js +1 -1
- package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +9 -6
- package/esm/AlignmentsFeatureDetail/stateModelFactory.js +1 -2
- package/esm/BamAdapter/BamAdapter.d.ts +0 -1
- package/esm/BamAdapter/BamAdapter.js +0 -1
- package/esm/CramAdapter/CramAdapter.d.ts +0 -1
- package/esm/CramAdapter/CramAdapter.js +0 -1
- package/esm/CramAdapter/CramTestAdapters.d.ts +0 -1
- package/esm/CramAdapter/CramTestAdapters.js +0 -1
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +1 -1
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +6 -4
- package/esm/LinearPileupDisplay/model.d.ts +1 -1
- package/esm/PileupRenderer/PileupRenderer.d.ts +4 -4
- package/esm/PileupRenderer/makeImageData.js +3 -8
- package/esm/PileupRenderer/renderModifications.js +25 -29
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +0 -1
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js +0 -1
- package/esm/SNPCoverageAdapter/processModifications.js +34 -38
- package/esm/SNPCoverageRenderer/makeImage.js +26 -37
- package/package.json +11 -11
|
@@ -48,12 +48,16 @@ const tagInfo_1 = require("./tagInfo");
|
|
|
48
48
|
const util_1 = require("./util");
|
|
49
49
|
const SupplementaryAlignments = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SupplementaryAlignments'))));
|
|
50
50
|
const LinkedPairedAlignments = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./LinkedPairedAlignments'))));
|
|
51
|
+
const FeatDefined = (0, mobx_react_1.observer)(function (props) {
|
|
52
|
+
const { model, feat } = props;
|
|
53
|
+
const flags = feat.flags;
|
|
54
|
+
const SA = (0, util_1.getTag)('SA', feat);
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { "data-testid": "alignment-side-drawer", children: [(0, jsx_runtime_1.jsx)(FeatureDetails_1.default, { ...props, descriptions: { tags: tagInfo_1.tags }, feature: feat, formatter: (value, key) => key === 'next_segment_position' ? ((0, jsx_runtime_1.jsx)(PairLink_1.default, { model: model, locString: value })) : ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: value })) }), SA !== undefined ? ((0, jsx_runtime_1.jsx)(SupplementaryAlignments, { model: model, tag: SA, feature: feat })) : null, flags != null ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [flags & 1 ? ((0, jsx_runtime_1.jsx)(LinkedPairedAlignments, { model: model, feature: feat })) : null, (0, jsx_runtime_1.jsx)(Flags_1.default, { flags: flags, ...props })] })) : null] }));
|
|
56
|
+
});
|
|
51
57
|
const AlignmentsFeatureDetails = (0, mobx_react_1.observer)(function (props) {
|
|
52
58
|
const { model } = props;
|
|
53
59
|
const { featureData } = model;
|
|
54
60
|
const feat = structuredClone(featureData);
|
|
55
|
-
|
|
56
|
-
const { flags } = feat;
|
|
57
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { "data-testid": "alignment-side-drawer", children: [(0, jsx_runtime_1.jsx)(FeatureDetails_1.default, { ...props, descriptions: { tags: tagInfo_1.tags }, feature: feat, formatter: (value, key) => key === 'next_segment_position' ? ((0, jsx_runtime_1.jsx)(PairLink_1.default, { model: model, locString: value })) : ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: value })) }), SA !== undefined ? ((0, jsx_runtime_1.jsx)(SupplementaryAlignments, { model: model, tag: SA, feature: feat })) : null, flags & 1 ? ((0, jsx_runtime_1.jsx)(LinkedPairedAlignments, { model: model, feature: feat })) : null, flags !== undefined ? (0, jsx_runtime_1.jsx)(Flags_1.default, { feature: feat, ...props }) : null] }));
|
|
61
|
+
return feat ? ((0, jsx_runtime_1.jsx)(FeatDefined, { feat: feat, ...props })) : ((0, jsx_runtime_1.jsx)("div", { children: "No feature loaded, may not be available after page refresh because it was too large for localStorage" }));
|
|
58
62
|
});
|
|
59
63
|
exports.default = AlignmentsFeatureDetails;
|
|
@@ -32,8 +32,7 @@ const flagNames = [
|
|
|
32
32
|
];
|
|
33
33
|
function AlignmentFlags(props) {
|
|
34
34
|
const { classes } = useStyles();
|
|
35
|
-
const {
|
|
36
|
-
const { flags } = feature;
|
|
35
|
+
const { flags } = props;
|
|
37
36
|
return ((0, jsx_runtime_1.jsxs)(BaseCard_1.default, { ...props, title: "Flags", children: [(0, jsx_runtime_1.jsx)(SimpleField_1.default, { name: "Flag", value: flags }), (0, jsx_runtime_1.jsx)(material_1.FormGroup, { children: flagNames.map((name, idx) => {
|
|
38
37
|
const val = flags & (1 << idx);
|
|
39
38
|
const key = `${name}_${val}`;
|
|
@@ -3,4 +3,4 @@ import type { SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
|
3
3
|
export default function SuppAlignments(props: {
|
|
4
4
|
model: AlignmentFeatureWidgetModel;
|
|
5
5
|
feature: SimpleFeatureSerialized;
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -18,5 +18,5 @@ function SuppAlignments(props) {
|
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
20
20
|
}
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(BaseCard_1.default, { ...props, title: "Paired alignments", children:
|
|
21
|
+
return hasBreakendSplitView ? ((0, jsx_runtime_1.jsx)(BaseCard_1.default, { ...props, title: "Paired alignments", children: (0, jsx_runtime_1.jsx)(LaunchPairedEndBreakpointSplitViewPanel_1.default, { model: model, feature: feature }) })) : null;
|
|
22
22
|
}
|
|
@@ -3,9 +3,9 @@ import type { Instance } from 'mobx-state-tree';
|
|
|
3
3
|
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
4
4
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5
5
|
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
6
|
-
featureData: import("mobx-state-tree").IType<
|
|
6
|
+
featureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
7
7
|
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
8
|
-
unformattedFeatureData: import("mobx-state-tree").IType<
|
|
8
|
+
unformattedFeatureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
9
9
|
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
10
10
|
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
11
11
|
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -35,14 +35,15 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
35
35
|
} & {
|
|
36
36
|
afterAttach(): void;
|
|
37
37
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
38
|
+
descriptions: import("mobx-state-tree").IType<Record<string, unknown> | undefined, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
38
39
|
} & {
|
|
39
40
|
type: import("mobx-state-tree").ISimpleType<"AlignmentsFeatureWidget">;
|
|
40
41
|
}, {
|
|
41
42
|
error: unknown;
|
|
42
43
|
} & {
|
|
43
|
-
setFeatureData(featureData:
|
|
44
|
+
setFeatureData(featureData: import("@jbrowse/core/util").SimpleFeatureSerialized): void;
|
|
44
45
|
clearFeatureData(): void;
|
|
45
|
-
setFormattedData(feat:
|
|
46
|
+
setFormattedData(feat: import("@jbrowse/core/util").SimpleFeatureSerialized): void;
|
|
46
47
|
setExtra(type?: string, trackId?: string, maxDepth?: number): void;
|
|
47
48
|
setError(e: unknown): void;
|
|
48
49
|
} & {
|
|
@@ -52,9 +53,9 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
52
53
|
} & Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
53
54
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
54
55
|
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
55
|
-
featureData: import("mobx-state-tree").IType<
|
|
56
|
+
featureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
56
57
|
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
57
|
-
unformattedFeatureData: import("mobx-state-tree").IType<
|
|
58
|
+
unformattedFeatureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
58
59
|
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
59
60
|
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
60
61
|
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -84,6 +85,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
84
85
|
} & {
|
|
85
86
|
afterAttach(): void;
|
|
86
87
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
88
|
+
descriptions: import("mobx-state-tree").IType<Record<string, unknown> | undefined, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
87
89
|
}>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
|
|
88
90
|
type: "BaseFeatureWidget";
|
|
89
91
|
id: string;
|
|
@@ -94,6 +96,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
94
96
|
maxDepth: number | undefined;
|
|
95
97
|
sequenceFeatureDetails: import("mobx-state-tree").ModelSnapshotType<{}>;
|
|
96
98
|
formattedFields: any;
|
|
99
|
+
descriptions: Record<string, unknown> | undefined;
|
|
97
100
|
finalizedFeatureData: any;
|
|
98
101
|
} & import("mobx-state-tree")._NotCustomized>;
|
|
99
102
|
export type AlignmentFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
|
|
@@ -4,8 +4,7 @@ exports.stateModelFactory = stateModelFactory;
|
|
|
4
4
|
const BaseFeatureWidget_1 = require("@jbrowse/core/BaseFeatureWidget");
|
|
5
5
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
6
6
|
function stateModelFactory(pluginManager) {
|
|
7
|
-
|
|
8
|
-
return mobx_state_tree_1.types.compose(baseModel, mobx_state_tree_1.types.model('AlignmentsFeatureWidget', {
|
|
7
|
+
return mobx_state_tree_1.types.compose((0, BaseFeatureWidget_1.stateModelFactory)(pluginManager), mobx_state_tree_1.types.model('AlignmentsFeatureWidget', {
|
|
9
8
|
type: mobx_state_tree_1.types.literal('AlignmentsFeatureWidget'),
|
|
10
9
|
}));
|
|
11
10
|
}
|
|
@@ -173,7 +173,6 @@ class BamAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
173
173
|
}
|
|
174
174
|
return super.getMultiRegionFeatureDensityStats(regions, opts);
|
|
175
175
|
}
|
|
176
|
-
freeResources() { }
|
|
177
176
|
refIdToName(refId) {
|
|
178
177
|
var _a;
|
|
179
178
|
return (_a = this.samHeader) === null || _a === void 0 ? void 0 : _a.idToName[refId];
|
|
@@ -43,7 +43,6 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
43
43
|
}, opts?: BaseOptions & {
|
|
44
44
|
filterBy: FilterBy;
|
|
45
45
|
}): import("rxjs").Observable<Feature>;
|
|
46
|
-
freeResources(): void;
|
|
47
46
|
cramRecordToFeature(record: CramRecord): CramSlightlyLazyFeature;
|
|
48
47
|
getMultiRegionFeatureDensityStats(regions: Region[], opts?: BaseOptions): Promise<{
|
|
49
48
|
bytes: number;
|
|
@@ -201,7 +201,7 @@ export declare function SharedLinearPileupDisplayMixin(configSchema: AnyConfigur
|
|
|
201
201
|
} & {
|
|
202
202
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
203
203
|
deleteBlock(key: string): void;
|
|
204
|
-
selectFeature(feature: Feature): void
|
|
204
|
+
selectFeature(feature: Feature): Promise<void>;
|
|
205
205
|
navToFeature(feature: Feature): void;
|
|
206
206
|
clearFeatureSelection(): void;
|
|
207
207
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
@@ -225,7 +225,9 @@ function SharedLinearPileupDisplayMixin(configSchema) {
|
|
|
225
225
|
icon: MenuOpen_1.default,
|
|
226
226
|
onClick: () => {
|
|
227
227
|
self.clearFeatureSelection();
|
|
228
|
-
self.selectFeature(feat)
|
|
228
|
+
self.selectFeature(feat).catch((e) => {
|
|
229
|
+
(0, util_1.getSession)(self).notifyError(`${e}`, e);
|
|
230
|
+
});
|
|
229
231
|
},
|
|
230
232
|
},
|
|
231
233
|
{
|
|
@@ -271,13 +273,13 @@ function SharedLinearPileupDisplayMixin(configSchema) {
|
|
|
271
273
|
rendererType: 'PileupRenderer',
|
|
272
274
|
}));
|
|
273
275
|
if ((0, mobx_state_tree_1.isAlive)(self) && feature) {
|
|
274
|
-
self.selectFeature(new util_1.SimpleFeature(feature));
|
|
276
|
+
await self.selectFeature(new util_1.SimpleFeature(feature));
|
|
275
277
|
}
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
catch (e) {
|
|
279
281
|
console.error(e);
|
|
280
|
-
session.
|
|
282
|
+
session.notifyError(`${e}`, e);
|
|
281
283
|
}
|
|
282
284
|
},
|
|
283
285
|
onClick() {
|
|
@@ -306,7 +308,7 @@ function SharedLinearPileupDisplayMixin(configSchema) {
|
|
|
306
308
|
}
|
|
307
309
|
catch (e) {
|
|
308
310
|
console.error(e);
|
|
309
|
-
session.
|
|
311
|
+
session.notifyError(`${e}`, e);
|
|
310
312
|
}
|
|
311
313
|
},
|
|
312
314
|
};
|
|
@@ -205,7 +205,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
205
205
|
} & {
|
|
206
206
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
207
207
|
deleteBlock(key: string): void;
|
|
208
|
-
selectFeature(feature: import("@jbrowse/core/util").Feature): void
|
|
208
|
+
selectFeature(feature: import("@jbrowse/core/util").Feature): Promise<void>;
|
|
209
209
|
navToFeature(feature: import("@jbrowse/core/util").Feature): void;
|
|
210
210
|
clearFeatureSelection(): void;
|
|
211
211
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
@@ -20,7 +20,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
20
20
|
width: number;
|
|
21
21
|
maxHeightReached: boolean;
|
|
22
22
|
containsNoTransferables: boolean;
|
|
23
|
-
canvasRecordedData:
|
|
23
|
+
canvasRecordedData: Record<string, unknown>;
|
|
24
24
|
reactElement?: React.ReactElement;
|
|
25
25
|
html?: string;
|
|
26
26
|
} | {
|
|
@@ -30,7 +30,8 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
30
30
|
width: number;
|
|
31
31
|
maxHeightReached: boolean;
|
|
32
32
|
containsNoTransferables: boolean;
|
|
33
|
-
|
|
33
|
+
imageData: any;
|
|
34
|
+
reactElement?: React.ReactElement;
|
|
34
35
|
html?: string;
|
|
35
36
|
} | {
|
|
36
37
|
features: Map<any, any>;
|
|
@@ -39,8 +40,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
39
40
|
width: number;
|
|
40
41
|
maxHeightReached: boolean;
|
|
41
42
|
containsNoTransferables: boolean;
|
|
42
|
-
|
|
43
|
-
reactElement?: React.ReactElement;
|
|
43
|
+
reactElement: React.ReactElement;
|
|
44
44
|
html?: string;
|
|
45
45
|
}>;
|
|
46
46
|
createLayoutSession(args: PileupLayoutSessionProps): PileupLayoutSession;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeImageData = makeImageData;
|
|
4
4
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
5
|
const ui_1 = require("@jbrowse/core/ui");
|
|
6
|
-
const
|
|
6
|
+
const util_1 = require("@jbrowse/core/util");
|
|
7
7
|
const renderAlignment_1 = require("./renderAlignment");
|
|
8
8
|
const renderMismatches_1 = require("./renderMismatches");
|
|
9
9
|
const renderSoftClipping_1 = require("./renderSoftClipping");
|
|
10
|
-
const
|
|
10
|
+
const util_2 = require("./util");
|
|
11
11
|
function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
12
12
|
const { stopToken, config, showSoftClip, colorBy, theme: configTheme, } = renderArgs;
|
|
13
13
|
const mismatchAlpha = (0, configuration_1.readConfObject)(config, 'mismatchAlpha');
|
|
@@ -16,18 +16,13 @@ function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
|
16
16
|
const hideSmallIndels = (0, configuration_1.readConfObject)(config, 'hideSmallIndels');
|
|
17
17
|
const defaultColor = (0, configuration_1.readConfObject)(config, 'color') === '#f0f';
|
|
18
18
|
const theme = (0, ui_1.createJBrowseTheme)(configTheme);
|
|
19
|
-
const colorMap = (0,
|
|
20
|
-
const colorContrastMap = (0,
|
|
19
|
+
const colorMap = (0, util_2.getColorBaseMap)(theme);
|
|
20
|
+
const colorContrastMap = (0, util_2.getContrastBaseMap)(theme);
|
|
21
21
|
ctx.font = 'bold 10px Courier New,monospace';
|
|
22
|
-
const { charWidth, charHeight } = (0,
|
|
23
|
-
const drawSNPsMuted = (0,
|
|
24
|
-
const drawIndels = (0,
|
|
25
|
-
|
|
26
|
-
for (const feat of layoutRecords) {
|
|
27
|
-
if (performance.now() - start > 400) {
|
|
28
|
-
(0, stopToken_1.checkStopToken)(stopToken);
|
|
29
|
-
start = performance.now();
|
|
30
|
-
}
|
|
22
|
+
const { charWidth, charHeight } = (0, util_2.getCharWidthHeight)();
|
|
23
|
+
const drawSNPsMuted = (0, util_2.shouldDrawSNPsMuted)(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
|
|
24
|
+
const drawIndels = (0, util_2.shouldDrawIndels)();
|
|
25
|
+
(0, util_1.forEachWithStopTokenCheck)(layoutRecords, stopToken, feat => {
|
|
31
26
|
(0, renderAlignment_1.renderAlignment)({
|
|
32
27
|
ctx,
|
|
33
28
|
feat,
|
|
@@ -66,6 +61,6 @@ function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
|
66
61
|
canvasWidth,
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
|
-
}
|
|
64
|
+
});
|
|
70
65
|
return undefined;
|
|
71
66
|
}
|
|
@@ -6,7 +6,7 @@ const util_2 = require("./util");
|
|
|
6
6
|
const getMaximumModificationAtEachPosition_1 = require("../shared/getMaximumModificationAtEachPosition");
|
|
7
7
|
const util_3 = require("../shared/util");
|
|
8
8
|
function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, cigarOps, }) {
|
|
9
|
-
var _a, _b;
|
|
9
|
+
var _a, _b, _c;
|
|
10
10
|
const { feature, topPx, heightPx } = feat;
|
|
11
11
|
const { colorBy, visibleModifications = {} } = renderArgs;
|
|
12
12
|
const seq = feature.get('seq');
|
|
@@ -16,33 +16,29 @@ function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWid
|
|
|
16
16
|
const start = feature.get('start');
|
|
17
17
|
const isolatedModification = (_a = colorBy === null || colorBy === void 0 ? void 0 : colorBy.modifications) === null || _a === void 0 ? void 0 : _a.isolatedModification;
|
|
18
18
|
const twoColor = (_b = colorBy === null || colorBy === void 0 ? void 0 : colorBy.modifications) === null || _b === void 0 ? void 0 : _b.twoColor;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!mod) {
|
|
27
|
-
console.warn(`${type} not known yet`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (isolatedModification && mod.type !== isolatedModification) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const col = mod.color || 'black';
|
|
34
|
-
const s = 1 - (0, util_1.sum)(allProbs);
|
|
35
|
-
if (twoColor && s > (0, util_1.max)(allProbs)) {
|
|
36
|
-
const c = (0, util_3.alphaColor)('blue', s);
|
|
37
|
-
const w = rightPx - leftPx + 0.5;
|
|
38
|
-
(0, util_2.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const c = (0, util_3.alphaColor)(col, prob);
|
|
42
|
-
const w = rightPx - leftPx + 0.5;
|
|
43
|
-
(0, util_2.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
44
|
-
}
|
|
45
|
-
pos++;
|
|
19
|
+
(_c = (0, getMaximumModificationAtEachPosition_1.getMaxProbModAtEachPosition)(feature, cigarOps)) === null || _c === void 0 ? void 0 : _c.forEach(({ allProbs, prob, type }, pos) => {
|
|
20
|
+
const r = start + pos;
|
|
21
|
+
const [leftPx, rightPx] = (0, util_1.bpSpanPx)(r, r + 1, region, bpPerPx);
|
|
22
|
+
const mod = visibleModifications[type];
|
|
23
|
+
if (!mod) {
|
|
24
|
+
console.warn(`${type} not known yet`);
|
|
25
|
+
return;
|
|
46
26
|
}
|
|
47
|
-
|
|
27
|
+
if (isolatedModification && mod.type !== isolatedModification) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const col = mod.color || 'black';
|
|
31
|
+
const s = 1 - (0, util_1.sum)(allProbs);
|
|
32
|
+
if (twoColor && s > (0, util_1.max)(allProbs)) {
|
|
33
|
+
const c = (0, util_3.alphaColor)('blue', s);
|
|
34
|
+
const w = rightPx - leftPx + 0.5;
|
|
35
|
+
(0, util_2.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const c = (0, util_3.alphaColor)(col, prob);
|
|
39
|
+
const w = rightPx - leftPx + 0.5;
|
|
40
|
+
(0, util_2.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
41
|
+
}
|
|
42
|
+
pos++;
|
|
43
|
+
});
|
|
48
44
|
}
|
|
@@ -11,5 +11,4 @@ export default class SNPCoverageAdapter extends BaseFeatureDataAdapter {
|
|
|
11
11
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
12
12
|
getMultiRegionFeatureDensityStats(regions: Region[], opts?: BaseOptions): Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats>;
|
|
13
13
|
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
14
|
-
freeResources(): void;
|
|
15
14
|
}
|
|
@@ -5,50 +5,46 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
5
5
|
const util_2 = require("./util");
|
|
6
6
|
const getMaximumModificationAtEachPosition_1 = require("../shared/getMaximumModificationAtEachPosition");
|
|
7
7
|
function processModifications({ feature, colorBy, region, bins, regionSequence, }) {
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
const fstart = feature.get('start');
|
|
10
10
|
const fstrand = feature.get('strand');
|
|
11
11
|
const fend = feature.get('end');
|
|
12
12
|
const twoColor = (_a = colorBy === null || colorBy === void 0 ? void 0 : colorBy.modifications) === null || _a === void 0 ? void 0 : _a.twoColor;
|
|
13
13
|
const isolatedModification = (_b = colorBy === null || colorBy === void 0 ? void 0 : colorBy.modifications) === null || _b === void 0 ? void 0 : _b.isolatedModification;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
(_c = (0, getMaximumModificationAtEachPosition_1.getMaxProbModAtEachPosition)(feature)) === null || _c === void 0 ? void 0 : _c.forEach(({ allProbs, prob, type }, pos) => {
|
|
15
|
+
if (isolatedModification && type !== isolatedModification) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const epos = pos + fstart - region.start;
|
|
19
|
+
if (epos >= 0 && epos < bins.length && pos + fstart < fend) {
|
|
20
|
+
if (bins[epos] === undefined) {
|
|
21
|
+
bins[epos] = {
|
|
22
|
+
depth: 0,
|
|
23
|
+
readsCounted: 0,
|
|
24
|
+
snps: {},
|
|
25
|
+
ref: {
|
|
26
|
+
probabilities: [],
|
|
27
|
+
entryDepth: 0,
|
|
28
|
+
'-1': 0,
|
|
29
|
+
0: 0,
|
|
30
|
+
1: 0,
|
|
31
|
+
},
|
|
32
|
+
mods: {},
|
|
33
|
+
nonmods: {},
|
|
34
|
+
delskips: {},
|
|
35
|
+
noncov: {},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const s = 1 - (0, util_1.sum)(allProbs);
|
|
39
|
+
const bin = bins[epos];
|
|
40
|
+
bin.refbase = regionSequence[epos];
|
|
41
|
+
if (twoColor && s > (0, util_1.max)(allProbs)) {
|
|
42
|
+
(0, util_2.incWithProbabilities)(bin, fstrand, 'nonmods', `nonmod_${type}`, s);
|
|
20
43
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (bins[epos] === undefined) {
|
|
24
|
-
bins[epos] = {
|
|
25
|
-
depth: 0,
|
|
26
|
-
readsCounted: 0,
|
|
27
|
-
snps: {},
|
|
28
|
-
ref: {
|
|
29
|
-
probabilities: [],
|
|
30
|
-
entryDepth: 0,
|
|
31
|
-
'-1': 0,
|
|
32
|
-
0: 0,
|
|
33
|
-
1: 0,
|
|
34
|
-
},
|
|
35
|
-
mods: {},
|
|
36
|
-
nonmods: {},
|
|
37
|
-
delskips: {},
|
|
38
|
-
noncov: {},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const s = 1 - (0, util_1.sum)(allProbs);
|
|
42
|
-
const bin = bins[epos];
|
|
43
|
-
bin.refbase = regionSequence[epos];
|
|
44
|
-
if (twoColor && s > (0, util_1.max)(allProbs)) {
|
|
45
|
-
(0, util_2.incWithProbabilities)(bin, fstrand, 'nonmods', `nonmod_${type}`, s);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
(0, util_2.incWithProbabilities)(bin, fstrand, 'mods', `mod_${type}`, prob);
|
|
49
|
-
}
|
|
44
|
+
else {
|
|
45
|
+
(0, util_2.incWithProbabilities)(bin, fstrand, 'mods', `mod_${type}`, prob);
|
|
50
46
|
}
|
|
51
|
-
pos++;
|
|
52
47
|
}
|
|
53
|
-
|
|
48
|
+
pos++;
|
|
49
|
+
});
|
|
54
50
|
}
|
|
@@ -4,7 +4,6 @@ exports.makeImage = makeImage;
|
|
|
4
4
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
5
|
const ui_1 = require("@jbrowse/core/ui");
|
|
6
6
|
const util_1 = require("@jbrowse/core/util");
|
|
7
|
-
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
8
7
|
const plugin_wiggle_1 = require("@jbrowse/plugin-wiggle");
|
|
9
8
|
const util_2 = require("../shared/util");
|
|
10
9
|
const INTERBASE_INDICATOR_WIDTH = 7;
|
|
@@ -18,7 +17,7 @@ const complementBase = {
|
|
|
18
17
|
};
|
|
19
18
|
const fudgeFactor = 0.6;
|
|
20
19
|
async function makeImage(ctx, props) {
|
|
21
|
-
var _a
|
|
20
|
+
var _a;
|
|
22
21
|
const { features, regions, bpPerPx, colorBy, displayCrossHatches, visibleModifications = {}, scaleOpts, height: unadjustedHeight, theme: configTheme, config: cfg, ticks, stopToken, } = props;
|
|
23
22
|
const theme = (0, ui_1.createJBrowseTheme)(configTheme);
|
|
24
23
|
const region = regions[0];
|
|
@@ -56,35 +55,25 @@ async function makeImage(ctx, props) {
|
|
|
56
55
|
cpg_meth: 'red',
|
|
57
56
|
cpg_unmeth: 'blue',
|
|
58
57
|
};
|
|
59
|
-
const feats = [...features.values()];
|
|
60
58
|
ctx.fillStyle = colorMap.total;
|
|
61
|
-
|
|
62
|
-
for (const feature of feats) {
|
|
59
|
+
(0, util_1.forEachWithStopTokenCheck)(features.values(), stopToken, feature => {
|
|
63
60
|
if (feature.get('type') === 'skip') {
|
|
64
|
-
|
|
61
|
+
return;
|
|
65
62
|
}
|
|
66
63
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
67
64
|
const w = rightPx - leftPx + fudgeFactor;
|
|
68
65
|
const score = feature.get('score');
|
|
69
66
|
ctx.fillRect(leftPx, toY(score), w, toHeight(score));
|
|
70
|
-
|
|
71
|
-
(0, stopToken_1.checkStopToken)(stopToken);
|
|
72
|
-
start = performance.now();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
67
|
+
});
|
|
75
68
|
let prevTotal = 0;
|
|
76
69
|
const extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx : 0;
|
|
77
70
|
const drawingModifications = colorBy.type === 'modifications';
|
|
78
71
|
const drawingMethylation = colorBy.type === 'methylation';
|
|
79
72
|
const isolatedModification = (_a = colorBy.modifications) === null || _a === void 0 ? void 0 : _a.isolatedModification;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const now = performance.now();
|
|
83
|
-
if (now - start > 400) {
|
|
84
|
-
(0, stopToken_1.checkStopToken)(stopToken);
|
|
85
|
-
}
|
|
73
|
+
(0, util_1.forEachWithStopTokenCheck)(features.values(), stopToken, feature => {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
86
75
|
if (feature.get('type') === 'skip') {
|
|
87
|
-
|
|
76
|
+
return;
|
|
88
77
|
}
|
|
89
78
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
90
79
|
const snpinfo = feature.get('snpinfo');
|
|
@@ -92,7 +81,7 @@ async function makeImage(ctx, props) {
|
|
|
92
81
|
const score0 = feature.get('score');
|
|
93
82
|
if (drawingModifications) {
|
|
94
83
|
let curr = 0;
|
|
95
|
-
const refbase = (
|
|
84
|
+
const refbase = (_a = snpinfo.refbase) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
96
85
|
const { nonmods, mods, snps, ref } = snpinfo;
|
|
97
86
|
for (const m of Object.keys(nonmods).sort().reverse()) {
|
|
98
87
|
const mod = visibleModifications[m.replace('nonmod_', '')] ||
|
|
@@ -107,14 +96,14 @@ async function makeImage(ctx, props) {
|
|
|
107
96
|
const cmp = complementBase[mod.base];
|
|
108
97
|
const detectable = mod.base === 'N'
|
|
109
98
|
? score0
|
|
110
|
-
: (((
|
|
111
|
-
(((
|
|
99
|
+
: (((_b = snps[mod.base]) === null || _b === void 0 ? void 0 : _b.entryDepth) || 0) +
|
|
100
|
+
(((_c = snps[cmp]) === null || _c === void 0 ? void 0 : _c.entryDepth) || 0) +
|
|
112
101
|
(refbase === mod.base ? ref['1'] : 0) +
|
|
113
102
|
(refbase === cmp ? ref['-1'] : 0);
|
|
114
103
|
const modifiable = mod.base === 'N'
|
|
115
104
|
? score0
|
|
116
|
-
: (((
|
|
117
|
-
(((
|
|
105
|
+
: (((_d = snps[mod.base]) === null || _d === void 0 ? void 0 : _d.entryDepth) || 0) +
|
|
106
|
+
(((_e = snps[cmp]) === null || _e === void 0 ? void 0 : _e.entryDepth) || 0) +
|
|
118
107
|
(refbase === mod.base ? ref.entryDepth : 0) +
|
|
119
108
|
(refbase === cmp ? ref.entryDepth : 0);
|
|
120
109
|
const { entryDepth, avgProbability = 0 } = snpinfo.nonmods[m];
|
|
@@ -139,14 +128,14 @@ async function makeImage(ctx, props) {
|
|
|
139
128
|
const cmp = complementBase[mod.base];
|
|
140
129
|
const detectable = mod.base === 'N'
|
|
141
130
|
? score0
|
|
142
|
-
: (((
|
|
143
|
-
(((
|
|
131
|
+
: (((_f = snps[mod.base]) === null || _f === void 0 ? void 0 : _f.entryDepth) || 0) +
|
|
132
|
+
(((_g = snps[cmp]) === null || _g === void 0 ? void 0 : _g.entryDepth) || 0) +
|
|
144
133
|
(refbase === mod.base ? ref['1'] : 0) +
|
|
145
134
|
(refbase === cmp ? ref['-1'] : 0);
|
|
146
135
|
const modifiable = mod.base === 'N'
|
|
147
136
|
? score0
|
|
148
|
-
: (((
|
|
149
|
-
(((
|
|
137
|
+
: (((_h = snps[mod.base]) === null || _h === void 0 ? void 0 : _h.entryDepth) || 0) +
|
|
138
|
+
(((_j = snps[cmp]) === null || _j === void 0 ? void 0 : _j.entryDepth) || 0) +
|
|
150
139
|
(refbase === mod.base ? ref.entryDepth : 0) +
|
|
151
140
|
(refbase === cmp ? ref.entryDepth : 0);
|
|
152
141
|
const { entryDepth, avgProbability = 0 } = mods[m];
|
|
@@ -228,17 +217,17 @@ async function makeImage(ctx, props) {
|
|
|
228
217
|
}
|
|
229
218
|
}
|
|
230
219
|
prevTotal = score0;
|
|
231
|
-
}
|
|
220
|
+
});
|
|
232
221
|
if (showArcs) {
|
|
233
|
-
|
|
234
|
-
if (
|
|
235
|
-
|
|
222
|
+
(0, util_1.forEachWithStopTokenCheck)(features.values(), stopToken, feature => {
|
|
223
|
+
if (feature.get('type') !== 'skip') {
|
|
224
|
+
return;
|
|
236
225
|
}
|
|
237
|
-
const s =
|
|
238
|
-
const e =
|
|
226
|
+
const s = feature.get('start');
|
|
227
|
+
const e = feature.get('end');
|
|
239
228
|
const [left, right] = (0, util_1.bpSpanPx)(s, e, region, bpPerPx);
|
|
240
229
|
ctx.beginPath();
|
|
241
|
-
const effectiveStrand =
|
|
230
|
+
const effectiveStrand = feature.get('effectiveStrand');
|
|
242
231
|
const pos = 'rgba(255,200,200,0.7)';
|
|
243
232
|
const neg = 'rgba(200,200,255,0.7)';
|
|
244
233
|
const neutral = 'rgba(200,200,200,0.7)';
|
|
@@ -251,11 +240,11 @@ async function makeImage(ctx, props) {
|
|
|
251
240
|
else {
|
|
252
241
|
ctx.strokeStyle = neutral;
|
|
253
242
|
}
|
|
254
|
-
ctx.lineWidth = Math.log(
|
|
243
|
+
ctx.lineWidth = Math.log(feature.get('score') + 1);
|
|
255
244
|
ctx.moveTo(left, height - offset * 2);
|
|
256
245
|
ctx.bezierCurveTo(left, 0, right, 0, right, height - offset * 2);
|
|
257
246
|
ctx.stroke();
|
|
258
|
-
}
|
|
247
|
+
});
|
|
259
248
|
}
|
|
260
249
|
if (displayCrossHatches) {
|
|
261
250
|
ctx.lineWidth = 1;
|