@jbrowse/plugin-sequence 1.5.8 → 1.6.2
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/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +2 -2
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +29 -5
- package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +2 -2
- package/dist/plugin-sequence.cjs.development.js +49 -41
- package/dist/plugin-sequence.cjs.development.js.map +1 -1
- package/dist/plugin-sequence.cjs.production.min.js +1 -1
- package/dist/plugin-sequence.cjs.production.min.js.map +1 -1
- package/dist/plugin-sequence.esm.js +50 -42
- package/dist/plugin-sequence.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/DivSequenceRenderer/components/DivSequenceRendering.tsx +2 -1
- package/src/DivSequenceRenderer/components/__snapshots__/DivSequenceRendering.test.js.snap +6 -0
- package/src/GCContentAdapter/GCContentAdapter.ts +7 -8
- package/src/IndexedFastaAdapter/IndexedFastaAdapter.ts +2 -3
- package/src/TwoBitAdapter/TwoBitAdapter.ts +2 -8
- package/src/index.ts +28 -17
|
@@ -6,13 +6,13 @@ import Plugin from '@jbrowse/core/Plugin';
|
|
|
6
6
|
import { BaseLinearDisplay, BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
7
7
|
import { getFileName, makeIndex } from '@jbrowse/core/util/tracks';
|
|
8
8
|
import { ConfigurationSchema, ConfigurationReference, readConfObject } from '@jbrowse/core/configuration';
|
|
9
|
+
import React from 'react';
|
|
9
10
|
import { contrastingTextColor } from '@jbrowse/core/util/color';
|
|
10
11
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
11
12
|
import { observer } from 'mobx-react';
|
|
12
|
-
import React from 'react';
|
|
13
13
|
import { generateCodonTable, defaultCodonTable, complement, revcom, defaultStarts, defaultStops, bpSpanPx, getContainingView } from '@jbrowse/core/util';
|
|
14
14
|
import { types } from 'mobx-state-tree';
|
|
15
|
-
import { BaseFeatureDataAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
15
|
+
import { BaseFeatureDataAdapter, BaseSequenceAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
16
16
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
17
17
|
import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
18
18
|
import { toArray } from 'rxjs/operators';
|
|
@@ -129,14 +129,14 @@ function _inherits(subClass, superClass) {
|
|
|
129
129
|
throw new TypeError("Super expression must either be null or a function");
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
133
|
+
constructor: {
|
|
134
|
+
value: subClass,
|
|
135
|
+
writable: true,
|
|
136
|
+
configurable: true
|
|
137
|
+
}
|
|
138
|
+
});
|
|
132
139
|
Object.defineProperty(subClass, "prototype", {
|
|
133
|
-
value: Object.create(superClass && superClass.prototype, {
|
|
134
|
-
constructor: {
|
|
135
|
-
value: subClass,
|
|
136
|
-
writable: true,
|
|
137
|
-
configurable: true
|
|
138
|
-
}
|
|
139
|
-
}),
|
|
140
140
|
writable: false
|
|
141
141
|
});
|
|
142
142
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
@@ -506,6 +506,7 @@ var Wrapper = function Wrapper(_ref3) {
|
|
|
506
506
|
totalHeight = _ref3.totalHeight,
|
|
507
507
|
children = _ref3.children;
|
|
508
508
|
return exportSVG ? React.createElement(React.Fragment, null, children) : React.createElement("svg", {
|
|
509
|
+
"data-testid": "sequence_track",
|
|
509
510
|
width: width,
|
|
510
511
|
height: totalHeight,
|
|
511
512
|
style: {
|
|
@@ -828,12 +829,15 @@ var SequencePlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
828
829
|
var regexGuess = /\.2bit$/i;
|
|
829
830
|
var adapterName = 'TwoBitAdapter';
|
|
830
831
|
var fileName = getFileName(file);
|
|
832
|
+
var obj = {
|
|
833
|
+
type: adapterName,
|
|
834
|
+
twoBitLocation: file
|
|
835
|
+
};
|
|
831
836
|
|
|
832
|
-
if (regexGuess.test(fileName)
|
|
833
|
-
return
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
};
|
|
837
|
+
if (regexGuess.test(fileName) && !adapterHint) {
|
|
838
|
+
return obj;
|
|
839
|
+
} else if (adapterHint === adapterName) {
|
|
840
|
+
return obj;
|
|
837
841
|
}
|
|
838
842
|
|
|
839
843
|
return adapterGuesser(file, index, adapterHint);
|
|
@@ -887,13 +891,16 @@ var SequencePlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
887
891
|
var regexGuess = /\.(fa|fasta|fas|fna|mfa)$/i;
|
|
888
892
|
var adapterName = 'IndexedFastaAdapter';
|
|
889
893
|
var fileName = getFileName(file);
|
|
894
|
+
var obj = {
|
|
895
|
+
type: adapterName,
|
|
896
|
+
fastaLocation: file,
|
|
897
|
+
faiLocation: index || makeIndex(file, '.fai')
|
|
898
|
+
};
|
|
890
899
|
|
|
891
|
-
if (regexGuess.test(fileName)
|
|
892
|
-
return
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
faiLocation: index || makeIndex(file, '.fai')
|
|
896
|
-
};
|
|
900
|
+
if (regexGuess.test(fileName) && !adapterHint) {
|
|
901
|
+
return obj;
|
|
902
|
+
} else if (adapterHint === adapterName) {
|
|
903
|
+
return obj;
|
|
897
904
|
}
|
|
898
905
|
|
|
899
906
|
return adapterGuesser(file, index, adapterHint);
|
|
@@ -930,13 +937,16 @@ var SequencePlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
930
937
|
var regexGuess = /\.(fa|fasta|fas|fna|mfa)\.b?gz$/i;
|
|
931
938
|
var adapterName = 'BgzipFastaAdapter';
|
|
932
939
|
var fileName = getFileName(file);
|
|
940
|
+
var obj = {
|
|
941
|
+
type: adapterName,
|
|
942
|
+
faiLocation: makeIndex(file, '.fai'),
|
|
943
|
+
gziLocation: makeIndex(file, '.gzi')
|
|
944
|
+
};
|
|
933
945
|
|
|
934
|
-
if (regexGuess.test(fileName)
|
|
935
|
-
return
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
gziLocation: makeIndex(file, '.gzi')
|
|
939
|
-
};
|
|
946
|
+
if (regexGuess.test(fileName) && !adapterHint) {
|
|
947
|
+
return obj;
|
|
948
|
+
} else if (adapterHint === adapterName) {
|
|
949
|
+
return obj;
|
|
940
950
|
}
|
|
941
951
|
|
|
942
952
|
return adapterGuesser(file, index, adapterHint);
|
|
@@ -1830,8 +1840,9 @@ var default_1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1830
1840
|
this.gcMode = 'content';
|
|
1831
1841
|
return ObservableCreate( /*#__PURE__*/function () {
|
|
1832
1842
|
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(observer) {
|
|
1833
|
-
var
|
|
1843
|
+
var _feats$;
|
|
1834
1844
|
|
|
1845
|
+
var sequenceAdapter, hw, f, queryStart, queryEnd, ret, feats, residues, i, r, nc, ng, len, j, pos, score;
|
|
1835
1846
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1836
1847
|
while (1) {
|
|
1837
1848
|
switch (_context3.prev = _context3.next) {
|
|
@@ -1860,15 +1871,13 @@ var default_1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1860
1871
|
ret = sequenceAdapter.getFeatures(_objectSpread2(_objectSpread2({}, query), {}, {
|
|
1861
1872
|
start: queryStart,
|
|
1862
1873
|
end: queryEnd
|
|
1863
|
-
})
|
|
1874
|
+
}));
|
|
1864
1875
|
_context3.next = 14;
|
|
1865
1876
|
return ret.pipe(toArray()).toPromise();
|
|
1866
1877
|
|
|
1867
1878
|
case 14:
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
feat = _yield$ret$pipe$toPro2[0];
|
|
1871
|
-
residues = feat.get('seq');
|
|
1879
|
+
feats = _context3.sent;
|
|
1880
|
+
residues = ((_feats$ = feats[0]) === null || _feats$ === void 0 ? void 0 : _feats$.get('seq')) || '';
|
|
1872
1881
|
|
|
1873
1882
|
for (i = hw; i < residues.length - hw; i += _this2.windowDelta) {
|
|
1874
1883
|
r = f ? residues[i] : residues.slice(i - hw, i + hw);
|
|
@@ -1895,20 +1904,19 @@ var default_1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1895
1904
|
score = (ng + nc) / (len || 1);
|
|
1896
1905
|
} else if (_this2.gcMode === 'skew') {
|
|
1897
1906
|
score = (ng - nc) / (ng + nc || 1);
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1907
|
+
}
|
|
1900
1908
|
|
|
1901
1909
|
observer.next(new SimpleFeature({
|
|
1902
1910
|
uniqueId: "".concat(_this2.id, "_").concat(pos + i),
|
|
1903
1911
|
start: pos + i,
|
|
1904
1912
|
end: pos + i + _this2.windowDelta,
|
|
1905
1913
|
score: score
|
|
1906
|
-
}));
|
|
1914
|
+
}));
|
|
1907
1915
|
}
|
|
1908
1916
|
|
|
1909
1917
|
observer.complete();
|
|
1910
1918
|
|
|
1911
|
-
case
|
|
1919
|
+
case 18:
|
|
1912
1920
|
case "end":
|
|
1913
1921
|
return _context3.stop();
|
|
1914
1922
|
}
|
|
@@ -1943,8 +1951,8 @@ var GCContentAdapter = {
|
|
|
1943
1951
|
'default': default_1
|
|
1944
1952
|
};
|
|
1945
1953
|
|
|
1946
|
-
var TwoBitAdapter = /*#__PURE__*/function (
|
|
1947
|
-
_inherits(TwoBitAdapter,
|
|
1954
|
+
var TwoBitAdapter = /*#__PURE__*/function (_BaseSequenceAdapter) {
|
|
1955
|
+
_inherits(TwoBitAdapter, _BaseSequenceAdapter);
|
|
1948
1956
|
|
|
1949
1957
|
var _super = /*#__PURE__*/_createSuper(TwoBitAdapter);
|
|
1950
1958
|
|
|
@@ -2182,7 +2190,7 @@ var TwoBitAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2182
2190
|
}]);
|
|
2183
2191
|
|
|
2184
2192
|
return TwoBitAdapter;
|
|
2185
|
-
}(
|
|
2193
|
+
}(BaseSequenceAdapter);
|
|
2186
2194
|
|
|
2187
2195
|
var TwoBitAdapter$1 = {
|
|
2188
2196
|
__proto__: null,
|
|
@@ -2318,8 +2326,8 @@ var ChromSizesAdapter = {
|
|
|
2318
2326
|
'default': _default
|
|
2319
2327
|
};
|
|
2320
2328
|
|
|
2321
|
-
var _default$1 = /*#__PURE__*/function (
|
|
2322
|
-
_inherits(_default,
|
|
2329
|
+
var _default$1 = /*#__PURE__*/function (_BaseSequenceAdapter) {
|
|
2330
|
+
_inherits(_default, _BaseSequenceAdapter);
|
|
2323
2331
|
|
|
2324
2332
|
var _super = /*#__PURE__*/_createSuper(_default);
|
|
2325
2333
|
|
|
@@ -2499,7 +2507,7 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2499
2507
|
}]);
|
|
2500
2508
|
|
|
2501
2509
|
return _default;
|
|
2502
|
-
}(
|
|
2510
|
+
}(BaseSequenceAdapter);
|
|
2503
2511
|
|
|
2504
2512
|
var IndexedFastaAdapter = {
|
|
2505
2513
|
__proto__: null,
|