@jbrowse/img 1.7.7 → 1.7.10

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/README.md CHANGED
@@ -10,7 +10,7 @@ You don't need to have JBrowse 2 installed to use this tool. The tool can genera
10
10
 
11
11
  ## Screenshot
12
12
 
13
- ![](img/1.png)
13
+ ![](https://raw.githubusercontent.com/GMOD/jbrowse-components/main/products/jbrowse-img/img/1.png)
14
14
 
15
15
  More examples [EXAMPLES.md](EXAMPLES.md)
16
16
 
@@ -51,14 +51,21 @@ jb2export --fasta yourfile.fa --bam yourfile.bam --loc chr1:1,000,000-1,001,000
51
51
 
52
52
  If `--out` is not specified it writes to out.svg
53
53
 
54
- ### Generate PDF of PNG instead of SVG
54
+ ### Generate PNG instead of SVG
55
55
 
56
- If a filename with a `pdf` or `png` extension is supplied to `--out` then the
57
- tool tries to convert from svg to pdf/png using rsvg-convert (you will need to
58
- install rsvg-convert to your system e.g. with `sudo apt install librsvg2-bin`)
56
+ Supply a file with the png extension to `--out`, uses rsvg-convert so you will
57
+ need to install rsvg-convert to your system e.g. with `sudo apt install librsvg2-bin`
59
58
 
60
59
  ```
61
60
  jb2export --fasta yourfile.fa --bam yourfile.bam --loc chr1:1,000,000-1,001,000 --out file.png
61
+ ```
62
+
63
+ ### Generate PDF instead of SVG
64
+
65
+ Supply a file with the pdf extension to `--out`, uses rsvg-convert so you will
66
+ need to install rsvg-convert to your system e.g. with `sudo apt install librsvg2-bin`
67
+
68
+ ```
62
69
  jb2export --fasta yourfile.fa --bam yourfile.bam --loc chr1:1,000,000-1,001,000 --out file.pdf
63
70
  ```
64
71
 
@@ -66,7 +73,7 @@ jb2export --fasta yourfile.fa --bam yourfile.bam --loc chr1:1,000,000-1,001,000
66
73
 
67
74
  This example shows using remote files, e.g. with human hg19 and several tracks
68
75
 
69
- Note the use of --aliases to smooth over refname differences e.g. fasta
76
+ Note the use of --aliases, which smoothes over refname differences e.g. fasta
70
77
  contains 1 for chr1, and bigbed contains chr1, gff contains NC_000001.10
71
78
 
72
79
  ```
package/dist/index.js CHANGED
@@ -24,11 +24,16 @@ var _child_process = require("child_process");
24
24
 
25
25
  var _nodeFetch = _interopRequireWildcard(require("node-fetch"));
26
26
 
27
+ var _jsdom = require("jsdom");
28
+
27
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
30
 
29
31
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
32
 
31
33
  /* eslint-disable no-console */
34
+ var document = new _jsdom.JSDOM("...").window.document;
35
+ global.document = document;
36
+
32
37
  if (!global.fetch) {
33
38
  global.fetch = _nodeFetch.default;
34
39
  global.Headers = _nodeFetch.Headers;
@@ -10,6 +10,13 @@ var _renderRegion = require("./renderRegion");
10
10
 
11
11
  var _fs = _interopRequireDefault(require("fs"));
12
12
 
13
+ var _jsdom = require("jsdom");
14
+
15
+ require("abortcontroller-polyfill/dist/abortcontroller-polyfill-only");
16
+
17
+ var document = new _jsdom.JSDOM("...").window.document;
18
+ global.document = document;
19
+
13
20
  function hashCode(str) {
14
21
  var hash = 0;
15
22
  var chr;
@@ -84,20 +91,24 @@ xtest('renders a region with --session, --tracks, and --assembly args', /*#__PUR
84
91
  }, _callee2);
85
92
  })), timeout);
86
93
  test('renders volvox with variety of args', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
87
- var result;
94
+ var fp, result;
88
95
  return _regenerator.default.wrap(function _callee3$(_context3) {
89
96
  while (1) {
90
97
  switch (_context3.prev = _context3.next) {
91
98
  case 0:
99
+ fp = function fp(f) {
100
+ return require.resolve('../data/volvox/' + f);
101
+ };
102
+
92
103
  console.error = jest.fn();
93
- _context3.next = 3;
104
+ _context3.next = 4;
94
105
  return (0, _renderRegion.renderRegion)({
95
- fasta: require.resolve('../data/volvox/volvox.fa'),
96
- trackList: [['bam', [require.resolve('../data/volvox/volvox-sorted.bam')]], ['cram', [require.resolve('../data/volvox/volvox-sorted.cram')]], ['bigwig', [require.resolve('../data/volvox/volvox-sorted.bam.coverage.bw')]], ['vcfgz', [require.resolve('../data/volvox/volvox.filtered.vcf.gz')]], ['gffgz', [require.resolve('../data/volvox/volvox.sort.gff3.gz')]], ['bigbed', [require.resolve('../data/volvox/volvox.bb')]], ['bedgz', [require.resolve('../data/volvox/volvox-bed12.bed.gz')]]],
106
+ fasta: fp('volvox.fa'),
107
+ trackList: [['bam', [fp('volvox-sorted.bam')]], ['cram', [fp('volvox-sorted.cram')]], ['bigwig', [fp('volvox-sorted.bam.coverage.bw')]], ['vcfgz', [fp('volvox.filtered.vcf.gz')]], ['gffgz', [fp('volvox.sort.gff3.gz')]], ['bigbed', [fp('volvox.bb')]], ['bedgz', [fp('volvox-bed12.bed.gz')]]],
97
108
  loc: 'ctgA:1000-2000'
98
109
  });
99
110
 
100
- case 3:
111
+ case 4:
101
112
  result = _context3.sent;
102
113
 
103
114
  // can't do a snapshot test here, slightly inconsistent results(?)
@@ -105,21 +116,55 @@ test('renders volvox with variety of args', /*#__PURE__*/(0, _asyncToGenerator2.
105
116
 
106
117
  expect(result).toBeTruthy();
107
118
 
108
- case 6:
119
+ case 7:
109
120
  case "end":
110
121
  return _context3.stop();
111
122
  }
112
123
  }
113
124
  }, _callee3);
125
+ })), timeout);
126
+ test('renders volvox with variety of args (noRasterize)', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
127
+ var fp, result;
128
+ return _regenerator.default.wrap(function _callee4$(_context4) {
129
+ while (1) {
130
+ switch (_context4.prev = _context4.next) {
131
+ case 0:
132
+ fp = function fp(f) {
133
+ return require.resolve('../data/volvox/' + f);
134
+ };
135
+
136
+ console.error = jest.fn();
137
+ _context4.next = 4;
138
+ return (0, _renderRegion.renderRegion)({
139
+ fasta: fp('volvox.fa'),
140
+ trackList: [['bam', [fp('volvox-sorted.bam')]], ['cram', [fp('volvox-sorted.cram')]], ['bigwig', [fp('volvox-sorted.bam.coverage.bw')]], ['vcfgz', [fp('volvox.filtered.vcf.gz')]], ['gffgz', [fp('volvox.sort.gff3.gz')]], ['bigbed', [fp('volvox.bb')]], ['bedgz', [fp('volvox-bed12.bed.gz')]]],
141
+ loc: 'ctgA:1000-2000',
142
+ noRasterize: true
143
+ });
144
+
145
+ case 4:
146
+ result = _context4.sent;
147
+
148
+ // can't do a snapshot test here, slightly inconsistent results(?)
149
+ _fs.default.writeFileSync(require.resolve('../test/svg_from_volvox_fasta_and_bam_norasterize.svg'), result);
150
+
151
+ expect(result).toBeTruthy();
152
+
153
+ case 7:
154
+ case "end":
155
+ return _context4.stop();
156
+ }
157
+ }
158
+ }, _callee4);
114
159
  })), timeout); // commented out for using remote files currently
115
160
 
116
- xtest('configtracks arg with urls', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
161
+ xtest('configtracks arg with urls', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
117
162
  var result;
118
- return _regenerator.default.wrap(function _callee4$(_context4) {
163
+ return _regenerator.default.wrap(function _callee5$(_context5) {
119
164
  while (1) {
120
- switch (_context4.prev = _context4.next) {
165
+ switch (_context5.prev = _context5.next) {
121
166
  case 0:
122
- _context4.next = 2;
167
+ _context5.next = 2;
123
168
  return (0, _renderRegion.renderRegion)({
124
169
  config: 'data/config.json',
125
170
  trackList: [['configtracks', ['ncbi_refseq_109_hg38']]],
@@ -128,7 +173,7 @@ xtest('configtracks arg with urls', /*#__PURE__*/(0, _asyncToGenerator2.default)
128
173
  });
129
174
 
130
175
  case 2:
131
- result = _context4.sent;
176
+ result = _context5.sent;
132
177
 
133
178
  // can't do a snapshot test here, slightly inconsistent results(?)
134
179
  _fs.default.writeFileSync('svg_configtracks_simple.svg', result);
@@ -137,18 +182,18 @@ xtest('configtracks arg with urls', /*#__PURE__*/(0, _asyncToGenerator2.default)
137
182
 
138
183
  case 5:
139
184
  case "end":
140
- return _context4.stop();
185
+ return _context5.stop();
141
186
  }
142
187
  }
143
- }, _callee4);
188
+ }, _callee5);
144
189
  })), timeout * 3);
145
- test('configtracks arg with local files', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
190
+ test('configtracks arg with local files', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
146
191
  var result;
147
- return _regenerator.default.wrap(function _callee5$(_context5) {
192
+ return _regenerator.default.wrap(function _callee6$(_context6) {
148
193
  while (1) {
149
- switch (_context5.prev = _context5.next) {
194
+ switch (_context6.prev = _context6.next) {
150
195
  case 0:
151
- _context5.next = 2;
196
+ _context6.next = 2;
152
197
  return (0, _renderRegion.renderRegion)({
153
198
  config: require.resolve('../data/volvox/config.json'),
154
199
  trackList: [['configtracks', ['volvox_sv']]],
@@ -157,7 +202,7 @@ test('configtracks arg with local files', /*#__PURE__*/(0, _asyncToGenerator2.de
157
202
  });
158
203
 
159
204
  case 2:
160
- result = _context5.sent;
205
+ result = _context6.sent;
161
206
 
162
207
  // can't do a snapshot test here, slightly inconsistent results(?)
163
208
  _fs.default.writeFileSync(require.resolve('../test/svg_configtracks_local.svg'), result);
@@ -166,18 +211,18 @@ test('configtracks arg with local files', /*#__PURE__*/(0, _asyncToGenerator2.de
166
211
 
167
212
  case 5:
168
213
  case "end":
169
- return _context5.stop();
214
+ return _context6.stop();
170
215
  }
171
216
  }
172
- }, _callee5);
217
+ }, _callee6);
173
218
  })), timeout * 3);
174
- xtest('renders --hic', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
219
+ xtest('renders --hic', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
175
220
  var result;
176
- return _regenerator.default.wrap(function _callee6$(_context6) {
221
+ return _regenerator.default.wrap(function _callee7$(_context7) {
177
222
  while (1) {
178
- switch (_context6.prev = _context6.next) {
223
+ switch (_context7.prev = _context7.next) {
179
224
  case 0:
180
- _context6.next = 2;
225
+ _context7.next = 2;
181
226
  return (0, _renderRegion.renderRegion)({
182
227
  fasta: 'https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz',
183
228
  trackList: [['hic', ['https://s3.amazonaws.com/igv.broadinstitute.org/data/hic/intra_nofrag_30.hic']]],
@@ -185,7 +230,7 @@ xtest('renders --hic', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__
185
230
  });
186
231
 
187
232
  case 2:
188
- result = _context6.sent;
233
+ result = _context7.sent;
189
234
 
190
235
  _fs.default.writeFileSync(require.resolve('../test/svg_from_human_hic.svg'), result);
191
236
 
@@ -193,8 +238,8 @@ xtest('renders --hic', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__
193
238
 
194
239
  case 5:
195
240
  case "end":
196
- return _context6.stop();
241
+ return _context7.stop();
197
242
  }
198
243
  }
199
- }, _callee6);
244
+ }, _callee7);
200
245
  })), 20000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/img",
3
- "version": "1.7.7",
3
+ "version": "1.7.10",
4
4
  "main": "index.js",
5
5
  "author": "JBrowse Team",
6
6
  "license": "Apache-2.0",
@@ -29,9 +29,10 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.17.9",
32
- "@jbrowse/plugin-linear-genome-view": "^1.7.7",
33
- "@jbrowse/react-linear-genome-view": "^1.7.7",
32
+ "@jbrowse/plugin-linear-genome-view": "^1.7.10",
33
+ "@jbrowse/react-linear-genome-view": "^1.7.10",
34
34
  "abortcontroller-polyfill": "^1.7.3",
35
+ "jsdom": "^19.0.0",
35
36
  "mobx": "^5.10.1",
36
37
  "node-fetch": "^2.6.7",
37
38
  "react": "^17.0.1",
@@ -42,5 +43,5 @@
42
43
  "publishConfig": {
43
44
  "access": "public"
44
45
  },
45
- "gitHead": "2c26e04ae942c380bf2f5b79ef7a49cc32b7bfed"
46
+ "gitHead": "02d8c1e88e5603ea5855faed4ccb814e28071b32"
46
47
  }