@jbrowse/plugin-sequence 2.6.3 → 2.7.1
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/ChromSizesAdapter/ChromSizesAdapter.d.ts +2 -6
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +5 -5
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +8 -8
- package/esm/ChromSizesAdapter/ChromSizesAdapter.d.ts +2 -6
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.d.ts +5 -5
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +8 -8
- package/package.json +3 -3
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { RegionsAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
export default class extends BaseAdapter implements RegionsAdapter {
|
|
3
|
-
protected setupP?: Promise<
|
|
4
|
-
[key: string]: number;
|
|
5
|
-
}>;
|
|
3
|
+
protected setupP?: Promise<Record<string, number>>;
|
|
6
4
|
setupPre(): Promise<{
|
|
7
5
|
[k: string]: number;
|
|
8
6
|
}>;
|
|
9
|
-
setup(): Promise<
|
|
10
|
-
[key: string]: number;
|
|
11
|
-
}>;
|
|
7
|
+
setup(): Promise<Record<string, number>>;
|
|
12
8
|
getRegions(): Promise<{
|
|
13
9
|
refName: string;
|
|
14
10
|
start: number;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
3
|
import { Feature, Region } from '@jbrowse/core/util';
|
|
4
|
-
|
|
4
|
+
import { Theme } from '@mui/material';
|
|
5
|
+
declare const DivSequenceRendering: (props: {
|
|
5
6
|
exportSVG?: {
|
|
6
7
|
rasterizeLayers: boolean;
|
|
7
8
|
};
|
|
@@ -9,10 +10,9 @@ declare function Sequence(props: {
|
|
|
9
10
|
regions: Region[];
|
|
10
11
|
bpPerPx: number;
|
|
11
12
|
config: AnyConfigurationModel;
|
|
12
|
-
theme?:
|
|
13
|
+
theme?: Theme;
|
|
13
14
|
showForward?: boolean;
|
|
14
15
|
showReverse?: boolean;
|
|
15
16
|
showTranslation?: boolean;
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export default _default;
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
export default DivSequenceRendering;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
6
|
const react_1 = __importDefault(require("react"));
|
|
8
7
|
const ui_1 = require("@jbrowse/core/ui");
|
|
9
8
|
const mobx_react_1 = require("mobx-react");
|
|
@@ -53,6 +52,7 @@ function DNA(props) {
|
|
|
53
52
|
const len = feature.get('end') - feature.get('start');
|
|
54
53
|
const w = Math.max((rightPx - leftPx) / len, 0.8);
|
|
55
54
|
return (react_1.default.createElement(react_1.default.Fragment, null, seq.split('').map((letter, index) => {
|
|
55
|
+
// @ts-expect-error
|
|
56
56
|
const color = theme.palette.bases[letter.toUpperCase()];
|
|
57
57
|
const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
|
|
58
58
|
return (react_1.default.createElement(react_1.default.Fragment, { key: index },
|
|
@@ -60,7 +60,7 @@ function DNA(props) {
|
|
|
60
60
|
render ? (react_1.default.createElement("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fill: color ? theme.palette.getContrastText(color.main) : 'black' }, letter)) : null));
|
|
61
61
|
})));
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
function SequenceSVG({ regions, theme: configTheme, features = new Map(), showReverse = true, showForward = true, showTranslation = true, bpPerPx, }) {
|
|
64
64
|
const [region] = regions;
|
|
65
65
|
const theme = (0, ui_1.createJBrowseTheme)(configTheme);
|
|
66
66
|
const codonTable = (0, util_1.generateCodonTable)(util_1.defaultCodonTable);
|
|
@@ -85,16 +85,16 @@ const SequenceSVG = ({ regions, theme: configTheme, features = new Map(), showRe
|
|
|
85
85
|
showTranslation && (region.reversed ? showForward : showReverse)
|
|
86
86
|
? [0, -1, -2].map(index => (react_1.default.createElement(Translation, { key: `rev-translation-${index}`, seq: seq, y: (currY += 20), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, theme: theme, height: height, reverse: !region.reversed })))
|
|
87
87
|
: null));
|
|
88
|
-
}
|
|
89
|
-
|
|
88
|
+
}
|
|
89
|
+
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
90
90
|
return exportSVG ? (react_1.default.createElement(react_1.default.Fragment, null, children)) : (react_1.default.createElement("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: { width, height: totalHeight } }, children));
|
|
91
|
-
}
|
|
92
|
-
function
|
|
91
|
+
}
|
|
92
|
+
const DivSequenceRendering = (0, mobx_react_1.observer)(function (props) {
|
|
93
93
|
const { regions, bpPerPx } = props;
|
|
94
94
|
const [region] = regions;
|
|
95
95
|
const width = (region.end - region.start) / bpPerPx;
|
|
96
96
|
const totalHeight = 200;
|
|
97
97
|
return (react_1.default.createElement(Wrapper, { ...props, totalHeight: totalHeight, width: width },
|
|
98
98
|
react_1.default.createElement(SequenceSVG, { ...props })));
|
|
99
|
-
}
|
|
100
|
-
exports.default =
|
|
99
|
+
});
|
|
100
|
+
exports.default = DivSequenceRendering;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { RegionsAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
export default class extends BaseAdapter implements RegionsAdapter {
|
|
3
|
-
protected setupP?: Promise<
|
|
4
|
-
[key: string]: number;
|
|
5
|
-
}>;
|
|
3
|
+
protected setupP?: Promise<Record<string, number>>;
|
|
6
4
|
setupPre(): Promise<{
|
|
7
5
|
[k: string]: number;
|
|
8
6
|
}>;
|
|
9
|
-
setup(): Promise<
|
|
10
|
-
[key: string]: number;
|
|
11
|
-
}>;
|
|
7
|
+
setup(): Promise<Record<string, number>>;
|
|
12
8
|
getRegions(): Promise<{
|
|
13
9
|
refName: string;
|
|
14
10
|
start: number;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
3
|
import { Feature, Region } from '@jbrowse/core/util';
|
|
4
|
-
|
|
4
|
+
import { Theme } from '@mui/material';
|
|
5
|
+
declare const DivSequenceRendering: (props: {
|
|
5
6
|
exportSVG?: {
|
|
6
7
|
rasterizeLayers: boolean;
|
|
7
8
|
};
|
|
@@ -9,10 +10,9 @@ declare function Sequence(props: {
|
|
|
9
10
|
regions: Region[];
|
|
10
11
|
bpPerPx: number;
|
|
11
12
|
config: AnyConfigurationModel;
|
|
12
|
-
theme?:
|
|
13
|
+
theme?: Theme;
|
|
13
14
|
showForward?: boolean;
|
|
14
15
|
showReverse?: boolean;
|
|
15
16
|
showTranslation?: boolean;
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export default _default;
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
export default DivSequenceRendering;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
4
3
|
import { observer } from 'mobx-react';
|
|
@@ -48,6 +47,7 @@ function DNA(props) {
|
|
|
48
47
|
const len = feature.get('end') - feature.get('start');
|
|
49
48
|
const w = Math.max((rightPx - leftPx) / len, 0.8);
|
|
50
49
|
return (React.createElement(React.Fragment, null, seq.split('').map((letter, index) => {
|
|
50
|
+
// @ts-expect-error
|
|
51
51
|
const color = theme.palette.bases[letter.toUpperCase()];
|
|
52
52
|
const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
|
|
53
53
|
return (React.createElement(React.Fragment, { key: index },
|
|
@@ -55,7 +55,7 @@ function DNA(props) {
|
|
|
55
55
|
render ? (React.createElement("text", { x: x + w / 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle", fill: color ? theme.palette.getContrastText(color.main) : 'black' }, letter)) : null));
|
|
56
56
|
})));
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
function SequenceSVG({ regions, theme: configTheme, features = new Map(), showReverse = true, showForward = true, showTranslation = true, bpPerPx, }) {
|
|
59
59
|
const [region] = regions;
|
|
60
60
|
const theme = createJBrowseTheme(configTheme);
|
|
61
61
|
const codonTable = generateCodonTable(defaultCodonTable);
|
|
@@ -80,16 +80,16 @@ const SequenceSVG = ({ regions, theme: configTheme, features = new Map(), showRe
|
|
|
80
80
|
showTranslation && (region.reversed ? showForward : showReverse)
|
|
81
81
|
? [0, -1, -2].map(index => (React.createElement(Translation, { key: `rev-translation-${index}`, seq: seq, y: (currY += 20), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, theme: theme, height: height, reverse: !region.reversed })))
|
|
82
82
|
: null));
|
|
83
|
-
}
|
|
84
|
-
|
|
83
|
+
}
|
|
84
|
+
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
85
85
|
return exportSVG ? (React.createElement(React.Fragment, null, children)) : (React.createElement("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: { width, height: totalHeight } }, children));
|
|
86
|
-
}
|
|
87
|
-
function
|
|
86
|
+
}
|
|
87
|
+
const DivSequenceRendering = observer(function (props) {
|
|
88
88
|
const { regions, bpPerPx } = props;
|
|
89
89
|
const [region] = regions;
|
|
90
90
|
const width = (region.end - region.start) / bpPerPx;
|
|
91
91
|
const totalHeight = 200;
|
|
92
92
|
return (React.createElement(Wrapper, { ...props, totalHeight: totalHeight, width: width },
|
|
93
93
|
React.createElement(SequenceSVG, { ...props })));
|
|
94
|
-
}
|
|
95
|
-
export default
|
|
94
|
+
});
|
|
95
|
+
export default DivSequenceRendering;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-sequence",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "JBrowse 2 sequence adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@jbrowse/plugin-wiggle": "^2.0.0",
|
|
47
47
|
"@mui/material": "^5.0.0",
|
|
48
48
|
"mobx": "^6.0.0",
|
|
49
|
-
"mobx-react": "^
|
|
49
|
+
"mobx-react": "^9.0.0",
|
|
50
50
|
"mobx-state-tree": "^5.0.0",
|
|
51
51
|
"react": ">=16.8.0",
|
|
52
52
|
"rxjs": "^7.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": "2cda1611eebd12517f2a3cfc1b612face27005d4"
|
|
61
61
|
}
|