@jbrowse/plugin-comparative-adapters 3.3.0 → 3.5.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.
Files changed (33) hide show
  1. package/dist/BlastTabularAdapter/BlastTabularAdapter.d.ts +0 -1
  2. package/dist/BlastTabularAdapter/BlastTabularAdapter.js +1 -4
  3. package/dist/ChainAdapter/ChainAdapter.js +1 -3
  4. package/dist/ChainAdapter/util.js +10 -5
  5. package/dist/DeltaAdapter/DeltaAdapter.js +1 -3
  6. package/dist/DeltaAdapter/util.js +4 -1
  7. package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +0 -1
  8. package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +2 -2
  9. package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +0 -1
  10. package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +2 -2
  11. package/dist/MashMapAdapter/MashMapAdapter.js +1 -3
  12. package/dist/PAFAdapter/PAFAdapter.d.ts +0 -1
  13. package/dist/PAFAdapter/PAFAdapter.js +1 -5
  14. package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +0 -1
  15. package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +0 -1
  16. package/dist/util.js +4 -1
  17. package/esm/BlastTabularAdapter/BlastTabularAdapter.d.ts +0 -1
  18. package/esm/BlastTabularAdapter/BlastTabularAdapter.js +1 -4
  19. package/esm/ChainAdapter/ChainAdapter.js +1 -3
  20. package/esm/ChainAdapter/util.js +10 -5
  21. package/esm/DeltaAdapter/DeltaAdapter.js +1 -3
  22. package/esm/DeltaAdapter/util.js +4 -1
  23. package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +0 -1
  24. package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +3 -3
  25. package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +0 -1
  26. package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +3 -3
  27. package/esm/MashMapAdapter/MashMapAdapter.js +1 -3
  28. package/esm/PAFAdapter/PAFAdapter.d.ts +0 -1
  29. package/esm/PAFAdapter/PAFAdapter.js +1 -5
  30. package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +0 -1
  31. package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +0 -1
  32. package/esm/util.js +4 -1
  33. package/package.json +8 -8
@@ -61,6 +61,5 @@ export default class BlastTabularAdapter extends BaseFeatureDataAdapter {
61
61
  getAssemblyNames(): string[];
62
62
  getRefNames(opts?: BaseOptions): Promise<string[]>;
63
63
  getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
64
- freeResources(): void;
65
64
  }
66
65
  export {};
@@ -84,10 +84,8 @@ class BlastTabularAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
84
84
  return this.data;
85
85
  }
86
86
  async setup(opts) {
87
- const pm = this.pluginManager;
88
- const buf = await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)((0, configuration_1.readConfObject)(this.config, 'blastTableLocation'), pm), opts);
89
87
  const columns = (0, configuration_1.readConfObject)(this.config, 'columns');
90
- return (0, util_2.parseLineByLine)(buf, createBlastLineParser(columns), opts);
88
+ return (0, util_2.parseLineByLine)(await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)((0, configuration_1.readConfObject)(this.config, 'blastTableLocation'), this.pluginManager), opts), createBlastLineParser(columns), opts);
91
89
  }
92
90
  async hasDataForRefName() {
93
91
  return true;
@@ -194,7 +192,6 @@ class BlastTabularAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
194
192
  observer.complete();
195
193
  });
196
194
  }
197
- freeResources() { }
198
195
  }
199
196
  BlastTabularAdapter.capabilities = ['getFeatures', 'getRefNames'];
200
197
  exports.default = BlastTabularAdapter;
@@ -9,9 +9,7 @@ const util_2 = require("./util");
9
9
  const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
10
10
  class ChainAdapter extends PAFAdapter_1.default {
11
11
  async setupPre(opts) {
12
- const loc = (0, io_1.openLocation)(this.getConf('chainLocation'), this.pluginManager);
13
- const buf = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
14
- return (0, util_2.paf_chain2paf)(buf);
12
+ return (0, util_2.paf_chain2paf)(await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)(this.getConf('chainLocation'), this.pluginManager), opts), opts);
15
13
  }
16
14
  }
17
15
  exports.default = ChainAdapter;
@@ -32,22 +32,26 @@ function paf_chain2paf(buffer, opts) {
32
32
  let num_matches = 0;
33
33
  let cigar = '';
34
34
  const records = [];
35
- let i = 0;
36
35
  let blockStart = 0;
37
36
  const decoder = new TextDecoder('utf8');
37
+ let s = performance.now();
38
+ let i = 0;
38
39
  while (blockStart < buffer.length) {
39
- if (i++ % 10000 === 0) {
40
+ if (i++ % 10000 === 0 && performance.now() - s > 50) {
40
41
  statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
42
+ s = performance.now();
41
43
  }
42
44
  const n = buffer.indexOf(10, blockStart);
43
45
  if (n === -1) {
44
46
  break;
45
47
  }
46
48
  const b = buffer.subarray(blockStart, n);
47
- const l = decoder.decode(b).trim();
49
+ const line = decoder.decode(b).trim();
48
50
  blockStart = n + 1;
49
- const l_tab = l.replaceAll(' ', '\t');
50
- const l_vec = l_tab.split('\t');
51
+ if (!line || line.startsWith('#')) {
52
+ continue;
53
+ }
54
+ const l_vec = line.split(/[ \t]+/);
51
55
  if (l_vec[0] === 'chain') {
52
56
  if (cigar) {
53
57
  records.push(generate_record(q_name, q_start, q_end, q_strand, t_name, t_start, t_end, cigar, num_matches));
@@ -87,5 +91,6 @@ function paf_chain2paf(buffer, opts) {
87
91
  if (cigar) {
88
92
  generate_record(q_name, q_start, q_end, q_strand, t_name, t_start, t_end, cigar, num_matches);
89
93
  }
94
+ statusCallback('');
90
95
  return records;
91
96
  }
@@ -9,9 +9,7 @@ const util_2 = require("./util");
9
9
  const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
10
10
  class DeltaAdapter extends PAFAdapter_1.default {
11
11
  async setupPre(opts) {
12
- const loc = (0, io_1.openLocation)(this.getConf('deltaLocation'), this.pluginManager);
13
- const buf = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
14
- return (0, util_2.paf_delta2paf)(buf);
12
+ return (0, util_2.paf_delta2paf)(await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)(this.getConf('deltaLocation'), this.pluginManager), opts), opts);
15
13
  }
16
14
  }
17
15
  exports.default = DeltaAdapter;
@@ -22,9 +22,11 @@ function paf_delta2paf(buffer, opts) {
22
22
  let i = 0;
23
23
  let j = 0;
24
24
  const decoder = new TextDecoder('utf8');
25
+ let s = performance.now();
25
26
  while (blockStart < buffer.length) {
26
- if (j++ % 10000 === 0) {
27
+ if (j++ % 10000 === 0 && performance.now() - s > 50) {
27
28
  statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
29
+ s = performance.now();
28
30
  }
29
31
  const n = buffer.indexOf(10, blockStart);
30
32
  if (n === -1) {
@@ -123,5 +125,6 @@ function paf_delta2paf(buffer, opts) {
123
125
  }
124
126
  }
125
127
  }
128
+ statusCallback('');
126
129
  return records;
127
130
  }
@@ -25,6 +25,5 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
25
25
  getAssemblyNames(): string[];
26
26
  getRefNames(opts?: BaseOptions): Promise<string[]>;
27
27
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
28
- freeResources(): void;
29
28
  }
30
29
  export {};
@@ -16,12 +16,13 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
16
16
  return this.setupP;
17
17
  }
18
18
  async setupPre(opts) {
19
+ const { statusCallback = () => { } } = opts;
19
20
  const assemblyNames = this.getConf('assemblyNames');
20
21
  const pm = this.pluginManager;
21
22
  const bed1 = (0, io_1.openLocation)(this.getConf('bed1Location'), pm);
22
23
  const bed2 = (0, io_1.openLocation)(this.getConf('bed2Location'), pm);
23
24
  const mcscan = (0, io_1.openLocation)(this.getConf('mcscanAnchorsLocation'), pm);
24
- const [bed1text, bed2text, mcscantext] = await Promise.all([bed1, bed2, mcscan].map(r => (0, util_2.readFile)(r, opts)));
25
+ const [bed1text, bed2text, mcscantext] = await (0, util_1.updateStatus)('Downloading data', statusCallback, () => Promise.all([bed1, bed2, mcscan].map(r => (0, util_2.readFile)(r, opts))));
25
26
  const bed1Map = (0, util_2.parseBed)(bed1text);
26
27
  const bed2Map = (0, util_2.parseBed)(bed2text);
27
28
  const feats = mcscantext
@@ -92,7 +93,6 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
92
93
  observer.complete();
93
94
  });
94
95
  }
95
- freeResources() { }
96
96
  }
97
97
  MCScanAnchorsAdapter.capabilities = ['getFeatures', 'getRefNames'];
98
98
  exports.default = MCScanAnchorsAdapter;
@@ -33,6 +33,5 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
33
33
  getAssemblyNames(): string[];
34
34
  getRefNames(opts?: BaseOptions): Promise<string[]>;
35
35
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
36
- freeResources(): void;
37
36
  }
38
37
  export {};
@@ -20,12 +20,13 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
20
20
  return this.setupP;
21
21
  }
22
22
  async setupPre(opts) {
23
+ const { statusCallback = () => { } } = opts;
23
24
  const assemblyNames = this.getConf('assemblyNames');
24
25
  const pm = this.pluginManager;
25
26
  const bed1 = (0, io_1.openLocation)(this.getConf('bed1Location'), pm);
26
27
  const bed2 = (0, io_1.openLocation)(this.getConf('bed2Location'), pm);
27
28
  const mcscan = (0, io_1.openLocation)(this.getConf('mcscanSimpleAnchorsLocation'), pm);
28
- const [bed1text, bed2text, mcscantext] = await Promise.all([bed1, bed2, mcscan].map(r => (0, util_2.readFile)(r, opts)));
29
+ const [bed1text, bed2text, mcscantext] = await (0, util_1.updateStatus)('Downloading data', statusCallback, () => Promise.all([bed1, bed2, mcscan].map(r => (0, util_2.readFile)(r, opts))));
29
30
  const bed1Map = (0, util_2.parseBed)(bed1text);
30
31
  const bed2Map = (0, util_2.parseBed)(bed2text);
31
32
  const feats = mcscantext
@@ -126,7 +127,6 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
126
127
  observer.complete();
127
128
  });
128
129
  }
129
- freeResources() { }
130
130
  }
131
131
  MCScanAnchorsAdapter.capabilities = ['getFeatures', 'getRefNames'];
132
132
  exports.default = MCScanAnchorsAdapter;
@@ -9,9 +9,7 @@ const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
9
9
  const util_2 = require("../util");
10
10
  class MashMapAdapter extends PAFAdapter_1.default {
11
11
  async setupPre(opts) {
12
- const outLoc = (0, io_1.openLocation)(this.getConf('outLocation'), this.pluginManager);
13
- const buf = await (0, util_1.fetchAndMaybeUnzip)(outLoc, opts);
14
- return (0, util_2.parseLineByLine)(buf, parseMashMapLine, opts);
12
+ return (0, util_2.parseLineByLine)(await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)(this.getConf('outLocation'), this.pluginManager), opts), parseMashMapLine, opts);
15
13
  }
16
14
  }
17
15
  exports.default = MashMapAdapter;
@@ -16,6 +16,5 @@ export default class PAFAdapter extends BaseFeatureDataAdapter {
16
16
  getAssemblyNames(): string[];
17
17
  getRefNames(opts?: BaseOptions): Promise<string[]>;
18
18
  getFeatures(query: Region, opts?: PAFOptions): import("rxjs").Observable<Feature>;
19
- freeResources(): void;
20
19
  }
21
20
  export {};
@@ -25,10 +25,7 @@ class PAFAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
25
25
  return this.setupP;
26
26
  }
27
27
  async setupPre(opts) {
28
- const pm = this.pluginManager;
29
- const pafLocation = (0, io_1.openLocation)(this.getConf('pafLocation'), pm);
30
- const buf = await (0, util_1.fetchAndMaybeUnzip)(pafLocation, opts);
31
- return (0, util_2.parseLineByLine)(buf, util_2.parsePAFLine, opts);
28
+ return (0, util_2.parseLineByLine)(await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)(this.getConf('pafLocation'), this.pluginManager), opts), util_2.parsePAFLine, opts);
32
29
  }
33
30
  async hasDataForRefName() {
34
31
  return true;
@@ -134,7 +131,6 @@ class PAFAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
134
131
  observer.complete();
135
132
  });
136
133
  }
137
- freeResources() { }
138
134
  }
139
135
  PAFAdapter.capabilities = ['getFeatures', 'getRefNames'];
140
136
  exports.default = PAFAdapter;
@@ -20,6 +20,5 @@ export default class PAFAdapter extends BaseFeatureDataAdapter {
20
20
  regions?: Region[];
21
21
  }): Promise<string[]>;
22
22
  getFeatures(query: Region, opts?: PAFOptions): import("rxjs").Observable<Feature>;
23
- freeResources(): void;
24
23
  }
25
24
  export {};
@@ -104,7 +104,6 @@ class PAFAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
104
104
  observer.complete();
105
105
  });
106
106
  }
107
- freeResources() { }
108
107
  }
109
108
  PAFAdapter.capabilities = ['getFeatures', 'getRefNames'];
110
109
  exports.default = PAFAdapter;
package/dist/util.js CHANGED
@@ -39,6 +39,7 @@ function parseLineByLine(buffer, cb, opts) {
39
39
  const entries = [];
40
40
  const decoder = new TextDecoder('utf8');
41
41
  let i = 0;
42
+ let s = performance.now();
42
43
  while (blockStart < buffer.length) {
43
44
  const n = buffer.indexOf(10, blockStart);
44
45
  if (n === -1) {
@@ -52,11 +53,13 @@ function parseLineByLine(buffer, cb, opts) {
52
53
  entries.push(entry);
53
54
  }
54
55
  }
55
- if (i++ % 10000 === 0) {
56
+ if (i++ % 10000 === 0 && performance.now() - s > 50) {
56
57
  statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
58
+ s = performance.now();
57
59
  }
58
60
  blockStart = n + 1;
59
61
  }
62
+ statusCallback('');
60
63
  return entries;
61
64
  }
62
65
  function parsePAFLine(line) {
@@ -61,6 +61,5 @@ export default class BlastTabularAdapter extends BaseFeatureDataAdapter {
61
61
  getAssemblyNames(): string[];
62
62
  getRefNames(opts?: BaseOptions): Promise<string[]>;
63
63
  getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
64
- freeResources(): void;
65
64
  }
66
65
  export {};
@@ -79,10 +79,8 @@ class BlastTabularAdapter extends BaseFeatureDataAdapter {
79
79
  return this.data;
80
80
  }
81
81
  async setup(opts) {
82
- const pm = this.pluginManager;
83
- const buf = await fetchAndMaybeUnzip(openLocation(readConfObject(this.config, 'blastTableLocation'), pm), opts);
84
82
  const columns = readConfObject(this.config, 'columns');
85
- return parseLineByLine(buf, createBlastLineParser(columns), opts);
83
+ return parseLineByLine(await fetchAndMaybeUnzip(openLocation(readConfObject(this.config, 'blastTableLocation'), this.pluginManager), opts), createBlastLineParser(columns), opts);
86
84
  }
87
85
  async hasDataForRefName() {
88
86
  return true;
@@ -189,7 +187,6 @@ class BlastTabularAdapter extends BaseFeatureDataAdapter {
189
187
  observer.complete();
190
188
  });
191
189
  }
192
- freeResources() { }
193
190
  }
194
191
  BlastTabularAdapter.capabilities = ['getFeatures', 'getRefNames'];
195
192
  export default BlastTabularAdapter;
@@ -4,8 +4,6 @@ import { paf_chain2paf } from './util';
4
4
  import PAFAdapter from '../PAFAdapter/PAFAdapter';
5
5
  export default class ChainAdapter extends PAFAdapter {
6
6
  async setupPre(opts) {
7
- const loc = openLocation(this.getConf('chainLocation'), this.pluginManager);
8
- const buf = await fetchAndMaybeUnzip(loc, opts);
9
- return paf_chain2paf(buf);
7
+ return paf_chain2paf(await fetchAndMaybeUnzip(openLocation(this.getConf('chainLocation'), this.pluginManager), opts), opts);
10
8
  }
11
9
  }
@@ -29,22 +29,26 @@ export function paf_chain2paf(buffer, opts) {
29
29
  let num_matches = 0;
30
30
  let cigar = '';
31
31
  const records = [];
32
- let i = 0;
33
32
  let blockStart = 0;
34
33
  const decoder = new TextDecoder('utf8');
34
+ let s = performance.now();
35
+ let i = 0;
35
36
  while (blockStart < buffer.length) {
36
- if (i++ % 10000 === 0) {
37
+ if (i++ % 10000 === 0 && performance.now() - s > 50) {
37
38
  statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
39
+ s = performance.now();
38
40
  }
39
41
  const n = buffer.indexOf(10, blockStart);
40
42
  if (n === -1) {
41
43
  break;
42
44
  }
43
45
  const b = buffer.subarray(blockStart, n);
44
- const l = decoder.decode(b).trim();
46
+ const line = decoder.decode(b).trim();
45
47
  blockStart = n + 1;
46
- const l_tab = l.replaceAll(' ', '\t');
47
- const l_vec = l_tab.split('\t');
48
+ if (!line || line.startsWith('#')) {
49
+ continue;
50
+ }
51
+ const l_vec = line.split(/[ \t]+/);
48
52
  if (l_vec[0] === 'chain') {
49
53
  if (cigar) {
50
54
  records.push(generate_record(q_name, q_start, q_end, q_strand, t_name, t_start, t_end, cigar, num_matches));
@@ -84,5 +88,6 @@ export function paf_chain2paf(buffer, opts) {
84
88
  if (cigar) {
85
89
  generate_record(q_name, q_start, q_end, q_strand, t_name, t_start, t_end, cigar, num_matches);
86
90
  }
91
+ statusCallback('');
87
92
  return records;
88
93
  }
@@ -4,8 +4,6 @@ import { paf_delta2paf } from './util';
4
4
  import PAFAdapter from '../PAFAdapter/PAFAdapter';
5
5
  export default class DeltaAdapter extends PAFAdapter {
6
6
  async setupPre(opts) {
7
- const loc = openLocation(this.getConf('deltaLocation'), this.pluginManager);
8
- const buf = await fetchAndMaybeUnzip(loc, opts);
9
- return paf_delta2paf(buf);
7
+ return paf_delta2paf(await fetchAndMaybeUnzip(openLocation(this.getConf('deltaLocation'), this.pluginManager), opts), opts);
10
8
  }
11
9
  }
@@ -19,9 +19,11 @@ export function paf_delta2paf(buffer, opts) {
19
19
  let i = 0;
20
20
  let j = 0;
21
21
  const decoder = new TextDecoder('utf8');
22
+ let s = performance.now();
22
23
  while (blockStart < buffer.length) {
23
- if (j++ % 10000 === 0) {
24
+ if (j++ % 10000 === 0 && performance.now() - s > 50) {
24
25
  statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
26
+ s = performance.now();
25
27
  }
26
28
  const n = buffer.indexOf(10, blockStart);
27
29
  if (n === -1) {
@@ -120,5 +122,6 @@ export function paf_delta2paf(buffer, opts) {
120
122
  }
121
123
  }
122
124
  }
125
+ statusCallback('');
123
126
  return records;
124
127
  }
@@ -25,6 +25,5 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
25
25
  getAssemblyNames(): string[];
26
26
  getRefNames(opts?: BaseOptions): Promise<string[]>;
27
27
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
28
- freeResources(): void;
29
28
  }
30
29
  export {};
@@ -1,5 +1,5 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { SimpleFeature, doesIntersect2 } from '@jbrowse/core/util';
2
+ import { SimpleFeature, doesIntersect2, updateStatus } from '@jbrowse/core/util';
3
3
  import { openLocation } from '@jbrowse/core/util/io';
4
4
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
5
5
  import { parseBed, readFile } from '../util';
@@ -14,12 +14,13 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
14
14
  return this.setupP;
15
15
  }
16
16
  async setupPre(opts) {
17
+ const { statusCallback = () => { } } = opts;
17
18
  const assemblyNames = this.getConf('assemblyNames');
18
19
  const pm = this.pluginManager;
19
20
  const bed1 = openLocation(this.getConf('bed1Location'), pm);
20
21
  const bed2 = openLocation(this.getConf('bed2Location'), pm);
21
22
  const mcscan = openLocation(this.getConf('mcscanAnchorsLocation'), pm);
22
- const [bed1text, bed2text, mcscantext] = await Promise.all([bed1, bed2, mcscan].map(r => readFile(r, opts)));
23
+ const [bed1text, bed2text, mcscantext] = await updateStatus('Downloading data', statusCallback, () => Promise.all([bed1, bed2, mcscan].map(r => readFile(r, opts))));
23
24
  const bed1Map = parseBed(bed1text);
24
25
  const bed2Map = parseBed(bed2text);
25
26
  const feats = mcscantext
@@ -90,7 +91,6 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
90
91
  observer.complete();
91
92
  });
92
93
  }
93
- freeResources() { }
94
94
  }
95
95
  MCScanAnchorsAdapter.capabilities = ['getFeatures', 'getRefNames'];
96
96
  export default MCScanAnchorsAdapter;
@@ -33,6 +33,5 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
33
33
  getAssemblyNames(): string[];
34
34
  getRefNames(opts?: BaseOptions): Promise<string[]>;
35
35
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
36
- freeResources(): void;
37
36
  }
38
37
  export {};
@@ -1,5 +1,5 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { doesIntersect2 } from '@jbrowse/core/util';
2
+ import { doesIntersect2, updateStatus } from '@jbrowse/core/util';
3
3
  import { openLocation } from '@jbrowse/core/util/io';
4
4
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
5
5
  import SimpleFeature from '@jbrowse/core/util/simpleFeature';
@@ -15,12 +15,13 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
15
15
  return this.setupP;
16
16
  }
17
17
  async setupPre(opts) {
18
+ const { statusCallback = () => { } } = opts;
18
19
  const assemblyNames = this.getConf('assemblyNames');
19
20
  const pm = this.pluginManager;
20
21
  const bed1 = openLocation(this.getConf('bed1Location'), pm);
21
22
  const bed2 = openLocation(this.getConf('bed2Location'), pm);
22
23
  const mcscan = openLocation(this.getConf('mcscanSimpleAnchorsLocation'), pm);
23
- const [bed1text, bed2text, mcscantext] = await Promise.all([bed1, bed2, mcscan].map(r => readFile(r, opts)));
24
+ const [bed1text, bed2text, mcscantext] = await updateStatus('Downloading data', statusCallback, () => Promise.all([bed1, bed2, mcscan].map(r => readFile(r, opts))));
24
25
  const bed1Map = parseBed(bed1text);
25
26
  const bed2Map = parseBed(bed2text);
26
27
  const feats = mcscantext
@@ -121,7 +122,6 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
121
122
  observer.complete();
122
123
  });
123
124
  }
124
- freeResources() { }
125
125
  }
126
126
  MCScanAnchorsAdapter.capabilities = ['getFeatures', 'getRefNames'];
127
127
  export default MCScanAnchorsAdapter;
@@ -4,9 +4,7 @@ import PAFAdapter from '../PAFAdapter/PAFAdapter';
4
4
  import { parseLineByLine } from '../util';
5
5
  export default class MashMapAdapter extends PAFAdapter {
6
6
  async setupPre(opts) {
7
- const outLoc = openLocation(this.getConf('outLocation'), this.pluginManager);
8
- const buf = await fetchAndMaybeUnzip(outLoc, opts);
9
- return parseLineByLine(buf, parseMashMapLine, opts);
7
+ return parseLineByLine(await fetchAndMaybeUnzip(openLocation(this.getConf('outLocation'), this.pluginManager), opts), parseMashMapLine, opts);
10
8
  }
11
9
  }
12
10
  function parseMashMapLine(line) {
@@ -16,6 +16,5 @@ export default class PAFAdapter extends BaseFeatureDataAdapter {
16
16
  getAssemblyNames(): string[];
17
17
  getRefNames(opts?: BaseOptions): Promise<string[]>;
18
18
  getFeatures(query: Region, opts?: PAFOptions): import("rxjs").Observable<Feature>;
19
- freeResources(): void;
20
19
  }
21
20
  export {};
@@ -20,10 +20,7 @@ class PAFAdapter extends BaseFeatureDataAdapter {
20
20
  return this.setupP;
21
21
  }
22
22
  async setupPre(opts) {
23
- const pm = this.pluginManager;
24
- const pafLocation = openLocation(this.getConf('pafLocation'), pm);
25
- const buf = await fetchAndMaybeUnzip(pafLocation, opts);
26
- return parseLineByLine(buf, parsePAFLine, opts);
23
+ return parseLineByLine(await fetchAndMaybeUnzip(openLocation(this.getConf('pafLocation'), this.pluginManager), opts), parsePAFLine, opts);
27
24
  }
28
25
  async hasDataForRefName() {
29
26
  return true;
@@ -129,7 +126,6 @@ class PAFAdapter extends BaseFeatureDataAdapter {
129
126
  observer.complete();
130
127
  });
131
128
  }
132
- freeResources() { }
133
129
  }
134
130
  PAFAdapter.capabilities = ['getFeatures', 'getRefNames'];
135
131
  export default PAFAdapter;
@@ -20,6 +20,5 @@ export default class PAFAdapter extends BaseFeatureDataAdapter {
20
20
  regions?: Region[];
21
21
  }): Promise<string[]>;
22
22
  getFeatures(query: Region, opts?: PAFOptions): import("rxjs").Observable<Feature>;
23
- freeResources(): void;
24
23
  }
25
24
  export {};
@@ -99,7 +99,6 @@ class PAFAdapter extends BaseFeatureDataAdapter {
99
99
  observer.complete();
100
100
  });
101
101
  }
102
- freeResources() { }
103
102
  }
104
103
  PAFAdapter.capabilities = ['getFeatures', 'getRefNames'];
105
104
  export default PAFAdapter;
package/esm/util.js CHANGED
@@ -30,6 +30,7 @@ export function parseLineByLine(buffer, cb, opts) {
30
30
  const entries = [];
31
31
  const decoder = new TextDecoder('utf8');
32
32
  let i = 0;
33
+ let s = performance.now();
33
34
  while (blockStart < buffer.length) {
34
35
  const n = buffer.indexOf(10, blockStart);
35
36
  if (n === -1) {
@@ -43,11 +44,13 @@ export function parseLineByLine(buffer, cb, opts) {
43
44
  entries.push(entry);
44
45
  }
45
46
  }
46
- if (i++ % 10000 === 0) {
47
+ if (i++ % 10000 === 0 && performance.now() - s > 50) {
47
48
  statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
49
+ s = performance.now();
48
50
  }
49
51
  blockStart = n + 1;
50
52
  }
53
+ statusCallback('');
51
54
  return entries;
52
55
  }
53
56
  export function parsePAFLine(line) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-comparative-adapters",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "description": "JBrowse 2 comparative adapters",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -36,13 +36,13 @@
36
36
  "clean": "rimraf dist esm *.tsbuildinfo"
37
37
  },
38
38
  "dependencies": {
39
- "@gmod/bgzf-filehandle": "^2.0.1",
40
- "@gmod/tabix": "^2.0.0",
41
- "@jbrowse/core": "^3.3.0",
42
- "@jbrowse/plugin-alignments": "^3.3.0",
43
- "@jbrowse/plugin-linear-genome-view": "^3.3.0",
39
+ "@gmod/bgzf-filehandle": "^4.0.0",
40
+ "@gmod/tabix": "^3.0.1",
41
+ "@jbrowse/core": "^3.5.0",
42
+ "@jbrowse/plugin-alignments": "^3.5.0",
43
+ "@jbrowse/plugin-linear-genome-view": "^3.5.0",
44
44
  "@mui/material": "^7.0.0",
45
- "generic-filehandle2": "^1.0.0",
45
+ "generic-filehandle2": "^2.0.1",
46
46
  "mobx": "^6.0.0",
47
47
  "mobx-react": "^9.0.0",
48
48
  "mobx-state-tree": "^5.0.0",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "0bb64d8cc7ecdd167515308b31eec3d9acbc59e4"
61
+ "gitHead": "8a8aa0aab2229dece106a5715a767e649e2fe92b"
62
62
  }