@jbrowse/plugin-sequence 3.7.0 → 4.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/esm/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +1 -1
- package/esm/BgzipFastaAdapter/BgzipFastaAdapter.js +1 -1
- package/esm/BgzipFastaAdapter/configSchema.d.ts +2 -2
- package/esm/BgzipFastaAdapter/index.js +2 -2
- package/esm/ChromSizesAdapter/ChromSizesAdapter.js +1 -0
- package/esm/ChromSizesAdapter/configSchema.d.ts +2 -2
- package/esm/ChromSizesAdapter/index.js +2 -2
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +24 -7
- package/esm/DivSequenceRenderer/components/Sequence.js +20 -10
- package/esm/DivSequenceRenderer/components/Translation.js +27 -19
- package/esm/DivSequenceRenderer/configSchema.d.ts +2 -2
- package/esm/DivSequenceRenderer/index.js +6 -12
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +15 -23
- package/esm/IndexedFastaAdapter/configSchema.d.ts +2 -2
- package/esm/IndexedFastaAdapter/index.js +2 -2
- package/esm/LinearReferenceSequenceDisplay/configSchema.d.ts +4 -4
- package/esm/LinearReferenceSequenceDisplay/configSchema.js +1 -1
- package/esm/LinearReferenceSequenceDisplay/index.js +2 -2
- package/esm/LinearReferenceSequenceDisplay/model.d.ts +1047 -104
- package/esm/LinearReferenceSequenceDisplay/model.js +16 -4
- package/esm/ReferenceSequenceTrack/configSchema.d.ts +6 -6
- package/esm/ReferenceSequenceTrack/configSchema.js +3 -3
- package/esm/ReferenceSequenceTrack/index.js +13 -2
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +2 -2
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.js +3 -9
- package/esm/SequenceSearchAdapter/configSchema.d.ts +2 -2
- package/esm/SequenceSearchAdapter/index.js +2 -2
- package/esm/TwoBitAdapter/TwoBitAdapter.js +1 -0
- package/esm/TwoBitAdapter/configSchema.d.ts +2 -2
- package/esm/TwoBitAdapter/index.js +2 -2
- package/esm/UnindexedFastaAdapter/UnindexedFastaAdapter.js +1 -0
- package/esm/UnindexedFastaAdapter/configSchema.d.ts +2 -2
- package/esm/UnindexedFastaAdapter/index.js +2 -2
- package/esm/index.js +11 -14
- package/esm/saveTrackFormats/fasta.d.ts +4 -0
- package/esm/saveTrackFormats/fasta.js +13 -0
- package/package.json +28 -34
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +0 -7
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +0 -22
- package/dist/BgzipFastaAdapter/configSchema.d.ts +0 -32
- package/dist/BgzipFastaAdapter/configSchema.js +0 -54
- package/dist/BgzipFastaAdapter/index.d.ts +0 -2
- package/dist/BgzipFastaAdapter/index.js +0 -54
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +0 -15
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +0 -40
- package/dist/ChromSizesAdapter/configSchema.d.ts +0 -10
- package/dist/ChromSizesAdapter/configSchema.js +0 -27
- package/dist/ChromSizesAdapter/index.d.ts +0 -2
- package/dist/ChromSizesAdapter/index.js +0 -52
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +0 -18
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +0 -44
- package/dist/DivSequenceRenderer/components/Sequence.d.ts +0 -10
- package/dist/DivSequenceRenderer/components/Sequence.js +0 -25
- package/dist/DivSequenceRenderer/components/Translation.d.ts +0 -14
- package/dist/DivSequenceRenderer/components/Translation.js +0 -49
- package/dist/DivSequenceRenderer/configSchema.d.ts +0 -8
- package/dist/DivSequenceRenderer/configSchema.js +0 -12
- package/dist/DivSequenceRenderer/index.d.ts +0 -2
- package/dist/DivSequenceRenderer/index.js +0 -30
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +0 -25
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +0 -112
- package/dist/IndexedFastaAdapter/configSchema.d.ts +0 -25
- package/dist/IndexedFastaAdapter/configSchema.js +0 -40
- package/dist/IndexedFastaAdapter/index.d.ts +0 -2
- package/dist/IndexedFastaAdapter/index.js +0 -54
- package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +0 -9
- package/dist/LinearReferenceSequenceDisplay/configSchema.js +0 -12
- package/dist/LinearReferenceSequenceDisplay/index.d.ts +0 -2
- package/dist/LinearReferenceSequenceDisplay/index.js +0 -21
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +0 -338
- package/dist/LinearReferenceSequenceDisplay/model.js +0 -132
- package/dist/ReferenceSequenceTrack/configSchema.d.ts +0 -37
- package/dist/ReferenceSequenceTrack/configSchema.js +0 -83
- package/dist/ReferenceSequenceTrack/index.d.ts +0 -2
- package/dist/ReferenceSequenceTrack/index.js +0 -20
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +0 -8
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.js +0 -84
- package/dist/SequenceSearchAdapter/configSchema.d.ts +0 -24
- package/dist/SequenceSearchAdapter/configSchema.js +0 -28
- package/dist/SequenceSearchAdapter/index.d.ts +0 -2
- package/dist/SequenceSearchAdapter/index.js +0 -54
- package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +0 -28
- package/dist/TwoBitAdapter/TwoBitAdapter.js +0 -85
- package/dist/TwoBitAdapter/configSchema.d.ts +0 -18
- package/dist/TwoBitAdapter/configSchema.js +0 -43
- package/dist/TwoBitAdapter/index.d.ts +0 -2
- package/dist/TwoBitAdapter/index.js +0 -52
- package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.d.ts +0 -31
- package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.js +0 -86
- package/dist/UnindexedFastaAdapter/configSchema.d.ts +0 -23
- package/dist/UnindexedFastaAdapter/configSchema.js +0 -40
- package/dist/UnindexedFastaAdapter/index.d.ts +0 -2
- package/dist/UnindexedFastaAdapter/index.js +0 -54
- package/dist/createExtensionPoints.d.ts +0 -2
- package/dist/createExtensionPoints.js +0 -86
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -35
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
4
|
-
const io_1 = require("@jbrowse/core/util/io");
|
|
5
|
-
class ChromSizesAdapter extends BaseAdapter_1.BaseAdapter {
|
|
6
|
-
async setupPre() {
|
|
7
|
-
const pm = this.pluginManager;
|
|
8
|
-
const file = (0, io_1.openLocation)(this.getConf('chromSizesLocation'), pm);
|
|
9
|
-
const data = await file.readFile('utf8');
|
|
10
|
-
return Object.fromEntries(data
|
|
11
|
-
.split(/\n|\r\n|\r/)
|
|
12
|
-
.map(f => f.trim())
|
|
13
|
-
.filter(f => !!f)
|
|
14
|
-
.map(line => {
|
|
15
|
-
const [name, length] = line.split('\t');
|
|
16
|
-
return [name, +length];
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
async setup() {
|
|
20
|
-
if (!this.setupP) {
|
|
21
|
-
this.setupP = this.setupPre().catch((e) => {
|
|
22
|
-
this.setupP = undefined;
|
|
23
|
-
throw e;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return this.setupP;
|
|
27
|
-
}
|
|
28
|
-
async getRegions() {
|
|
29
|
-
const refSeqs = await this.setup();
|
|
30
|
-
return Object.keys(refSeqs).map(refName => ({
|
|
31
|
-
refName,
|
|
32
|
-
start: 0,
|
|
33
|
-
end: refSeqs[refName],
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
getHeader() {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.default = ChromSizesAdapter;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const ChromSizesAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
chromSizesLocation: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
10
|
-
export default ChromSizesAdapter;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
function x() { }
|
|
5
|
-
const ChromSizesAdapter = (0, configuration_1.ConfigurationSchema)('ChromSizesAdapter', {
|
|
6
|
-
chromSizesLocation: {
|
|
7
|
-
type: 'fileLocation',
|
|
8
|
-
defaultValue: {
|
|
9
|
-
uri: '/path/to/species.chrom.sizes',
|
|
10
|
-
locationType: 'UriLocation',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
}, {
|
|
14
|
-
explicitlyTyped: true,
|
|
15
|
-
preProcessSnapshot: snap => {
|
|
16
|
-
return snap.uri
|
|
17
|
-
? {
|
|
18
|
-
...snap,
|
|
19
|
-
chromSizesLocation: {
|
|
20
|
-
uri: snap.uri,
|
|
21
|
-
baseUri: snap.baseUri,
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
: snap;
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
exports.default = ChromSizesAdapter;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
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
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.default = ChromSizesAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function ChromSizesAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => new AdapterType_1.default({
|
|
44
|
-
name: 'ChromSizesAdapter',
|
|
45
|
-
displayName: 'Chrom sizes adapter',
|
|
46
|
-
configSchema: configSchema_1.default,
|
|
47
|
-
adapterMetadata: {
|
|
48
|
-
hiddenFromGUI: true,
|
|
49
|
-
},
|
|
50
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./ChromSizesAdapter'))).then(r => r.default),
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
-
import type { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
-
declare const DivSequenceRendering: ({ exportSVG, features, regions, colorByCDS, bpPerPx, rowHeight, sequenceHeight, showForward, showReverse, showTranslation, }: {
|
|
4
|
-
exportSVG?: {
|
|
5
|
-
rasterizeLayers: boolean;
|
|
6
|
-
};
|
|
7
|
-
features: Map<string, Feature>;
|
|
8
|
-
regions: Region[];
|
|
9
|
-
colorByCDS: boolean;
|
|
10
|
-
bpPerPx: number;
|
|
11
|
-
rowHeight: number;
|
|
12
|
-
sequenceHeight: number;
|
|
13
|
-
config: AnyConfigurationModel;
|
|
14
|
-
showForward?: boolean;
|
|
15
|
-
showReverse?: boolean;
|
|
16
|
-
showTranslation?: boolean;
|
|
17
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export default DivSequenceRendering;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const util_1 = require("@jbrowse/core/util");
|
|
8
|
-
const mobx_react_1 = require("mobx-react");
|
|
9
|
-
const Sequence_1 = __importDefault(require("./Sequence"));
|
|
10
|
-
const Translation_1 = __importDefault(require("./Translation"));
|
|
11
|
-
function SequenceSVG({ regions, width, colorByCDS, features = new Map(), showReverse = true, showForward = true, showTranslation = true, sequenceType = 'dna', bpPerPx, rowHeight, }) {
|
|
12
|
-
const region = regions[0];
|
|
13
|
-
const codonTable = (0, util_1.generateCodonTable)(util_1.defaultCodonTable);
|
|
14
|
-
const [feature] = [...features.values()];
|
|
15
|
-
if (!feature) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
const seq = feature.get('seq');
|
|
19
|
-
if (!seq) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
let currY = -rowHeight;
|
|
23
|
-
const showSequence = bpPerPx <= 1;
|
|
24
|
-
const forwardFrames = showTranslation && showForward ? [3, 2, 1] : [];
|
|
25
|
-
const reverseFrames = showTranslation && showReverse ? [-1, -2, -3] : [];
|
|
26
|
-
const [topFrames, bottomFrames] = region.reversed
|
|
27
|
-
? [reverseFrames.toReversed(), forwardFrames.toReversed()]
|
|
28
|
-
: [forwardFrames, reverseFrames];
|
|
29
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [topFrames.map(index => ((0, jsx_runtime_1.jsx)(Translation_1.default, { width: width, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), height: rowHeight, reverse: region.reversed }, `translation-${index}`))), showForward && showSequence ? ((0, jsx_runtime_1.jsx)(Sequence_1.default, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? (0, util_1.complement)(seq) : seq, bpPerPx: bpPerPx })) : null, showReverse && showSequence ? ((0, jsx_runtime_1.jsx)(Sequence_1.default, { height: rowHeight, sequenceType: sequenceType, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : (0, util_1.complement)(seq), bpPerPx: bpPerPx })) : null, bottomFrames.map(index => ((0, jsx_runtime_1.jsx)(Translation_1.default, { width: width, colorByCDS: colorByCDS, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, seqStart: feature.get('start'), height: rowHeight, reverse: !region.reversed }, `rev-translation-${index}`)))] }));
|
|
30
|
-
}
|
|
31
|
-
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
32
|
-
return exportSVG ? (children) : ((0, jsx_runtime_1.jsx)("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: {
|
|
33
|
-
display: 'block',
|
|
34
|
-
width,
|
|
35
|
-
height: totalHeight,
|
|
36
|
-
userSelect: 'none',
|
|
37
|
-
}, children: children }));
|
|
38
|
-
}
|
|
39
|
-
const DivSequenceRendering = (0, mobx_react_1.observer)(function ({ exportSVG, features, regions, colorByCDS, bpPerPx, rowHeight, sequenceHeight, showForward, showReverse, showTranslation, }) {
|
|
40
|
-
const region = regions[0];
|
|
41
|
-
const width = Math.ceil((region.end - region.start) / bpPerPx);
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(Wrapper, { exportSVG: exportSVG, totalHeight: sequenceHeight, width: width, children: (0, jsx_runtime_1.jsx)(SequenceSVG, { width: width, showReverse: showReverse, showForward: showForward, showTranslation: showTranslation, colorByCDS: colorByCDS, bpPerPx: bpPerPx, rowHeight: rowHeight, features: features, regions: regions }) }));
|
|
43
|
-
});
|
|
44
|
-
exports.default = DivSequenceRendering;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Feature, Region } from '@jbrowse/core/util';
|
|
2
|
-
export default function Sequence({ bpPerPx, region, feature, sequenceType, height, seq, y, }: {
|
|
3
|
-
seq: string;
|
|
4
|
-
bpPerPx: number;
|
|
5
|
-
sequenceType: string;
|
|
6
|
-
height: number;
|
|
7
|
-
region: Region;
|
|
8
|
-
feature: Feature;
|
|
9
|
-
y: number;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Sequence;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const util_1 = require("@jbrowse/core/util");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
function Sequence({ bpPerPx, region, feature, sequenceType, height, seq, y, }) {
|
|
9
|
-
const theme = (0, material_1.useTheme)();
|
|
10
|
-
const render = 1 / bpPerPx >= 12;
|
|
11
|
-
const s = feature.get('start');
|
|
12
|
-
const e = feature.get('end');
|
|
13
|
-
const [leftPx, rightPx] = (0, util_1.bpSpanPx)(s, e, region, bpPerPx);
|
|
14
|
-
const reverse = region.reversed;
|
|
15
|
-
const len = e - s;
|
|
16
|
-
const w = Math.max((rightPx - leftPx) / len, 0.8);
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: seq.split('').map((letter, index) => {
|
|
18
|
-
const color = sequenceType === 'dna'
|
|
19
|
-
?
|
|
20
|
-
theme.palette.bases[letter.toUpperCase()]
|
|
21
|
-
: undefined;
|
|
22
|
-
const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w;
|
|
23
|
-
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}`));
|
|
24
|
-
}) }));
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Frame, Region } from '@jbrowse/core/util';
|
|
2
|
-
export default function Translation({ codonTable, seq, frame, width, bpPerPx, colorByCDS, region, seqStart, height, y, reverse, }: {
|
|
3
|
-
codonTable: Record<string, string>;
|
|
4
|
-
width: number;
|
|
5
|
-
seq: string;
|
|
6
|
-
frame: Frame;
|
|
7
|
-
colorByCDS: boolean;
|
|
8
|
-
bpPerPx: number;
|
|
9
|
-
region: Region;
|
|
10
|
-
seqStart: number;
|
|
11
|
-
reverse?: boolean;
|
|
12
|
-
height: number;
|
|
13
|
-
y: number;
|
|
14
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Translation;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const util_1 = require("@jbrowse/core/util");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
function Translation({ codonTable, seq, frame, width, bpPerPx, colorByCDS, region, seqStart, height, y, reverse = false, }) {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
const theme = (0, material_1.useTheme)();
|
|
11
|
-
const normalizedFrame = Math.abs(frame) - 1;
|
|
12
|
-
const seqFrame = seqStart % 3;
|
|
13
|
-
const frameShift = (normalizedFrame - seqFrame + 3) % 3;
|
|
14
|
-
const frameShiftAdjustedSeqLength = seq.length - frameShift;
|
|
15
|
-
const multipleOfThreeLength = frameShiftAdjustedSeqLength - (frameShiftAdjustedSeqLength % 3);
|
|
16
|
-
const seqSliced = seq.slice(frameShift, frameShift + multipleOfThreeLength);
|
|
17
|
-
const translated = [];
|
|
18
|
-
for (let i = 0; i < seqSliced.length; i += 3) {
|
|
19
|
-
const codon = seqSliced.slice(i, i + 3);
|
|
20
|
-
const normalizedCodon = reverse ? (0, util_1.revcom)(codon) : codon;
|
|
21
|
-
const aminoAcid = codonTable[normalizedCodon] || '';
|
|
22
|
-
translated.push({
|
|
23
|
-
letter: aminoAcid,
|
|
24
|
-
codon: normalizedCodon.toUpperCase(),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const codonWidth = (1 / bpPerPx) * 3;
|
|
28
|
-
const renderLetter = 1 / bpPerPx >= 12;
|
|
29
|
-
const frameOffset = frameShift / bpPerPx;
|
|
30
|
-
const startOffset = (region.start - seqStart) / bpPerPx;
|
|
31
|
-
const offset = frameOffset - startOffset;
|
|
32
|
-
const defaultFill = colorByCDS
|
|
33
|
-
? (_a = theme.palette.framesCDS.at(frame)) === null || _a === void 0 ? void 0 : _a.main
|
|
34
|
-
: (_b = theme.palette.frames.at(frame)) === null || _b === void 0 ? void 0 : _b.main;
|
|
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.palette.startCodon
|
|
42
|
-
: util_1.defaultStops.includes(codon)
|
|
43
|
-
? 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
|
-
})] }));
|
|
49
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const DivSequenceRenderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
height: {
|
|
3
|
-
type: string;
|
|
4
|
-
description: string;
|
|
5
|
-
defaultValue: number;
|
|
6
|
-
};
|
|
7
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
8
|
-
export default DivSequenceRenderer;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
function x() { }
|
|
5
|
-
const DivSequenceRenderer = (0, configuration_1.ConfigurationSchema)('DivSequenceRenderer', {
|
|
6
|
-
height: {
|
|
7
|
-
type: 'number',
|
|
8
|
-
description: 'height in pixels of each line of sequence',
|
|
9
|
-
defaultValue: 16,
|
|
10
|
-
},
|
|
11
|
-
}, { explicitlyTyped: true });
|
|
12
|
-
exports.default = DivSequenceRenderer;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = DivSequenceRendererF;
|
|
7
|
-
const FeatureRendererType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType"));
|
|
8
|
-
const DivSequenceRendering_1 = __importDefault(require("./components/DivSequenceRendering"));
|
|
9
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
10
|
-
class DivSequenceRenderer extends FeatureRendererType_1.default {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this.supportsSVG = true;
|
|
14
|
-
}
|
|
15
|
-
getExpandedRegion(region) {
|
|
16
|
-
return {
|
|
17
|
-
...region,
|
|
18
|
-
start: Math.max(region.start - 3, 0),
|
|
19
|
-
end: region.end + 3,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function DivSequenceRendererF(pluginManager) {
|
|
24
|
-
pluginManager.addRendererType(() => new DivSequenceRenderer({
|
|
25
|
-
name: 'DivSequenceRenderer',
|
|
26
|
-
ReactComponent: DivSequenceRendering_1.default,
|
|
27
|
-
configSchema: configSchema_1.default,
|
|
28
|
-
pluginManager,
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IndexedFasta } from '@gmod/indexedfasta';
|
|
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';
|
|
6
|
-
export default class IndexedFastaAdapter extends BaseSequenceAdapter {
|
|
7
|
-
protected setupP?: Promise<{
|
|
8
|
-
fasta: IndexedFasta;
|
|
9
|
-
}>;
|
|
10
|
-
private seqCache;
|
|
11
|
-
getRefNames(_opts?: BaseOptions): Promise<string[]>;
|
|
12
|
-
getRegions(_opts?: BaseOptions): Promise<{
|
|
13
|
-
refName: string;
|
|
14
|
-
start: number;
|
|
15
|
-
end: number;
|
|
16
|
-
}[]>;
|
|
17
|
-
setupPre(): Promise<{
|
|
18
|
-
fasta: IndexedFasta;
|
|
19
|
-
}>;
|
|
20
|
-
getHeader(): Promise<string | null>;
|
|
21
|
-
setup(): Promise<{
|
|
22
|
-
fasta: IndexedFasta;
|
|
23
|
-
}>;
|
|
24
|
-
getFeatures(region: NoAssemblyRegion, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
25
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const abortable_promise_cache_1 = __importDefault(require("@gmod/abortable-promise-cache"));
|
|
7
|
-
const indexedfasta_1 = require("@gmod/indexedfasta");
|
|
8
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
-
const util_1 = require("@jbrowse/core/util");
|
|
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");
|
|
14
|
-
class IndexedFastaAdapter extends BaseAdapter_1.BaseSequenceAdapter {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.seqCache = new abortable_promise_cache_1.default({
|
|
18
|
-
cache: new QuickLRU_1.default({ maxSize: 200 }),
|
|
19
|
-
fill: async (args) => {
|
|
20
|
-
const { refName, start, end, fasta } = args;
|
|
21
|
-
return fasta.getSequence(refName, start, end);
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
async getRefNames(_opts) {
|
|
26
|
-
const { fasta } = await this.setup();
|
|
27
|
-
return fasta.getSequenceNames();
|
|
28
|
-
}
|
|
29
|
-
async getRegions(_opts) {
|
|
30
|
-
const { fasta } = await this.setup();
|
|
31
|
-
const seqSizes = await fasta.getSequenceSizes();
|
|
32
|
-
return Object.keys(seqSizes).map(refName => ({
|
|
33
|
-
refName,
|
|
34
|
-
start: 0,
|
|
35
|
-
end: seqSizes[refName],
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
async setupPre() {
|
|
39
|
-
const fastaLocation = this.getConf('fastaLocation');
|
|
40
|
-
const faiLocation = this.getConf('faiLocation');
|
|
41
|
-
return {
|
|
42
|
-
fasta: new indexedfasta_1.IndexedFasta({
|
|
43
|
-
fasta: (0, io_1.openLocation)(fastaLocation, this.pluginManager),
|
|
44
|
-
fai: (0, io_1.openLocation)(faiLocation, this.pluginManager),
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
async getHeader() {
|
|
49
|
-
const loc = this.getConf('metadataLocation');
|
|
50
|
-
return loc.uri === '' || loc.uri === '/path/to/fa.metadata.yaml'
|
|
51
|
-
? null
|
|
52
|
-
: (0, io_1.openLocation)(loc, this.pluginManager).readFile('utf8');
|
|
53
|
-
}
|
|
54
|
-
async setup() {
|
|
55
|
-
if (!this.setupP) {
|
|
56
|
-
this.setupP = this.setupPre().catch((e) => {
|
|
57
|
-
this.setupP = undefined;
|
|
58
|
-
throw e;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return this.setupP;
|
|
62
|
-
}
|
|
63
|
-
getFeatures(region, opts) {
|
|
64
|
-
const { statusCallback = () => { }, stopToken } = opts || {};
|
|
65
|
-
const { refName, start, end } = region;
|
|
66
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
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
|
-
const res = await this.seqCache.get(JSON.stringify(r), {
|
|
83
|
-
...r,
|
|
84
|
-
fasta,
|
|
85
|
-
});
|
|
86
|
-
if (!res) {
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
chunks.push(res);
|
|
90
|
-
}
|
|
91
|
-
const seq = chunks
|
|
92
|
-
.filter(f => !!f)
|
|
93
|
-
.join('')
|
|
94
|
-
.slice(start - s)
|
|
95
|
-
.slice(0, end - start);
|
|
96
|
-
if (seq) {
|
|
97
|
-
observer.next(new util_1.SimpleFeature({
|
|
98
|
-
id: `${refName}-${start}-${regionEnd}`,
|
|
99
|
-
data: {
|
|
100
|
-
refName,
|
|
101
|
-
start,
|
|
102
|
-
end: regionEnd,
|
|
103
|
-
seq,
|
|
104
|
-
},
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
observer.complete();
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.default = IndexedFastaAdapter;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
declare const IndexedFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
fastaLocation: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
faiLocation: {
|
|
10
|
-
type: string;
|
|
11
|
-
defaultValue: {
|
|
12
|
-
uri: string;
|
|
13
|
-
locationType: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
metadataLocation: {
|
|
17
|
-
description: string;
|
|
18
|
-
type: string;
|
|
19
|
-
defaultValue: {
|
|
20
|
-
uri: string;
|
|
21
|
-
locationType: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
25
|
-
export default IndexedFastaAdapter;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
function x() { }
|
|
5
|
-
const IndexedFastaAdapter = (0, configuration_1.ConfigurationSchema)('IndexedFastaAdapter', {
|
|
6
|
-
fastaLocation: {
|
|
7
|
-
type: 'fileLocation',
|
|
8
|
-
defaultValue: { uri: '/path/to/seq.fa', locationType: 'UriLocation' },
|
|
9
|
-
},
|
|
10
|
-
faiLocation: {
|
|
11
|
-
type: 'fileLocation',
|
|
12
|
-
defaultValue: { uri: '/path/to/seq.fa.fai', locationType: 'UriLocation' },
|
|
13
|
-
},
|
|
14
|
-
metadataLocation: {
|
|
15
|
-
description: 'Optional metadata file',
|
|
16
|
-
type: 'fileLocation',
|
|
17
|
-
defaultValue: {
|
|
18
|
-
uri: '/path/to/fa.metadata.yaml',
|
|
19
|
-
locationType: 'UriLocation',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}, {
|
|
23
|
-
explicitlyTyped: true,
|
|
24
|
-
preProcessSnapshot: snap => {
|
|
25
|
-
return snap.uri
|
|
26
|
-
? {
|
|
27
|
-
...snap,
|
|
28
|
-
fastaLocation: {
|
|
29
|
-
uri: snap.uri,
|
|
30
|
-
baseUri: snap.baseUri,
|
|
31
|
-
},
|
|
32
|
-
faiLocation: {
|
|
33
|
-
uri: `${snap.uri}.fai`,
|
|
34
|
-
baseUri: snap.baseUri,
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
: snap;
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
exports.default = IndexedFastaAdapter;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
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
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.default = IndexedFastaAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function IndexedFastaAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => {
|
|
44
|
-
return new AdapterType_1.default({
|
|
45
|
-
name: 'IndexedFastaAdapter',
|
|
46
|
-
displayName: 'Indexed FASTA adapter',
|
|
47
|
-
configSchema: configSchema_1.default,
|
|
48
|
-
adapterMetadata: {
|
|
49
|
-
hiddenFromGUI: true,
|
|
50
|
-
},
|
|
51
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./IndexedFastaAdapter'))).then(r => r.default),
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
renderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
|
-
height: {
|
|
4
|
-
type: string;
|
|
5
|
-
description: string;
|
|
6
|
-
defaultValue: number;
|
|
7
|
-
};
|
|
8
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
9
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.configSchema = void 0;
|
|
7
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
8
|
-
const configSchema_1 = __importDefault(require("../DivSequenceRenderer/configSchema"));
|
|
9
|
-
function x() { }
|
|
10
|
-
exports.configSchema = (0, configuration_1.ConfigurationSchema)('LinearReferenceSequenceDisplay', {
|
|
11
|
-
renderer: configSchema_1.default,
|
|
12
|
-
}, { explicitIdentifier: 'displayId', explicitlyTyped: true });
|