@jbrowse/plugin-gtf 1.6.9 → 1.7.3
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/GtfAdapter/GtfAdapter.d.ts +14 -14
- package/dist/GtfAdapter/GtfAdapter.js +284 -0
- package/dist/GtfAdapter/GtfAdapter.test.js +127 -0
- package/dist/GtfAdapter/configSchema.d.ts +2 -2
- package/dist/GtfAdapter/configSchema.js +22 -0
- package/dist/GtfAdapter/index.d.ts +1 -1
- package/dist/GtfAdapter/index.js +15 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +99 -6
- package/dist/util.d.ts +15 -15
- package/dist/util.js +87 -0
- package/package.json +5 -7
- package/dist/plugin-gtf.cjs.development.js +0 -1303
- package/dist/plugin-gtf.cjs.development.js.map +0 -1
- package/dist/plugin-gtf.cjs.production.min.js +0 -2
- package/dist/plugin-gtf.cjs.production.min.js.map +0 -1
- package/dist/plugin-gtf.esm.js +0 -1297
- package/dist/plugin-gtf.esm.js.map +0 -1
package/dist/util.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.featureData = featureData;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
|
|
16
|
+
function featureData(data) {
|
|
17
|
+
var f = _objectSpread({}, data);
|
|
18
|
+
|
|
19
|
+
f.start -= 1; // convert to interbase
|
|
20
|
+
|
|
21
|
+
f.strand = {
|
|
22
|
+
'+': 1,
|
|
23
|
+
'-': -1,
|
|
24
|
+
'.': 0,
|
|
25
|
+
'?': undefined
|
|
26
|
+
}[data.strand]; // convert strand
|
|
27
|
+
|
|
28
|
+
f.phase = Number(data.frame);
|
|
29
|
+
f.refName = data.seq_name;
|
|
30
|
+
|
|
31
|
+
if (data.score === null) {
|
|
32
|
+
delete f.score;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (data.frame === null) {
|
|
36
|
+
delete f.score;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var defaultFields = ['start', 'end', 'seq_name', 'score', 'featureType', 'source', 'frame', 'strand'];
|
|
40
|
+
Object.keys(data.attributes).forEach(function (a) {
|
|
41
|
+
var b = a.toLowerCase();
|
|
42
|
+
|
|
43
|
+
if (defaultFields.includes(b)) {
|
|
44
|
+
// add "suffix" to tag name if it already exists
|
|
45
|
+
// reproduces behavior of NCList
|
|
46
|
+
b += '2';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (data.attributes[a] !== null) {
|
|
50
|
+
var attr = data.attributes[a];
|
|
51
|
+
|
|
52
|
+
if (Array.isArray(attr) && attr.length === 1) {
|
|
53
|
+
// gtf uses double quotes for text values in the attributes column, remove them
|
|
54
|
+
var formattedAttr = attr[0].replace(/^"|"$/g, '');
|
|
55
|
+
attr = formattedAttr;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
f[b] = attr;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
f.refName = f.seq_name;
|
|
62
|
+
f.type = f.featureType; // the SimpleFeature constructor takes care of recursively inflating subfeatures
|
|
63
|
+
|
|
64
|
+
if (data.child_features && data.child_features.length) {
|
|
65
|
+
f.subfeatures = data.child_features.map(function (childLocs) {
|
|
66
|
+
return childLocs.map(function (childLoc) {
|
|
67
|
+
return featureData(childLoc);
|
|
68
|
+
});
|
|
69
|
+
}).flat();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
delete f.child_features;
|
|
73
|
+
delete f.data;
|
|
74
|
+
delete f.derived_features; // eslint-disable-next-line no-underscore-dangle
|
|
75
|
+
|
|
76
|
+
delete f._linehash;
|
|
77
|
+
delete f.attributes;
|
|
78
|
+
delete f.seq_name;
|
|
79
|
+
delete f.featureType;
|
|
80
|
+
delete f.frame;
|
|
81
|
+
|
|
82
|
+
if (f.transcript_id) {
|
|
83
|
+
f.name = f.transcript_id;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return f;
|
|
87
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-gtf",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "JBrowse 2 gtf feature adapter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -18,21 +18,19 @@
|
|
|
18
18
|
"distMain": "dist/index.js",
|
|
19
19
|
"srcMain": "src/index.ts",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
|
-
"distModule": "dist/plugin-gtf.esm.js",
|
|
22
|
-
"module": "dist/plugin-gtf.esm.js",
|
|
23
21
|
"files": [
|
|
24
22
|
"dist",
|
|
25
23
|
"src"
|
|
26
24
|
],
|
|
27
25
|
"scripts": {
|
|
28
|
-
"
|
|
29
|
-
"build": "tsdx build",
|
|
26
|
+
"build": "babel src --root-mode upward --out-dir dist --extensions .ts,.js,.tsx,.jsx",
|
|
30
27
|
"test": "cd ../..; jest plugins/gtf --passWithNoTests",
|
|
31
28
|
"prepublishOnly": "yarn test",
|
|
32
29
|
"prepack": "yarn build; yarn useDist",
|
|
33
30
|
"postpack": "yarn useSrc",
|
|
34
31
|
"useDist": "node ../../scripts/useDist.js",
|
|
35
|
-
"useSrc": "node ../../scripts/useSrc.js"
|
|
32
|
+
"useSrc": "node ../../scripts/useSrc.js",
|
|
33
|
+
"postbuild": "tsc --build tsconfig.build.json"
|
|
36
34
|
},
|
|
37
35
|
"dependencies": {
|
|
38
36
|
"@flatten-js/interval-tree": "^1.0.15",
|
|
@@ -52,5 +50,5 @@
|
|
|
52
50
|
"publishConfig": {
|
|
53
51
|
"access": "public"
|
|
54
52
|
},
|
|
55
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "09b13c85acf4ac68dd71ab23af87656c7552fdaf"
|
|
56
54
|
}
|