@jbrowse/plugin-sequence 2.10.3 → 2.11.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/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +1 -1
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +2 -2
- package/dist/BgzipFastaAdapter/index.d.ts +1 -2
- package/dist/BgzipFastaAdapter/index.js +3 -2
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +1 -1
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +2 -2
- package/dist/ChromSizesAdapter/index.d.ts +1 -2
- package/dist/ChromSizesAdapter/index.js +3 -2
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +1 -0
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +56 -41
- package/dist/DivSequenceRenderer/index.d.ts +1 -2
- package/dist/DivSequenceRenderer/index.js +3 -2
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +1 -1
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +2 -2
- package/dist/IndexedFastaAdapter/index.d.ts +1 -2
- package/dist/IndexedFastaAdapter/index.js +3 -2
- package/dist/LinearReferenceSequenceDisplay/index.d.ts +1 -2
- package/dist/LinearReferenceSequenceDisplay/index.js +3 -2
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +38 -20
- package/dist/LinearReferenceSequenceDisplay/model.js +4 -2
- package/dist/ReferenceSequenceTrack/index.d.ts +1 -2
- package/dist/ReferenceSequenceTrack/index.js +3 -2
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +1 -1
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.js +16 -15
- package/dist/SequenceSearchAdapter/index.d.ts +1 -2
- package/dist/SequenceSearchAdapter/index.js +3 -2
- package/dist/TwoBitAdapter/index.d.ts +1 -2
- package/dist/TwoBitAdapter/index.js +3 -2
- package/dist/createExtensionPoints.d.ts +1 -2
- package/dist/createExtensionPoints.js +3 -2
- package/esm/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +1 -1
- package/esm/BgzipFastaAdapter/BgzipFastaAdapter.js +1 -1
- package/esm/BgzipFastaAdapter/index.d.ts +1 -2
- package/esm/BgzipFastaAdapter/index.js +2 -2
- package/esm/ChromSizesAdapter/ChromSizesAdapter.d.ts +1 -1
- package/esm/ChromSizesAdapter/ChromSizesAdapter.js +1 -1
- package/esm/ChromSizesAdapter/index.d.ts +1 -2
- package/esm/ChromSizesAdapter/index.js +2 -2
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.d.ts +1 -0
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +56 -41
- package/esm/DivSequenceRenderer/index.d.ts +1 -2
- package/esm/DivSequenceRenderer/index.js +2 -2
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +1 -1
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +1 -1
- package/esm/IndexedFastaAdapter/index.d.ts +1 -2
- package/esm/IndexedFastaAdapter/index.js +2 -2
- package/esm/LinearReferenceSequenceDisplay/index.d.ts +1 -2
- package/esm/LinearReferenceSequenceDisplay/index.js +2 -2
- package/esm/LinearReferenceSequenceDisplay/model.d.ts +38 -20
- package/esm/LinearReferenceSequenceDisplay/model.js +4 -2
- package/esm/ReferenceSequenceTrack/index.d.ts +1 -2
- package/esm/ReferenceSequenceTrack/index.js +2 -2
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +1 -1
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.js +15 -14
- package/esm/SequenceSearchAdapter/index.d.ts +1 -2
- package/esm/SequenceSearchAdapter/index.js +2 -2
- package/esm/TwoBitAdapter/index.d.ts +1 -2
- package/esm/TwoBitAdapter/index.js +2 -2
- package/esm/createExtensionPoints.d.ts +1 -2
- package/esm/createExtensionPoints.js +2 -2
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
30
30
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
31
|
-
|
|
31
|
+
function TwoBitAdapterF(pluginManager) {
|
|
32
32
|
pluginManager.addAdapterType(() => new AdapterType_1.default({
|
|
33
33
|
name: 'TwoBitAdapter',
|
|
34
34
|
displayName: 'TwoBit adapter',
|
|
@@ -38,4 +38,5 @@ exports.default = (pluginManager) => {
|
|
|
38
38
|
},
|
|
39
39
|
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./TwoBitAdapter'))).then(r => r.default),
|
|
40
40
|
}));
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = TwoBitAdapterF;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
4
|
-
|
|
4
|
+
function ExtensionPointsF(pluginManager) {
|
|
5
5
|
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
6
6
|
return (file, index, adapterHint) => {
|
|
7
7
|
const regexGuess = /\.2bit$/i;
|
|
@@ -82,4 +82,5 @@ exports.default = (pluginManager) => {
|
|
|
82
82
|
return trackTypeGuesser(adapterName);
|
|
83
83
|
};
|
|
84
84
|
});
|
|
85
|
-
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = ExtensionPointsF;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BgzipIndexedFasta } from '@gmod/indexedfasta';
|
|
2
2
|
import IndexedFasta from '../IndexedFastaAdapter/IndexedFastaAdapter';
|
|
3
|
-
export default class extends IndexedFasta {
|
|
3
|
+
export default class BgzipFastaAdapter extends IndexedFasta {
|
|
4
4
|
setupPre(): Promise<{
|
|
5
5
|
fasta: BgzipIndexedFasta;
|
|
6
6
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BgzipIndexedFasta } from '@gmod/indexedfasta';
|
|
2
2
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
3
3
|
import IndexedFasta from '../IndexedFastaAdapter/IndexedFastaAdapter';
|
|
4
|
-
export default class extends IndexedFasta {
|
|
4
|
+
export default class BgzipFastaAdapter extends IndexedFasta {
|
|
5
5
|
async setupPre() {
|
|
6
6
|
const fastaLocation = this.getConf('fastaLocation');
|
|
7
7
|
const faiLocation = this.getConf('faiLocation');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
2
|
import configSchema from './configSchema';
|
|
3
|
-
export default (pluginManager)
|
|
3
|
+
export default function BgzipFastaAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BgzipFastaAdapter',
|
|
6
6
|
displayName: 'Bgzip-indexed FASTA adapter',
|
|
@@ -10,4 +10,4 @@ export default (pluginManager) => {
|
|
|
10
10
|
},
|
|
11
11
|
getAdapterClass: () => import('./BgzipFastaAdapter').then(r => r.default),
|
|
12
12
|
}));
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RegionsAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
export default class extends BaseAdapter implements RegionsAdapter {
|
|
2
|
+
export default class ChromSizesAdapter extends BaseAdapter implements RegionsAdapter {
|
|
3
3
|
protected setupP?: Promise<Record<string, number>>;
|
|
4
4
|
setupPre(): Promise<{
|
|
5
5
|
[k: string]: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
3
|
-
export default class extends BaseAdapter {
|
|
3
|
+
export default class ChromSizesAdapter extends BaseAdapter {
|
|
4
4
|
async setupPre() {
|
|
5
5
|
const pm = this.pluginManager;
|
|
6
6
|
const file = openLocation(this.getConf('chromSizesLocation'), pm);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
2
|
import configSchema from './configSchema';
|
|
3
|
-
export default (pluginManager)
|
|
3
|
+
export default function ChromSizesAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'ChromSizesAdapter',
|
|
6
6
|
displayName: 'Chrom sizes adapter',
|
|
@@ -10,4 +10,4 @@ export default (pluginManager) => {
|
|
|
10
10
|
},
|
|
11
11
|
getAdapterClass: () => import('./ChromSizesAdapter').then(r => r.default),
|
|
12
12
|
}));
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -2,42 +2,54 @@ import React from 'react';
|
|
|
2
2
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { bpSpanPx, revcom, complement, defaultStarts, defaultStops, defaultCodonTable, generateCodonTable, } from '@jbrowse/core/util';
|
|
5
|
-
function Translation(
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// can otherwise result in effectiveFrame -1
|
|
14
|
-
const effectiveFrame = (frame + tilt + 3) % 3;
|
|
15
|
-
const seqSliced = seq.slice(effectiveFrame);
|
|
5
|
+
function Translation({ codonTable, seq, frame, bpPerPx, colorByCDS, region, seqStart, height, y, reverse = false, theme, }) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const normalizedFrame = Math.abs(frame) - 1;
|
|
8
|
+
const seqFrame = seqStart % 3;
|
|
9
|
+
const frameShift = (normalizedFrame - seqFrame + 3) % 3;
|
|
10
|
+
const frameShiftAdjustedSeqLength = seq.length - frameShift;
|
|
11
|
+
const multipleOfThreeLength = frameShiftAdjustedSeqLength - (frameShiftAdjustedSeqLength % 3);
|
|
12
|
+
const seqSliced = seq.slice(frameShift, frameShift + multipleOfThreeLength);
|
|
16
13
|
const translated = [];
|
|
17
14
|
for (let i = 0; i < seqSliced.length; i += 3) {
|
|
18
15
|
const codon = seqSliced.slice(i, i + 3);
|
|
19
16
|
const normalizedCodon = reverse ? revcom(codon) : codon;
|
|
20
17
|
const aminoAcid = codonTable[normalizedCodon] || '';
|
|
21
|
-
translated.push({
|
|
18
|
+
translated.push({
|
|
19
|
+
letter: aminoAcid,
|
|
20
|
+
codon: normalizedCodon.toUpperCase(),
|
|
21
|
+
});
|
|
22
22
|
}
|
|
23
|
-
const w = (1 / scale) * 3;
|
|
24
|
-
const drop = region.start === 0 ? 0 : w;
|
|
25
|
-
const render = 1 / bpPerPx >= 12;
|
|
26
23
|
const width = (region.end - region.start) / bpPerPx;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
const codonWidth = (1 / bpPerPx) * 3;
|
|
25
|
+
const renderLetter = 1 / bpPerPx >= 12;
|
|
26
|
+
const frameOffset = frameShift / bpPerPx;
|
|
27
|
+
const startOffset = (region.start - seqStart) / bpPerPx;
|
|
28
|
+
const offset = frameOffset - startOffset;
|
|
29
|
+
const defaultFill = colorByCDS
|
|
30
|
+
? (_a = theme === null || theme === void 0 ? void 0 : theme.palette.framesCDS.at(frame)) === null || _a === void 0 ? void 0 : _a.main
|
|
31
|
+
: (_b = theme === null || theme === void 0 ? void 0 : theme.palette.frames.at(frame)) === null || _b === void 0 ? void 0 : _b.main;
|
|
32
|
+
return (React.createElement(React.Fragment, null,
|
|
33
|
+
React.createElement("rect", { x: 0, y: y, width: width, height: height, fill: defaultFill }),
|
|
34
|
+
translated.map((element, index) => {
|
|
35
|
+
const x = region.reversed
|
|
36
|
+
? width - (index + 1) * codonWidth - offset
|
|
37
|
+
: codonWidth * index + offset;
|
|
38
|
+
const { letter, codon } = element;
|
|
39
|
+
const codonFill = defaultStarts.includes(codon)
|
|
40
|
+
? theme === null || theme === void 0 ? void 0 : theme.palette.startCodon
|
|
41
|
+
: defaultStops.includes(codon)
|
|
42
|
+
? theme === null || theme === void 0 ? void 0 : theme.palette.stopCodon
|
|
43
|
+
: undefined;
|
|
44
|
+
if (!(renderLetter || codonFill)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return (React.createElement(React.Fragment, { key: `${index}-${letter}` },
|
|
48
|
+
React.createElement("rect", { x: x, y: y, width: renderLetter
|
|
49
|
+
? codonWidth
|
|
50
|
+
: codonWidth + 0.7 /* small fudge factor when zoomed out*/, height: height, stroke: renderLetter ? '#555' : 'none', fill: codonFill || 'none' }),
|
|
51
|
+
renderLetter ? (React.createElement("text", { x: x + codonWidth / 2, fontSize: height - 2, y: y + height / 2, dominantBaseline: "middle", textAnchor: "middle" }, letter)) : null));
|
|
52
|
+
})));
|
|
41
53
|
}
|
|
42
54
|
function DNA(props) {
|
|
43
55
|
const { bpPerPx, region, feature, theme, height, seq, y } = props;
|
|
@@ -55,7 +67,7 @@ function DNA(props) {
|
|
|
55
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));
|
|
56
68
|
})));
|
|
57
69
|
}
|
|
58
|
-
function SequenceSVG({ regions, theme: configTheme, features = new Map(), showReverse = true, showForward = true, showTranslation = true, bpPerPx, rowHeight, }) {
|
|
70
|
+
function SequenceSVG({ regions, theme: configTheme, colorByCDS, features = new Map(), showReverse = true, showForward = true, showTranslation = true, bpPerPx, rowHeight, }) {
|
|
59
71
|
const [region] = regions;
|
|
60
72
|
const theme = createJBrowseTheme(configTheme);
|
|
61
73
|
const codonTable = generateCodonTable(defaultCodonTable);
|
|
@@ -70,23 +82,26 @@ function SequenceSVG({ regions, theme: configTheme, features = new Map(), showRe
|
|
|
70
82
|
// incrementer for the y-position of the current sequence being rendered
|
|
71
83
|
// (applies to both translation rows and dna rows)
|
|
72
84
|
let currY = -rowHeight;
|
|
85
|
+
const showDNA = bpPerPx <= 1;
|
|
86
|
+
const forwardFrames = showTranslation && showForward ? [3, 2, 1] : [];
|
|
87
|
+
const reverseFrames = showTranslation && showReverse ? [-1, -2, -3] : [];
|
|
88
|
+
// if region.reversed, the forward translation is on bottom, reverse on top
|
|
89
|
+
const [topFrames, bottomFrames] = region.reversed
|
|
90
|
+
? [reverseFrames.toReversed(), forwardFrames.toReversed()]
|
|
91
|
+
: [forwardFrames, reverseFrames];
|
|
73
92
|
return (React.createElement(React.Fragment, null,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
showReverse ? (React.createElement(DNA, { height: rowHeight, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : complement(seq), bpPerPx: bpPerPx, theme: theme })) : null,
|
|
79
|
-
showTranslation && (region.reversed ? showForward : showReverse)
|
|
80
|
-
? [0, -1, -2].map(index => (React.createElement(Translation, { key: `rev-translation-${index}`, seq: seq, y: (currY += rowHeight), codonTable: codonTable, frame: index, bpPerPx: bpPerPx, region: region, theme: theme, height: rowHeight, reverse: !region.reversed })))
|
|
81
|
-
: null));
|
|
93
|
+
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 }))),
|
|
94
|
+
showForward && showDNA ? (React.createElement(DNA, { height: rowHeight, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? complement(seq) : seq, bpPerPx: bpPerPx, theme: theme })) : null,
|
|
95
|
+
showReverse && showDNA ? (React.createElement(DNA, { height: rowHeight, y: (currY += rowHeight), feature: feature, region: region, seq: region.reversed ? seq : complement(seq), bpPerPx: bpPerPx, theme: theme })) : null,
|
|
96
|
+
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 })))));
|
|
82
97
|
}
|
|
83
98
|
function Wrapper({ exportSVG, width, totalHeight, children, }) {
|
|
84
|
-
return exportSVG ? (
|
|
99
|
+
return exportSVG ? (children) : (React.createElement("svg", { "data-testid": "sequence_track", width: width, height: totalHeight, style: {
|
|
100
|
+
// use block because svg by default is inline, which adds a margin
|
|
101
|
+
display: 'block',
|
|
85
102
|
width,
|
|
86
103
|
height: totalHeight,
|
|
87
104
|
userSelect: 'none',
|
|
88
|
-
// use block because svg by default is inline, which adds a margin
|
|
89
|
-
display: 'block',
|
|
90
105
|
} }, children));
|
|
91
106
|
}
|
|
92
107
|
const DivSequenceRendering = observer(function (props) {
|
|
@@ -15,11 +15,11 @@ class DivSequenceRenderer extends FeatureRendererType {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export default (pluginManager)
|
|
18
|
+
export default function DivSequenceRendererF(pluginManager) {
|
|
19
19
|
pluginManager.addRendererType(() => new DivSequenceRenderer({
|
|
20
20
|
name: 'DivSequenceRenderer',
|
|
21
21
|
ReactComponent,
|
|
22
22
|
configSchema,
|
|
23
23
|
pluginManager,
|
|
24
24
|
}));
|
|
25
|
-
}
|
|
25
|
+
}
|
|
@@ -2,7 +2,7 @@ import { IndexedFasta } from '@gmod/indexedfasta';
|
|
|
2
2
|
import { BaseSequenceAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
3
|
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
4
4
|
import { Feature } from '@jbrowse/core/util';
|
|
5
|
-
export default class extends BaseSequenceAdapter {
|
|
5
|
+
export default class IndexedFastaAdapter extends BaseSequenceAdapter {
|
|
6
6
|
protected setupP?: Promise<{
|
|
7
7
|
fasta: IndexedFasta;
|
|
8
8
|
}>;
|
|
@@ -5,7 +5,7 @@ import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
|
5
5
|
import { SimpleFeature } from '@jbrowse/core/util';
|
|
6
6
|
import AbortablePromiseCache from 'abortable-promise-cache';
|
|
7
7
|
import QuickLRU from '@jbrowse/core/util/QuickLRU';
|
|
8
|
-
export default class extends BaseSequenceAdapter {
|
|
8
|
+
export default class IndexedFastaAdapter extends BaseSequenceAdapter {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.seqCache = new AbortablePromiseCache({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
2
|
import configSchema from './configSchema';
|
|
3
|
-
export default (pluginManager)
|
|
3
|
+
export default function IndexedFastaAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'IndexedFastaAdapter',
|
|
6
6
|
displayName: 'Indexed FASTA adapter',
|
|
@@ -10,4 +10,4 @@ export default (pluginManager) => {
|
|
|
10
10
|
},
|
|
11
11
|
getAdapterClass: () => import('./IndexedFastaAdapter').then(r => r.default),
|
|
12
12
|
}));
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@ import { DisplayType } from '@jbrowse/core/pluggableElementTypes';
|
|
|
2
2
|
import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
3
3
|
import { configSchema } from './configSchema';
|
|
4
4
|
import { modelFactory } from './model';
|
|
5
|
-
export default (pluginManager)
|
|
5
|
+
export default function LinearReferenceSequenceDisplayF(pluginManager) {
|
|
6
6
|
pluginManager.addDisplayType(() => {
|
|
7
7
|
const stateModel = modelFactory(configSchema);
|
|
8
8
|
return new DisplayType({
|
|
@@ -15,4 +15,4 @@ export default (pluginManager) => {
|
|
|
15
15
|
ReactComponent: BaseLinearDisplayComponent,
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -70,24 +70,31 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
70
70
|
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
71
71
|
maxFeatureScreenDensity: {
|
|
72
72
|
type: string;
|
|
73
|
-
description: string;
|
|
73
|
+
description: string; /**
|
|
74
|
+
* #property
|
|
75
|
+
*/
|
|
74
76
|
defaultValue: number;
|
|
75
77
|
};
|
|
76
78
|
fetchSizeLimit: {
|
|
77
|
-
type: string;
|
|
79
|
+
type: string; /**
|
|
80
|
+
* #property
|
|
81
|
+
*/
|
|
78
82
|
defaultValue: number;
|
|
79
83
|
description: string;
|
|
80
84
|
};
|
|
81
85
|
height: {
|
|
82
86
|
type: string;
|
|
83
|
-
defaultValue: number;
|
|
84
|
-
description: string; /**
|
|
87
|
+
defaultValue: number; /**
|
|
85
88
|
* #property
|
|
86
89
|
*/
|
|
90
|
+
description: string;
|
|
87
91
|
};
|
|
88
92
|
mouseover: {
|
|
89
93
|
type: string;
|
|
90
94
|
description: string;
|
|
95
|
+
/**
|
|
96
|
+
* #getter
|
|
97
|
+
*/
|
|
91
98
|
defaultValue: string;
|
|
92
99
|
contextVariable: string[];
|
|
93
100
|
};
|
|
@@ -107,13 +114,15 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
107
114
|
model: {
|
|
108
115
|
id: string;
|
|
109
116
|
type: string;
|
|
110
|
-
rpcDriverName: string | undefined;
|
|
111
|
-
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
112
|
-
rendererTypeName: string; /**
|
|
117
|
+
rpcDriverName: string | undefined; /**
|
|
113
118
|
* #property
|
|
114
119
|
*/
|
|
120
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
121
|
+
rendererTypeName: string;
|
|
115
122
|
error: unknown;
|
|
116
|
-
message: string | undefined;
|
|
123
|
+
message: string | undefined; /**
|
|
124
|
+
* #property
|
|
125
|
+
*/
|
|
117
126
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
118
127
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
119
128
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -161,13 +170,15 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
161
170
|
} & {
|
|
162
171
|
scrollTop: number;
|
|
163
172
|
} & {
|
|
164
|
-
readonly height: number;
|
|
165
|
-
} & {
|
|
166
|
-
setScrollTop(scrollTop: number): void; /**
|
|
173
|
+
readonly height: number; /**
|
|
167
174
|
* #property
|
|
168
175
|
*/
|
|
176
|
+
} & {
|
|
177
|
+
setScrollTop(scrollTop: number): void;
|
|
169
178
|
setHeight(displayHeight: number): number;
|
|
170
|
-
resizeHeight(distance: number): number;
|
|
179
|
+
resizeHeight(distance: number): number; /**
|
|
180
|
+
* #getter
|
|
181
|
+
*/
|
|
171
182
|
} & {
|
|
172
183
|
featureDensityStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats> | undefined;
|
|
173
184
|
featureDensityStats: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined;
|
|
@@ -175,13 +186,13 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
175
186
|
} & {
|
|
176
187
|
readonly currentBytesRequested: number;
|
|
177
188
|
readonly currentFeatureScreenDensity: number;
|
|
178
|
-
readonly maxFeatureScreenDensity: any;
|
|
189
|
+
readonly maxFeatureScreenDensity: any; /**
|
|
190
|
+
* #method
|
|
191
|
+
*/
|
|
179
192
|
readonly featureDensityStatsReady: boolean;
|
|
180
193
|
readonly maxAllowableBytes: number;
|
|
181
194
|
} & {
|
|
182
|
-
afterAttach(): void;
|
|
183
|
-
* #getter
|
|
184
|
-
*/
|
|
195
|
+
afterAttach(): void;
|
|
185
196
|
} & {
|
|
186
197
|
setCurrStatsBpPerPx(n: number): void;
|
|
187
198
|
setFeatureDensityStatsLimit(stats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats | undefined): void;
|
|
@@ -344,24 +355,31 @@ export declare function modelFactory(configSchema: AnyConfigurationSchemaType):
|
|
|
344
355
|
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
345
356
|
maxFeatureScreenDensity: {
|
|
346
357
|
type: string;
|
|
347
|
-
description: string;
|
|
358
|
+
description: string; /**
|
|
359
|
+
* #property
|
|
360
|
+
*/
|
|
348
361
|
defaultValue: number;
|
|
349
362
|
};
|
|
350
363
|
fetchSizeLimit: {
|
|
351
|
-
type: string;
|
|
364
|
+
type: string; /**
|
|
365
|
+
* #property
|
|
366
|
+
*/
|
|
352
367
|
defaultValue: number;
|
|
353
368
|
description: string;
|
|
354
369
|
};
|
|
355
370
|
height: {
|
|
356
371
|
type: string;
|
|
357
|
-
defaultValue: number;
|
|
358
|
-
description: string; /**
|
|
372
|
+
defaultValue: number; /**
|
|
359
373
|
* #property
|
|
360
374
|
*/
|
|
375
|
+
description: string;
|
|
361
376
|
};
|
|
362
377
|
mouseover: {
|
|
363
378
|
type: string;
|
|
364
379
|
description: string;
|
|
380
|
+
/**
|
|
381
|
+
* #getter
|
|
382
|
+
*/
|
|
365
383
|
defaultValue: string;
|
|
366
384
|
contextVariable: string[];
|
|
367
385
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { addDisposer, types } from 'mobx-state-tree';
|
|
2
2
|
import { BaseLinearDisplay, } from '@jbrowse/plugin-linear-genome-view';
|
|
3
3
|
import { ConfigurationReference, } from '@jbrowse/core/configuration';
|
|
4
|
+
import { getParentRenderProps } from '@jbrowse/core/util/tracks';
|
|
4
5
|
import { getContainingView } from '@jbrowse/core/util';
|
|
5
6
|
import { autorun } from 'mobx';
|
|
6
7
|
/**
|
|
@@ -61,6 +62,7 @@ export function modelFactory(configSchema) {
|
|
|
61
62
|
const { showForward, rpcDriverName, showReverse, showTranslation, rowHeight, sequenceHeight, } = self;
|
|
62
63
|
return {
|
|
63
64
|
...superRenderProps(),
|
|
65
|
+
...getParentRenderProps(self),
|
|
64
66
|
config: self.configuration.renderer,
|
|
65
67
|
rpcDriverName,
|
|
66
68
|
showForward,
|
|
@@ -78,7 +80,7 @@ export function modelFactory(configSchema) {
|
|
|
78
80
|
*/
|
|
79
81
|
regionCannotBeRendered( /* region */) {
|
|
80
82
|
const view = getContainingView(self);
|
|
81
|
-
return (view === null || view === void 0 ? void 0 : view.bpPerPx)
|
|
83
|
+
return (view === null || view === void 0 ? void 0 : view.bpPerPx) > 3 ? 'Zoom in to see sequence' : undefined;
|
|
82
84
|
},
|
|
83
85
|
/**
|
|
84
86
|
* #getter
|
|
@@ -109,7 +111,7 @@ export function modelFactory(configSchema) {
|
|
|
109
111
|
afterAttach() {
|
|
110
112
|
addDisposer(self, autorun(() => {
|
|
111
113
|
const view = getContainingView(self);
|
|
112
|
-
if ((view === null || view === void 0 ? void 0 : view.bpPerPx)
|
|
114
|
+
if ((view === null || view === void 0 ? void 0 : view.bpPerPx) > 3) {
|
|
113
115
|
self.setHeight(50);
|
|
114
116
|
}
|
|
115
117
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType';
|
|
2
2
|
import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
3
|
import { createReferenceSeqTrackConfig } from './configSchema';
|
|
4
|
-
export default (pluginManager)
|
|
4
|
+
export default function ReferenceSequenceTrackF(pluginManager) {
|
|
5
5
|
pluginManager.addTrackType(() => {
|
|
6
6
|
const configSchema = createReferenceSeqTrackConfig(pluginManager);
|
|
7
7
|
return new TrackType({
|
|
@@ -11,4 +11,4 @@ export default (pluginManager) => {
|
|
|
11
11
|
stateModel: createBaseTrackModel(pluginManager, 'ReferenceSequenceTrack', configSchema),
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
-
export default class extends BaseFeatureDataAdapter {
|
|
3
|
+
export default class SequenceSearchAdapter extends BaseFeatureDataAdapter {
|
|
4
4
|
configure(): Promise<BaseFeatureDataAdapter>;
|
|
5
5
|
getRefNames(): Promise<string[]>;
|
|
6
6
|
getFeatures(query: Region, opts: BaseOptions): import("rxjs").Observable<Feature>;
|
|
@@ -3,7 +3,7 @@ import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
|
3
3
|
import { SimpleFeature, revcom, doesIntersect2, } from '@jbrowse/core/util';
|
|
4
4
|
import { toArray } from 'rxjs/operators';
|
|
5
5
|
import { firstValueFrom } from 'rxjs';
|
|
6
|
-
export default class extends BaseFeatureDataAdapter {
|
|
6
|
+
export default class SequenceSearchAdapter extends BaseFeatureDataAdapter {
|
|
7
7
|
async configure() {
|
|
8
8
|
var _a;
|
|
9
9
|
const adapter = await ((_a = this.getSubAdapter) === null || _a === void 0 ? void 0 : _a.call(this, this.getConf('sequenceAdapter')));
|
|
@@ -20,10 +20,9 @@ export default class extends BaseFeatureDataAdapter {
|
|
|
20
20
|
return ObservableCreate(async (observer) => {
|
|
21
21
|
var _a;
|
|
22
22
|
const sequenceAdapter = await this.configure();
|
|
23
|
-
const hw =
|
|
24
|
-
|
|
25
|
-
queryStart = Math.max(0,
|
|
26
|
-
queryEnd += hw;
|
|
23
|
+
const hw = 10000;
|
|
24
|
+
const queryEnd = query.end + hw;
|
|
25
|
+
const queryStart = Math.max(0, query.start - hw);
|
|
27
26
|
if (queryEnd < 0 || queryStart > queryEnd) {
|
|
28
27
|
observer.complete();
|
|
29
28
|
return;
|
|
@@ -44,13 +43,14 @@ export default class extends BaseFeatureDataAdapter {
|
|
|
44
43
|
if (searchForward) {
|
|
45
44
|
const matches = residues.matchAll(re);
|
|
46
45
|
for (const match of matches) {
|
|
47
|
-
const s = queryStart +
|
|
48
|
-
|
|
46
|
+
const s = queryStart + match.index;
|
|
47
|
+
const e = queryStart + match.index + match[0].length;
|
|
48
|
+
if (doesIntersect2(s, e, query.start, query.end)) {
|
|
49
49
|
observer.next(new SimpleFeature({
|
|
50
|
-
uniqueId: `${this.id}
|
|
50
|
+
uniqueId: `${this.id}-${s}-${match[0]}-pos`,
|
|
51
51
|
refName: query.refName,
|
|
52
52
|
start: s,
|
|
53
|
-
end:
|
|
53
|
+
end: e,
|
|
54
54
|
name: match[0],
|
|
55
55
|
strand: 1,
|
|
56
56
|
}));
|
|
@@ -60,14 +60,15 @@ export default class extends BaseFeatureDataAdapter {
|
|
|
60
60
|
if (searchReverse) {
|
|
61
61
|
const matches = revcom(residues).matchAll(re);
|
|
62
62
|
for (const match of matches) {
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const e = queryEnd - match.index;
|
|
64
|
+
const s = queryEnd - match.index - match[0].length;
|
|
65
|
+
if (doesIntersect2(s, e, query.start, query.end)) {
|
|
65
66
|
observer.next(new SimpleFeature({
|
|
66
|
-
uniqueId: `${this.id}
|
|
67
|
+
uniqueId: `${this.id}-${s}-${match[0]}-neg`,
|
|
67
68
|
refName: query.refName,
|
|
68
|
-
start: s
|
|
69
|
+
start: s,
|
|
70
|
+
end: e,
|
|
69
71
|
name: match[0],
|
|
70
|
-
end: s,
|
|
71
72
|
strand: -1,
|
|
72
73
|
}));
|
|
73
74
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
2
|
import configSchema from './configSchema';
|
|
3
|
-
export default (pluginManager)
|
|
3
|
+
export default function SequenceSearchAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'SequenceSearchAdapter',
|
|
6
6
|
displayName: 'Sequence search adapter',
|
|
@@ -10,4 +10,4 @@ export default (pluginManager) => {
|
|
|
10
10
|
configSchema,
|
|
11
11
|
getAdapterClass: () => import('./SequenceSearchAdapter').then(r => r.default),
|
|
12
12
|
}));
|
|
13
|
-
}
|
|
13
|
+
}
|