@jbrowse/plugin-sequence 2.17.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/configSchema.d.ts +0 -12
- package/dist/BgzipFastaAdapter/configSchema.js +1 -16
- package/dist/BgzipFastaAdapter/index.d.ts +1 -1
- package/dist/BgzipFastaAdapter/index.js +28 -16
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +2 -1
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +1 -1
- package/dist/ChromSizesAdapter/configSchema.d.ts +0 -3
- package/dist/ChromSizesAdapter/configSchema.js +1 -7
- package/dist/ChromSizesAdapter/index.d.ts +1 -1
- package/dist/ChromSizesAdapter/index.js +17 -7
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +4 -5
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +29 -48
- package/dist/DivSequenceRenderer/configSchema.d.ts +0 -3
- package/dist/DivSequenceRenderer/configSchema.js +1 -7
- package/dist/DivSequenceRenderer/index.d.ts +1 -1
- package/dist/DivSequenceRenderer/index.js +0 -1
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +6 -10
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +46 -40
- package/dist/IndexedFastaAdapter/configSchema.d.ts +0 -9
- package/dist/IndexedFastaAdapter/configSchema.js +1 -13
- package/dist/IndexedFastaAdapter/index.d.ts +1 -1
- package/dist/IndexedFastaAdapter/index.js +28 -16
- package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +0 -3
- package/dist/LinearReferenceSequenceDisplay/configSchema.js +1 -7
- package/dist/LinearReferenceSequenceDisplay/index.d.ts +1 -1
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +17 -98
- package/dist/LinearReferenceSequenceDisplay/model.js +4 -65
- package/dist/ReferenceSequenceTrack/configSchema.d.ts +1 -27
- package/dist/ReferenceSequenceTrack/configSchema.js +2 -42
- package/dist/ReferenceSequenceTrack/index.d.ts +1 -1
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +3 -2
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.js +2 -2
- package/dist/SequenceSearchAdapter/configSchema.d.ts +0 -15
- package/dist/SequenceSearchAdapter/configSchema.js +1 -19
- package/dist/SequenceSearchAdapter/index.d.ts +1 -1
- package/dist/SequenceSearchAdapter/index.js +28 -16
- package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +22 -19
- package/dist/TwoBitAdapter/TwoBitAdapter.js +35 -37
- package/dist/TwoBitAdapter/configSchema.d.ts +0 -6
- package/dist/TwoBitAdapter/configSchema.js +1 -10
- package/dist/TwoBitAdapter/index.d.ts +1 -1
- package/dist/TwoBitAdapter/index.js +17 -7
- package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.d.ts +4 -3
- package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.js +3 -3
- package/dist/UnindexedFastaAdapter/configSchema.d.ts +0 -6
- package/dist/UnindexedFastaAdapter/configSchema.js +1 -10
- package/dist/UnindexedFastaAdapter/index.d.ts +1 -1
- package/dist/UnindexedFastaAdapter/index.js +28 -16
- package/dist/createExtensionPoints.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/esm/BgzipFastaAdapter/configSchema.d.ts +0 -12
- package/esm/BgzipFastaAdapter/configSchema.js +1 -16
- package/esm/BgzipFastaAdapter/index.d.ts +1 -1
- package/esm/BgzipFastaAdapter/index.js +11 -9
- package/esm/ChromSizesAdapter/ChromSizesAdapter.d.ts +2 -1
- package/esm/ChromSizesAdapter/ChromSizesAdapter.js +2 -2
- package/esm/ChromSizesAdapter/configSchema.d.ts +0 -3
- package/esm/ChromSizesAdapter/configSchema.js +1 -7
- package/esm/ChromSizesAdapter/index.d.ts +1 -1
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.d.ts +4 -5
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +29 -45
- package/esm/DivSequenceRenderer/configSchema.d.ts +0 -3
- package/esm/DivSequenceRenderer/configSchema.js +1 -7
- package/esm/DivSequenceRenderer/index.d.ts +1 -1
- package/esm/DivSequenceRenderer/index.js +0 -1
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +6 -10
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +47 -41
- package/esm/IndexedFastaAdapter/configSchema.d.ts +0 -9
- package/esm/IndexedFastaAdapter/configSchema.js +1 -13
- package/esm/IndexedFastaAdapter/index.d.ts +1 -1
- package/esm/IndexedFastaAdapter/index.js +11 -9
- package/esm/LinearReferenceSequenceDisplay/configSchema.d.ts +0 -3
- package/esm/LinearReferenceSequenceDisplay/configSchema.js +1 -7
- package/esm/LinearReferenceSequenceDisplay/index.d.ts +1 -1
- package/esm/LinearReferenceSequenceDisplay/model.d.ts +17 -98
- package/esm/LinearReferenceSequenceDisplay/model.js +5 -66
- package/esm/ReferenceSequenceTrack/configSchema.d.ts +1 -27
- package/esm/ReferenceSequenceTrack/configSchema.js +2 -42
- package/esm/ReferenceSequenceTrack/index.d.ts +1 -1
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +3 -2
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.js +3 -3
- package/esm/SequenceSearchAdapter/configSchema.d.ts +0 -15
- package/esm/SequenceSearchAdapter/configSchema.js +1 -19
- package/esm/SequenceSearchAdapter/index.d.ts +1 -1
- package/esm/SequenceSearchAdapter/index.js +11 -9
- package/esm/TwoBitAdapter/TwoBitAdapter.d.ts +22 -19
- package/esm/TwoBitAdapter/TwoBitAdapter.js +35 -37
- package/esm/TwoBitAdapter/configSchema.d.ts +0 -6
- package/esm/TwoBitAdapter/configSchema.js +1 -10
- package/esm/TwoBitAdapter/index.d.ts +1 -1
- package/esm/UnindexedFastaAdapter/UnindexedFastaAdapter.d.ts +4 -3
- package/esm/UnindexedFastaAdapter/UnindexedFastaAdapter.js +4 -4
- package/esm/UnindexedFastaAdapter/configSchema.d.ts +0 -6
- package/esm/UnindexedFastaAdapter/configSchema.js +1 -10
- package/esm/UnindexedFastaAdapter/index.d.ts +1 -1
- package/esm/UnindexedFastaAdapter/index.js +11 -9
- package/esm/createExtensionPoints.d.ts +1 -1
- package/esm/createExtensionPoints.js +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +5 -5
- package/package.json +4 -4
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
fastaLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -9,9 +6,6 @@ declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurati
|
|
|
9
6
|
locationType: string;
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
9
|
faiLocation: {
|
|
16
10
|
type: string;
|
|
17
11
|
defaultValue: {
|
|
@@ -19,9 +13,6 @@ declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurati
|
|
|
19
13
|
locationType: string;
|
|
20
14
|
};
|
|
21
15
|
};
|
|
22
|
-
/**
|
|
23
|
-
* #slot
|
|
24
|
-
*/
|
|
25
16
|
metadataLocation: {
|
|
26
17
|
description: string;
|
|
27
18
|
type: string;
|
|
@@ -30,9 +21,6 @@ declare const BgzipFastaAdapter: import("@jbrowse/core/configuration/configurati
|
|
|
30
21
|
locationType: string;
|
|
31
22
|
};
|
|
32
23
|
};
|
|
33
|
-
/**
|
|
34
|
-
* #slot
|
|
35
|
-
*/
|
|
36
24
|
gziLocation: {
|
|
37
25
|
type: string;
|
|
38
26
|
defaultValue: {
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
|
|
5
|
-
* #config BgzipFastaAdapter
|
|
6
|
-
*/
|
|
7
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
function x() { }
|
|
8
5
|
const BgzipFastaAdapter = (0, configuration_1.ConfigurationSchema)('BgzipFastaAdapter', {
|
|
9
|
-
/**
|
|
10
|
-
* #slot
|
|
11
|
-
*/
|
|
12
6
|
fastaLocation: {
|
|
13
7
|
type: 'fileLocation',
|
|
14
8
|
defaultValue: { uri: '/path/to/seq.fa.gz', locationType: 'UriLocation' },
|
|
15
9
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
10
|
faiLocation: {
|
|
20
11
|
type: 'fileLocation',
|
|
21
12
|
defaultValue: {
|
|
@@ -23,9 +14,6 @@ const BgzipFastaAdapter = (0, configuration_1.ConfigurationSchema)('BgzipFastaAd
|
|
|
23
14
|
locationType: 'UriLocation',
|
|
24
15
|
},
|
|
25
16
|
},
|
|
26
|
-
/**
|
|
27
|
-
* #slot
|
|
28
|
-
*/
|
|
29
17
|
metadataLocation: {
|
|
30
18
|
description: 'Optional metadata file',
|
|
31
19
|
type: 'fileLocation',
|
|
@@ -34,9 +22,6 @@ const BgzipFastaAdapter = (0, configuration_1.ConfigurationSchema)('BgzipFastaAd
|
|
|
34
22
|
locationType: 'UriLocation',
|
|
35
23
|
},
|
|
36
24
|
},
|
|
37
|
-
/**
|
|
38
|
-
* #slot
|
|
39
|
-
*/
|
|
40
25
|
gziLocation: {
|
|
41
26
|
type: 'fileLocation',
|
|
42
27
|
defaultValue: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BgzipFastaAdapterF(pluginManager: PluginManager): 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
|
};
|
|
@@ -30,13 +40,15 @@ exports.default = BgzipFastaAdapterF;
|
|
|
30
40
|
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
31
41
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
32
42
|
function BgzipFastaAdapterF(pluginManager) {
|
|
33
|
-
pluginManager.addAdapterType(() =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
pluginManager.addAdapterType(() => {
|
|
44
|
+
return new AdapterType_1.default({
|
|
45
|
+
name: 'BgzipFastaAdapter',
|
|
46
|
+
displayName: 'Bgzip-indexed FASTA adapter',
|
|
47
|
+
configSchema: configSchema_1.default,
|
|
48
|
+
adapterMetadata: {
|
|
49
|
+
hiddenFromGUI: true,
|
|
50
|
+
},
|
|
51
|
+
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BgzipFastaAdapter'))).then(r => r.default),
|
|
52
|
+
});
|
|
53
|
+
});
|
|
42
54
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import type { RegionsAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
3
|
export default class ChromSizesAdapter extends BaseAdapter implements RegionsAdapter {
|
|
3
4
|
protected setupP?: Promise<Record<string, number>>;
|
|
4
5
|
setupPre(): Promise<{
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
|
|
5
|
-
* #config ChromSizesAdapter
|
|
6
|
-
*/
|
|
7
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
function x() { }
|
|
8
5
|
const ChromSizesAdapter = (0, configuration_1.ConfigurationSchema)('ChromSizesAdapter', {
|
|
9
|
-
/**
|
|
10
|
-
* #slot
|
|
11
|
-
*/
|
|
12
6
|
chromSizesLocation: {
|
|
13
7
|
type: 'fileLocation',
|
|
14
8
|
defaultValue: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function ChromSizesAdapterF(pluginManager: PluginManager): 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
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Theme } from '@mui/material';
|
|
1
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
+
import type { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
+
import type { Theme } from '@mui/material';
|
|
5
4
|
declare const DivSequenceRendering: (props: {
|
|
6
5
|
exportSVG?: {
|
|
7
6
|
rasterizeLayers: boolean;
|
|
@@ -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,12 +1,10 @@
|
|
|
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
|
-
const mobx_react_1 = require("mobx-react");
|
|
9
6
|
const util_1 = require("@jbrowse/core/util");
|
|
7
|
+
const mobx_react_1 = require("mobx-react");
|
|
10
8
|
function Translation({ codonTable, seq, frame, bpPerPx, colorByCDS, region, seqStart, height, y, reverse = false, theme, }) {
|
|
11
9
|
var _a, _b;
|
|
12
10
|
const normalizedFrame = Math.abs(frame) - 1;
|
|
@@ -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 /* small fudge factor when zoomed out*/, 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,18 +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
|
-
react_1.default.createElement(react_1.default.Fragment, { key: `${letter}-${index}` },
|
|
73
|
-
react_1.default.createElement("rect", { x: x, y: y, width: w, height: height, fill: color ? color.main : '#aaa', stroke: render ? '#555' : 'none' }),
|
|
74
|
-
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));
|
|
75
|
-
})));
|
|
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
|
+
}) }));
|
|
76
66
|
}
|
|
77
67
|
function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new Map(), showReverse = true, showForward = true, showTranslation = true, sequenceType = 'dna', bpPerPx, rowHeight, }) {
|
|
78
68
|
const region = regions[0];
|
|
@@ -86,36 +76,27 @@ function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new M
|
|
|
86
76
|
if (!seq) {
|
|
87
77
|
return null;
|
|
88
78
|
}
|
|
89
|
-
// incrementer for the y-position of the current sequence being rendered
|
|
90
|
-
// (applies to both translation rows and dna rows)
|
|
91
79
|
let currY = -rowHeight;
|
|
92
80
|
const showSequence = bpPerPx <= 1;
|
|
93
81
|
const forwardFrames = showTranslation && showForward ? [3, 2, 1] : [];
|
|
94
82
|
const reverseFrames = showTranslation && showReverse ? [-1, -2, -3] : [];
|
|
95
|
-
// if region.reversed, the forward translation is on bottom, reverse on top
|
|
96
83
|
const [topFrames, bottomFrames] = region.reversed
|
|
97
84
|
? [reverseFrames.toReversed(), forwardFrames.toReversed()]
|
|
98
85
|
: [forwardFrames, reverseFrames];
|
|
99
|
-
return (
|
|
100
|
-
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 }))),
|
|
101
|
-
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,
|
|
102
|
-
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,
|
|
103
|
-
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}`)))] }));
|
|
104
87
|
}
|
|
105
88
|
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
106
|
-
return exportSVG ? (children) : (
|
|
107
|
-
// use block because svg by default is inline, which adds a margin
|
|
89
|
+
return exportSVG ? (children) : ((0, jsx_runtime_1.jsx)("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: {
|
|
108
90
|
display: 'block',
|
|
109
91
|
width,
|
|
110
92
|
height: totalHeight,
|
|
111
93
|
userSelect: 'none',
|
|
112
|
-
}
|
|
94
|
+
}, children: children }));
|
|
113
95
|
}
|
|
114
96
|
const DivSequenceRendering = (0, mobx_react_1.observer)(function (props) {
|
|
115
97
|
const { regions, bpPerPx, sequenceHeight } = props;
|
|
116
98
|
const region = regions[0];
|
|
117
99
|
const width = (region.end - region.start) / bpPerPx;
|
|
118
|
-
return (
|
|
119
|
-
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 }) }));
|
|
120
101
|
});
|
|
121
102
|
exports.default = DivSequenceRendering;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
|
|
5
|
-
* #config DivSequenceRenderer
|
|
6
|
-
*/
|
|
7
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
function x() { }
|
|
8
5
|
const DivSequenceRenderer = (0, configuration_1.ConfigurationSchema)('DivSequenceRenderer', {
|
|
9
|
-
/**
|
|
10
|
-
* #slot
|
|
11
|
-
*/
|
|
12
6
|
height: {
|
|
13
7
|
type: 'number',
|
|
14
8
|
description: 'height in pixels of each line of sequence',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function DivSequenceRendererF(pluginManager: PluginManager): void;
|
|
@@ -7,7 +7,6 @@ exports.default = DivSequenceRendererF;
|
|
|
7
7
|
const FeatureRendererType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType"));
|
|
8
8
|
const DivSequenceRendering_1 = __importDefault(require("./components/DivSequenceRendering"));
|
|
9
9
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
10
|
-
/* adjust in both directions */
|
|
11
10
|
class DivSequenceRenderer extends FeatureRendererType_1.default {
|
|
12
11
|
constructor() {
|
|
13
12
|
super(...arguments);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { IndexedFasta } from '@gmod/indexedfasta';
|
|
2
|
-
import { BaseSequenceAdapter
|
|
3
|
-
import {
|
|
4
|
-
import { Feature } from '@jbrowse/core/util';
|
|
2
|
+
import { BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
5
|
+
import type { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
5
6
|
export default class IndexedFastaAdapter extends BaseSequenceAdapter {
|
|
6
7
|
protected setupP?: Promise<{
|
|
7
8
|
fasta: IndexedFasta;
|
|
8
9
|
}>;
|
|
9
10
|
private seqCache;
|
|
10
|
-
getRefNames(
|
|
11
|
-
getRegions(
|
|
11
|
+
getRefNames(_opts?: BaseOptions): Promise<string[]>;
|
|
12
|
+
getRegions(_opts?: BaseOptions): Promise<{
|
|
12
13
|
refName: string;
|
|
13
14
|
start: number;
|
|
14
15
|
end: number;
|
|
@@ -21,10 +22,5 @@ export default class IndexedFastaAdapter extends BaseSequenceAdapter {
|
|
|
21
22
|
fasta: IndexedFasta;
|
|
22
23
|
}>;
|
|
23
24
|
getFeatures(region: NoAssemblyRegion, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
24
|
-
/**
|
|
25
|
-
* called to provide a hint that data tied to a certain region
|
|
26
|
-
* will not be needed for the foreseeable future and can be purged
|
|
27
|
-
* from caches, etc
|
|
28
|
-
*/
|
|
29
25
|
freeResources(): void;
|
|
30
26
|
}
|
|
@@ -3,31 +3,32 @@ 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
|
+
const abortable_promise_cache_1 = __importDefault(require("@gmod/abortable-promise-cache"));
|
|
6
7
|
const indexedfasta_1 = require("@gmod/indexedfasta");
|
|
7
8
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
8
|
-
const io_1 = require("@jbrowse/core/util/io");
|
|
9
|
-
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
10
9
|
const util_1 = require("@jbrowse/core/util");
|
|
11
|
-
const abortable_promise_cache_1 = __importDefault(require("@gmod/abortable-promise-cache"));
|
|
12
10
|
const QuickLRU_1 = __importDefault(require("@jbrowse/core/util/QuickLRU"));
|
|
11
|
+
const io_1 = require("@jbrowse/core/util/io");
|
|
12
|
+
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
13
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
13
14
|
class IndexedFastaAdapter extends BaseAdapter_1.BaseSequenceAdapter {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
16
17
|
this.seqCache = new abortable_promise_cache_1.default({
|
|
17
18
|
cache: new QuickLRU_1.default({ maxSize: 200 }),
|
|
18
|
-
fill: async (args
|
|
19
|
+
fill: async (args) => {
|
|
19
20
|
const { refName, start, end, fasta } = args;
|
|
20
|
-
return fasta.getSequence(refName, start, end
|
|
21
|
+
return fasta.getSequence(refName, start, end);
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
async getRefNames(
|
|
25
|
+
async getRefNames(_opts) {
|
|
25
26
|
const { fasta } = await this.setup();
|
|
26
|
-
return fasta.getSequenceNames(
|
|
27
|
+
return fasta.getSequenceNames();
|
|
27
28
|
}
|
|
28
|
-
async getRegions(
|
|
29
|
+
async getRegions(_opts) {
|
|
29
30
|
const { fasta } = await this.setup();
|
|
30
|
-
const seqSizes = await fasta.getSequenceSizes(
|
|
31
|
+
const seqSizes = await fasta.getSequenceSizes();
|
|
31
32
|
return Object.keys(seqSizes).map(refName => ({
|
|
32
33
|
refName,
|
|
33
34
|
start: 0,
|
|
@@ -60,41 +61,46 @@ class IndexedFastaAdapter extends BaseAdapter_1.BaseSequenceAdapter {
|
|
|
60
61
|
return this.setupP;
|
|
61
62
|
}
|
|
62
63
|
getFeatures(region, opts) {
|
|
64
|
+
const { statusCallback = () => { }, stopToken } = opts || {};
|
|
63
65
|
const { refName, start, end } = region;
|
|
64
66
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
67
|
+
await (0, util_1.updateStatus2)('Downloading sequence', statusCallback, stopToken, async () => {
|
|
68
|
+
const { fasta } = await this.setup();
|
|
69
|
+
const size = await fasta.getSequenceSize(refName);
|
|
70
|
+
const regionEnd = Math.min(size || 0, end);
|
|
71
|
+
const chunks = [];
|
|
72
|
+
const chunkSize = 128000;
|
|
73
|
+
const s = start - (start % chunkSize);
|
|
74
|
+
const e = end + (chunkSize - (end % chunkSize));
|
|
75
|
+
for (let chunkStart = s; chunkStart < e; chunkStart += chunkSize) {
|
|
76
|
+
const r = {
|
|
77
|
+
refName,
|
|
78
|
+
start: chunkStart,
|
|
79
|
+
end: chunkStart + chunkSize,
|
|
80
|
+
};
|
|
81
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
82
|
+
chunks.push(await this.seqCache.get(JSON.stringify(r), { ...r, fasta }));
|
|
83
|
+
}
|
|
84
|
+
const seq = chunks
|
|
85
|
+
.filter(f => !!f)
|
|
86
|
+
.join('')
|
|
87
|
+
.slice(start - s)
|
|
88
|
+
.slice(0, end - start);
|
|
89
|
+
if (seq) {
|
|
90
|
+
observer.next(new util_1.SimpleFeature({
|
|
91
|
+
id: `${refName}-${start}-${regionEnd}`,
|
|
92
|
+
data: {
|
|
93
|
+
refName,
|
|
94
|
+
start,
|
|
95
|
+
end: regionEnd,
|
|
96
|
+
seq,
|
|
97
|
+
},
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
90
101
|
observer.complete();
|
|
91
102
|
});
|
|
92
103
|
}
|
|
93
|
-
|
|
94
|
-
* called to provide a hint that data tied to a certain region
|
|
95
|
-
* will not be needed for the foreseeable future and can be purged
|
|
96
|
-
* from caches, etc
|
|
97
|
-
*/
|
|
98
|
-
freeResources( /* { region } */) { }
|
|
104
|
+
freeResources() { }
|
|
99
105
|
}
|
|
100
106
|
exports.default = IndexedFastaAdapter;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const IndexedFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
fastaLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -9,9 +6,6 @@ declare const IndexedFastaAdapter: import("@jbrowse/core/configuration/configura
|
|
|
9
6
|
locationType: string;
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
9
|
faiLocation: {
|
|
16
10
|
type: string;
|
|
17
11
|
defaultValue: {
|
|
@@ -19,9 +13,6 @@ declare const IndexedFastaAdapter: import("@jbrowse/core/configuration/configura
|
|
|
19
13
|
locationType: string;
|
|
20
14
|
};
|
|
21
15
|
};
|
|
22
|
-
/**
|
|
23
|
-
* #slot
|
|
24
|
-
*/
|
|
25
16
|
metadataLocation: {
|
|
26
17
|
description: string;
|
|
27
18
|
type: string;
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
|
|
5
|
-
* #config IndexedFastaAdapter
|
|
6
|
-
*/
|
|
7
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
function x() { }
|
|
8
5
|
const IndexedFastaAdapter = (0, configuration_1.ConfigurationSchema)('IndexedFastaAdapter', {
|
|
9
|
-
/**
|
|
10
|
-
* #slot
|
|
11
|
-
*/
|
|
12
6
|
fastaLocation: {
|
|
13
7
|
type: 'fileLocation',
|
|
14
8
|
defaultValue: { uri: '/path/to/seq.fa', locationType: 'UriLocation' },
|
|
15
9
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
10
|
faiLocation: {
|
|
20
11
|
type: 'fileLocation',
|
|
21
12
|
defaultValue: { uri: '/path/to/seq.fa.fai', locationType: 'UriLocation' },
|
|
22
13
|
},
|
|
23
|
-
/**
|
|
24
|
-
* #slot
|
|
25
|
-
*/
|
|
26
14
|
metadataLocation: {
|
|
27
15
|
description: 'Optional metadata file',
|
|
28
16
|
type: 'fileLocation',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function IndexedFastaAdapterF(pluginManager: PluginManager): void;
|