@jbrowse/plugin-bed 1.6.9 → 1.7.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/util.js ADDED
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ucscProcessedTranscript = ucscProcessedTranscript;
9
+
10
+ var _simpleFeature = _interopRequireDefault(require("@jbrowse/core/util/simpleFeature"));
11
+
12
+ function ucscProcessedTranscript(feature) {
13
+ var children = feature.children(); // split the blocks into UTR, CDS, and exons
14
+
15
+ var thickStart = feature.get('thickStart');
16
+ var thickEnd = feature.get('thickEnd');
17
+
18
+ if (!thickStart && !thickEnd) {
19
+ return feature;
20
+ }
21
+
22
+ var blocks = children ? children.filter(function (child) {
23
+ return child.get('type') === 'block';
24
+ }).sort(function (a, b) {
25
+ return a.get('start') - b.get('start');
26
+ }) : []; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
28
+ var newChildren = [];
29
+ blocks.forEach(function (block) {
30
+ var start = block.get('start');
31
+ var end = block.get('end');
32
+
33
+ if (thickStart >= end) {
34
+ // left-side UTR
35
+ var prime = feature.get('strand') > 0 ? 'five' : 'three';
36
+ newChildren.push({
37
+ type: "".concat(prime, "_prime_UTR"),
38
+ start: start,
39
+ end: end
40
+ });
41
+ } else if (thickStart > start && thickStart < end && thickEnd >= end) {
42
+ // UTR | CDS
43
+ var _prime = feature.get('strand') > 0 ? 'five' : 'three';
44
+
45
+ newChildren.push({
46
+ type: "".concat(_prime, "_prime_UTR"),
47
+ start: start,
48
+ end: thickStart
49
+ }, {
50
+ type: 'CDS',
51
+ start: thickStart,
52
+ end: end
53
+ });
54
+ } else if (thickStart <= start && thickEnd >= end) {
55
+ // CDS
56
+ newChildren.push({
57
+ type: 'CDS',
58
+ start: start,
59
+ end: end
60
+ });
61
+ } else if (thickStart > start && thickStart < end && thickEnd < end) {
62
+ // UTR | CDS | UTR
63
+ var leftPrime = feature.get('strand') > 0 ? 'five' : 'three';
64
+ var rightPrime = feature.get('strand') > 0 ? 'three' : 'five';
65
+ newChildren.push({
66
+ type: "".concat(leftPrime, "_prime_UTR"),
67
+ start: start,
68
+ end: thickStart
69
+ }, {
70
+ type: "CDS",
71
+ start: thickStart,
72
+ end: thickEnd
73
+ }, {
74
+ type: "".concat(rightPrime, "_prime_UTR"),
75
+ start: thickEnd,
76
+ end: end
77
+ });
78
+ } else if (thickStart <= start && thickEnd > start && thickEnd < end) {
79
+ // CDS | UTR
80
+ var _prime2 = feature.get('strand') > 0 ? 'three' : 'five';
81
+
82
+ newChildren.push({
83
+ type: "CDS",
84
+ start: start,
85
+ end: thickEnd
86
+ }, {
87
+ type: "".concat(_prime2, "_prime_UTR"),
88
+ start: thickEnd,
89
+ end: end
90
+ });
91
+ } else if (thickEnd <= start) {
92
+ // right-side UTR
93
+ var _prime3 = feature.get('strand') > 0 ? 'three' : 'five';
94
+
95
+ newChildren.push({
96
+ type: "".concat(_prime3, "_prime_UTR"),
97
+ start: start,
98
+ end: end
99
+ });
100
+ }
101
+ }); // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
+
103
+ var newData = {};
104
+ feature.tags().forEach(function (tag) {
105
+ newData[tag] = feature.get(tag);
106
+ });
107
+ newData.subfeatures = newChildren;
108
+ newData.type = 'mRNA';
109
+ newData.uniqueId = feature.id();
110
+ delete newData.chromStarts;
111
+ delete newData.chromStart;
112
+ delete newData.chromEnd;
113
+ delete newData.chrom;
114
+ delete newData.blockStarts;
115
+ delete newData.blockSizes;
116
+ delete newData.blockCount;
117
+ delete newData.thickStart;
118
+ delete newData.thickEnd;
119
+ var newFeature = new _simpleFeature["default"]({
120
+ data: newData,
121
+ id: feature.id()
122
+ });
123
+ return newFeature;
124
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-bed",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "description": "JBrowse 2 bed adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -18,15 +18,12 @@
18
18
  "distMain": "dist/index.js",
19
19
  "srcMain": "src/index.ts",
20
20
  "main": "dist/index.js",
21
- "distModule": "dist/plugin-bed.esm.js",
22
- "module": "dist/plugin-bed.esm.js",
23
21
  "files": [
24
22
  "dist",
25
23
  "src"
26
24
  ],
27
25
  "scripts": {
28
- "start": "tsdx watch --verbose --noClean",
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/bed",
31
28
  "prepublishOnly": "yarn test",
32
29
  "prepack": "yarn build; yarn useDist",
@@ -47,5 +44,5 @@
47
44
  "publishConfig": {
48
45
  "access": "public"
49
46
  },
50
- "gitHead": "f6c3d4edfadc26f7ac635a2fa7259f50f0c7e5e3"
47
+ "gitHead": "cc13844074d11881d211342a6a7eea113561b70b"
51
48
  }