@jbrowse/plugin-sequence 2.18.0 → 3.0.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/BgzipFastaAdapter/index.js +17 -7
- package/dist/ChromSizesAdapter/index.js +17 -7
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +1 -2
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +28 -41
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +1 -1
- package/dist/IndexedFastaAdapter/index.js +17 -7
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +6 -6
- package/dist/SequenceSearchAdapter/index.js +17 -7
- package/dist/TwoBitAdapter/index.js +17 -7
- package/dist/UnindexedFastaAdapter/index.js +17 -7
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.d.ts +1 -2
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +28 -38
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +1 -1
- package/esm/LinearReferenceSequenceDisplay/model.d.ts +6 -6
- package/package.json +4 -4
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
2
|
import type { Feature, Region } from '@jbrowse/core/util';
|
|
4
3
|
import type { Theme } from '@mui/material';
|
|
@@ -17,5 +16,5 @@ declare const DivSequenceRendering: (props: {
|
|
|
17
16
|
showForward?: boolean;
|
|
18
17
|
showReverse?: boolean;
|
|
19
18
|
showTranslation?: boolean;
|
|
20
|
-
}) =>
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
export default DivSequenceRendering;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
7
5
|
const ui_1 = require("@jbrowse/core/ui");
|
|
8
6
|
const util_1 = require("@jbrowse/core/util");
|
|
9
7
|
const mobx_react_1 = require("mobx-react");
|
|
@@ -34,24 +32,20 @@ function Translation({ codonTable, seq, frame, bpPerPx, colorByCDS, region, seqS
|
|
|
34
32
|
const defaultFill = colorByCDS
|
|
35
33
|
? (_a = theme === null || theme === void 0 ? void 0 : theme.palette.framesCDS.at(frame)) === null || _a === void 0 ? void 0 : _a.main
|
|
36
34
|
: (_b = theme === null || theme === void 0 ? void 0 : theme.palette.frames.at(frame)) === null || _b === void 0 ? void 0 : _b.main;
|
|
37
|
-
return (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
? codonWidth
|
|
52
|
-
: codonWidth + 0.7, height: height, stroke: renderLetter ? '#555' : 'none', fill: codonFill || 'none' }),
|
|
53
|
-
renderLetter ? (react_1.default.createElement("text", { x: x + codonWidth / 2, fontSize: height - 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle" }, letter)) : null));
|
|
54
|
-
})));
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("rect", { x: 0, y: y, width: width, height: height, fill: defaultFill }), translated.map((element, index) => {
|
|
36
|
+
const x = region.reversed
|
|
37
|
+
? width - (index + 1) * codonWidth - offset
|
|
38
|
+
: codonWidth * index + offset;
|
|
39
|
+
const { letter, codon } = element;
|
|
40
|
+
const codonFill = util_1.defaultStarts.includes(codon)
|
|
41
|
+
? theme === null || theme === void 0 ? void 0 : theme.palette.startCodon
|
|
42
|
+
: util_1.defaultStops.includes(codon)
|
|
43
|
+
? theme === null || theme === void 0 ? void 0 : theme.palette.stopCodon
|
|
44
|
+
: undefined;
|
|
45
|
+
return !(renderLetter || codonFill) ? null : ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("rect", { x: x, y: y, width: renderLetter
|
|
46
|
+
? codonWidth
|
|
47
|
+
: codonWidth + 0.7, height: height, stroke: renderLetter ? '#555' : 'none', fill: codonFill || 'none' }), renderLetter ? ((0, jsx_runtime_1.jsx)("text", { x: x + codonWidth / 2, fontSize: height - 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", children: letter })) : null] }, `${index}-${letter}`));
|
|
48
|
+
})] }));
|
|
55
49
|
}
|
|
56
50
|
function Sequence({ bpPerPx, region, feature, sequenceType, theme, height, seq, y, }) {
|
|
57
51
|
const render = 1 / bpPerPx >= 12;
|
|
@@ -61,16 +55,14 @@ function Sequence({ bpPerPx, region, feature, sequenceType, theme, height, seq,
|
|
|
61
55
|
const reverse = region.reversed;
|
|
62
56
|
const len = e - s;
|
|
63
57
|
const w = Math.max((rightPx - leftPx) / len, 0.8);
|
|
64
|
-
return (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
render ? (react_1.default.createElement("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fontSize: height - 2, fill: color ? theme.palette.getContrastText(color.main) : 'black' }, letter)) : null));
|
|
73
|
-
})));
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: seq.split('').map((letter, index) => {
|
|
59
|
+
const color = sequenceType === 'dna'
|
|
60
|
+
?
|
|
61
|
+
theme.palette.bases[letter.toUpperCase()]
|
|
62
|
+
: undefined;
|
|
63
|
+
const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("rect", { x: x, y: y, width: w, height: height, fill: color ? color.main : '#aaa', stroke: render ? '#555' : 'none' }), render ? ((0, jsx_runtime_1.jsx)("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fontSize: height - 2, fill: color ? theme.palette.getContrastText(color.main) : 'black', children: letter })) : null] }, `${letter}-${index}`));
|
|
65
|
+
}) }));
|
|
74
66
|
}
|
|
75
67
|
function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new Map(), showReverse = true, showForward = true, showTranslation = true, sequenceType = 'dna', bpPerPx, rowHeight, }) {
|
|
76
68
|
const region = regions[0];
|
|
@@ -91,25 +83,20 @@ function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new M
|
|
|
91
83
|
const [topFrames, bottomFrames] = region.reversed
|
|
92
84
|
? [reverseFrames.toReversed(), forwardFrames.toReversed()]
|
|
93
85
|
: [forwardFrames, reverseFrames];
|
|
94
|
-
return (
|
|
95
|
-
topFrames.map(index => (react_1.default.createElement(Translation, { key: `translation-${index}`, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: region.reversed }))),
|
|
96
|
-
showForward && showSequence ? (react_1.default.createElement(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? (0, util_1.complement)(seq) : seq, bpPerPx: bpPerPx, theme: theme })) : null,
|
|
97
|
-
showReverse && showSequence ? (react_1.default.createElement(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : (0, util_1.complement)(seq), bpPerPx: bpPerPx, theme: theme })) : null,
|
|
98
|
-
bottomFrames.map(index => (react_1.default.createElement(Translation, { key: `rev-translation-${index}`, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: !region.reversed })))));
|
|
86
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [topFrames.map(index => ((0, jsx_runtime_1.jsx)(Translation, { colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: region.reversed }, `translation-${index}`))), showForward && showSequence ? ((0, jsx_runtime_1.jsx)(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? (0, util_1.complement)(seq) : seq, bpPerPx: bpPerPx, theme: theme })) : null, showReverse && showSequence ? ((0, jsx_runtime_1.jsx)(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : (0, util_1.complement)(seq), bpPerPx: bpPerPx, theme: theme })) : null, bottomFrames.map(index => ((0, jsx_runtime_1.jsx)(Translation, { colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: !region.reversed }, `rev-translation-${index}`)))] }));
|
|
99
87
|
}
|
|
100
88
|
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
101
|
-
return exportSVG ? (children) : (
|
|
89
|
+
return exportSVG ? (children) : ((0, jsx_runtime_1.jsx)("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: {
|
|
102
90
|
display: 'block',
|
|
103
91
|
width,
|
|
104
92
|
height: totalHeight,
|
|
105
93
|
userSelect: 'none',
|
|
106
|
-
}
|
|
94
|
+
}, children: children }));
|
|
107
95
|
}
|
|
108
96
|
const DivSequenceRendering = (0, mobx_react_1.observer)(function (props) {
|
|
109
97
|
const { regions, bpPerPx, sequenceHeight } = props;
|
|
110
98
|
const region = regions[0];
|
|
111
99
|
const width = (region.end - region.start) / bpPerPx;
|
|
112
|
-
return (
|
|
113
|
-
react_1.default.createElement(SequenceSVG, { ...props })));
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(Wrapper, { ...props, totalHeight: sequenceHeight, width: width, children: (0, jsx_runtime_1.jsx)(SequenceSVG, { ...props }) }));
|
|
114
101
|
});
|
|
115
102
|
exports.default = DivSequenceRendering;
|
|
@@ -67,7 +67,7 @@ class IndexedFastaAdapter extends BaseAdapter_1.BaseSequenceAdapter {
|
|
|
67
67
|
await (0, util_1.updateStatus2)('Downloading sequence', statusCallback, stopToken, async () => {
|
|
68
68
|
const { fasta } = await this.setup();
|
|
69
69
|
const size = await fasta.getSequenceSize(refName);
|
|
70
|
-
const regionEnd = Math.min(size, end);
|
|
70
|
+
const regionEnd = Math.min(size || 0, end);
|
|
71
71
|
const chunks = [];
|
|
72
72
|
const chunkSize = 128000;
|
|
73
73
|
const s = start - (start % chunkSize);
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -34,7 +34,7 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
34
34
|
status?: string;
|
|
35
35
|
reactElement?: React.ReactElement;
|
|
36
36
|
};
|
|
37
|
-
}) => import("react").JSX.Element | undefined;
|
|
37
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
38
38
|
renderProps: any;
|
|
39
39
|
} & {
|
|
40
40
|
doReload(): void;
|
|
@@ -172,13 +172,13 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
172
172
|
} & {
|
|
173
173
|
readonly statsReadyAndRegionNotTooLarge: boolean;
|
|
174
174
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
175
|
-
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
|
|
175
|
+
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
|
|
176
176
|
} & {
|
|
177
177
|
featureIdUnderMouse: undefined | string;
|
|
178
178
|
contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
|
|
179
179
|
} & {
|
|
180
|
-
readonly DisplayMessageComponent:
|
|
181
|
-
readonly blockType: "
|
|
180
|
+
readonly DisplayMessageComponent: undefined | React.FC<any>;
|
|
181
|
+
readonly blockType: "staticBlocks" | "dynamicBlocks";
|
|
182
182
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
183
183
|
} & {
|
|
184
184
|
readonly renderDelay: number;
|
|
@@ -205,7 +205,7 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
205
205
|
contextMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
206
206
|
renderProps(): any;
|
|
207
207
|
} & {
|
|
208
|
-
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
|
|
208
|
+
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
209
209
|
afterAttach(): void;
|
|
210
210
|
} & {
|
|
211
211
|
rowHeight: number;
|
|
@@ -270,7 +270,7 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
270
270
|
status?: string;
|
|
271
271
|
reactElement?: React.ReactElement;
|
|
272
272
|
};
|
|
273
|
-
}) => import("react").JSX.Element | undefined;
|
|
273
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
274
274
|
renderProps: any;
|
|
275
275
|
} & {
|
|
276
276
|
doReload(): void;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
2
|
import type { Feature, Region } from '@jbrowse/core/util';
|
|
4
3
|
import type { Theme } from '@mui/material';
|
|
@@ -17,5 +16,5 @@ declare const DivSequenceRendering: (props: {
|
|
|
17
16
|
showForward?: boolean;
|
|
18
17
|
showReverse?: boolean;
|
|
19
18
|
showTranslation?: boolean;
|
|
20
|
-
}) =>
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
export default DivSequenceRendering;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
2
3
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
4
|
import { bpSpanPx, complement, defaultCodonTable, defaultStarts, defaultStops, generateCodonTable, revcom, } from '@jbrowse/core/util';
|
|
4
5
|
import { observer } from 'mobx-react';
|
|
@@ -29,24 +30,20 @@ function Translation({ codonTable, seq, frame, bpPerPx, colorByCDS, region, seqS
|
|
|
29
30
|
const defaultFill = colorByCDS
|
|
30
31
|
? (_a = theme === null || theme === void 0 ? void 0 : theme.palette.framesCDS.at(frame)) === null || _a === void 0 ? void 0 : _a.main
|
|
31
32
|
: (_b = theme === null || theme === void 0 ? void 0 : theme.palette.frames.at(frame)) === null || _b === void 0 ? void 0 : _b.main;
|
|
32
|
-
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? codonWidth
|
|
47
|
-
: codonWidth + 0.7, height: height, stroke: renderLetter ? '#555' : 'none', fill: codonFill || 'none' }),
|
|
48
|
-
renderLetter ? (React.createElement("text", { x: x + codonWidth / 2, fontSize: height - 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle" }, letter)) : null));
|
|
49
|
-
})));
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx("rect", { x: 0, y: y, width: width, height: height, fill: defaultFill }), translated.map((element, index) => {
|
|
34
|
+
const x = region.reversed
|
|
35
|
+
? width - (index + 1) * codonWidth - offset
|
|
36
|
+
: codonWidth * index + offset;
|
|
37
|
+
const { letter, codon } = element;
|
|
38
|
+
const codonFill = defaultStarts.includes(codon)
|
|
39
|
+
? theme === null || theme === void 0 ? void 0 : theme.palette.startCodon
|
|
40
|
+
: defaultStops.includes(codon)
|
|
41
|
+
? theme === null || theme === void 0 ? void 0 : theme.palette.stopCodon
|
|
42
|
+
: undefined;
|
|
43
|
+
return !(renderLetter || codonFill) ? null : (_jsxs(Fragment, { children: [_jsx("rect", { x: x, y: y, width: renderLetter
|
|
44
|
+
? codonWidth
|
|
45
|
+
: codonWidth + 0.7, height: height, stroke: renderLetter ? '#555' : 'none', fill: codonFill || 'none' }), renderLetter ? (_jsx("text", { x: x + codonWidth / 2, fontSize: height - 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", children: letter })) : null] }, `${index}-${letter}`));
|
|
46
|
+
})] }));
|
|
50
47
|
}
|
|
51
48
|
function Sequence({ bpPerPx, region, feature, sequenceType, theme, height, seq, y, }) {
|
|
52
49
|
const render = 1 / bpPerPx >= 12;
|
|
@@ -56,16 +53,14 @@ function Sequence({ bpPerPx, region, feature, sequenceType, theme, height, seq,
|
|
|
56
53
|
const reverse = region.reversed;
|
|
57
54
|
const len = e - s;
|
|
58
55
|
const w = Math.max((rightPx - leftPx) / len, 0.8);
|
|
59
|
-
return (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
render ? (React.createElement("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fontSize: height - 2, fill: color ? theme.palette.getContrastText(color.main) : 'black' }, letter)) : null));
|
|
68
|
-
})));
|
|
56
|
+
return (_jsx(_Fragment, { children: seq.split('').map((letter, index) => {
|
|
57
|
+
const color = sequenceType === 'dna'
|
|
58
|
+
?
|
|
59
|
+
theme.palette.bases[letter.toUpperCase()]
|
|
60
|
+
: undefined;
|
|
61
|
+
const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
|
|
62
|
+
return (_jsxs(Fragment, { children: [_jsx("rect", { x: x, y: y, width: w, height: height, fill: color ? color.main : '#aaa', stroke: render ? '#555' : 'none' }), render ? (_jsx("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fontSize: height - 2, fill: color ? theme.palette.getContrastText(color.main) : 'black', children: letter })) : null] }, `${letter}-${index}`));
|
|
63
|
+
}) }));
|
|
69
64
|
}
|
|
70
65
|
function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new Map(), showReverse = true, showForward = true, showTranslation = true, sequenceType = 'dna', bpPerPx, rowHeight, }) {
|
|
71
66
|
const region = regions[0];
|
|
@@ -86,25 +81,20 @@ function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new M
|
|
|
86
81
|
const [topFrames, bottomFrames] = region.reversed
|
|
87
82
|
? [reverseFrames.toReversed(), forwardFrames.toReversed()]
|
|
88
83
|
: [forwardFrames, reverseFrames];
|
|
89
|
-
return (
|
|
90
|
-
topFrames.map(index => (React.createElement(Translation, { key: `translation-${index}`, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: region.reversed }))),
|
|
91
|
-
showForward && showSequence ? (React.createElement(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? complement(seq) : seq, bpPerPx: bpPerPx, theme: theme })) : null,
|
|
92
|
-
showReverse && showSequence ? (React.createElement(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : complement(seq), bpPerPx: bpPerPx, theme: theme })) : null,
|
|
93
|
-
bottomFrames.map(index => (React.createElement(Translation, { key: `rev-translation-${index}`, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: !region.reversed })))));
|
|
84
|
+
return (_jsxs(_Fragment, { children: [topFrames.map(index => (_jsx(Translation, { colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: region.reversed }, `translation-${index}`))), showForward && showSequence ? (_jsx(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? complement(seq) : seq, bpPerPx: bpPerPx, theme: theme })) : null, showReverse && showSequence ? (_jsx(Sequence, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : complement(seq), bpPerPx: bpPerPx, theme: theme })) : null, bottomFrames.map(index => (_jsx(Translation, { colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), theme: theme, height: rowHeight, reverse: !region.reversed }, `rev-translation-${index}`)))] }));
|
|
94
85
|
}
|
|
95
86
|
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
96
|
-
return exportSVG ? (children) : (
|
|
87
|
+
return exportSVG ? (children) : (_jsx("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: {
|
|
97
88
|
display: 'block',
|
|
98
89
|
width,
|
|
99
90
|
height: totalHeight,
|
|
100
91
|
userSelect: 'none',
|
|
101
|
-
}
|
|
92
|
+
}, children: children }));
|
|
102
93
|
}
|
|
103
94
|
const DivSequenceRendering = observer(function (props) {
|
|
104
95
|
const { regions, bpPerPx, sequenceHeight } = props;
|
|
105
96
|
const region = regions[0];
|
|
106
97
|
const width = (region.end - region.start) / bpPerPx;
|
|
107
|
-
return (
|
|
108
|
-
React.createElement(SequenceSVG, { ...props })));
|
|
98
|
+
return (_jsx(Wrapper, { ...props, totalHeight: sequenceHeight, width: width, children: _jsx(SequenceSVG, { ...props }) }));
|
|
109
99
|
});
|
|
110
100
|
export default DivSequenceRendering;
|
|
@@ -62,7 +62,7 @@ export default class IndexedFastaAdapter extends BaseSequenceAdapter {
|
|
|
62
62
|
await updateStatus2('Downloading sequence', statusCallback, stopToken, async () => {
|
|
63
63
|
const { fasta } = await this.setup();
|
|
64
64
|
const size = await fasta.getSequenceSize(refName);
|
|
65
|
-
const regionEnd = Math.min(size, end);
|
|
65
|
+
const regionEnd = Math.min(size || 0, end);
|
|
66
66
|
const chunks = [];
|
|
67
67
|
const chunkSize = 128000;
|
|
68
68
|
const s = start - (start % chunkSize);
|
|
@@ -34,7 +34,7 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
34
34
|
status?: string;
|
|
35
35
|
reactElement?: React.ReactElement;
|
|
36
36
|
};
|
|
37
|
-
}) => import("react").JSX.Element | undefined;
|
|
37
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
38
38
|
renderProps: any;
|
|
39
39
|
} & {
|
|
40
40
|
doReload(): void;
|
|
@@ -172,13 +172,13 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
172
172
|
} & {
|
|
173
173
|
readonly statsReadyAndRegionNotTooLarge: boolean;
|
|
174
174
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
175
|
-
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
|
|
175
|
+
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
|
|
176
176
|
} & {
|
|
177
177
|
featureIdUnderMouse: undefined | string;
|
|
178
178
|
contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
|
|
179
179
|
} & {
|
|
180
|
-
readonly DisplayMessageComponent:
|
|
181
|
-
readonly blockType: "
|
|
180
|
+
readonly DisplayMessageComponent: undefined | React.FC<any>;
|
|
181
|
+
readonly blockType: "staticBlocks" | "dynamicBlocks";
|
|
182
182
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
183
183
|
} & {
|
|
184
184
|
readonly renderDelay: number;
|
|
@@ -205,7 +205,7 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
205
205
|
contextMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
206
206
|
renderProps(): any;
|
|
207
207
|
} & {
|
|
208
|
-
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
|
|
208
|
+
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
209
209
|
afterAttach(): void;
|
|
210
210
|
} & {
|
|
211
211
|
rowHeight: number;
|
|
@@ -270,7 +270,7 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
270
270
|
status?: string;
|
|
271
271
|
reactElement?: React.ReactElement;
|
|
272
272
|
};
|
|
273
|
-
}) => import("react").JSX.Element | undefined;
|
|
273
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
274
274
|
renderProps: any;
|
|
275
275
|
} & {
|
|
276
276
|
doReload(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-sequence",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "JBrowse 2 sequence adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@gmod/abortable-promise-cache": "^2.0.0",
|
|
40
|
-
"@gmod/indexedfasta": "^
|
|
41
|
-
"@gmod/twobit": "^
|
|
40
|
+
"@gmod/indexedfasta": "^3.0.0",
|
|
41
|
+
"@gmod/twobit": "^4.0.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@jbrowse/core": "^2.0.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"distModule": "esm/index.js",
|
|
58
58
|
"srcModule": "src/index.ts",
|
|
59
59
|
"module": "esm/index.js",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2c6897f1fa732b1db5b094d1dca197e333e95319"
|
|
61
61
|
}
|