@jbrowse/plugin-comparative-adapters 3.0.5 → 3.2.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.
@@ -22,5 +22,18 @@ const ChainAdapter = (0, configuration_1.ConfigurationSchema)('ChainAdapter', {
22
22
  type: 'fileLocation',
23
23
  defaultValue: { uri: '/path/to/file.chain', locationType: 'UriLocation' },
24
24
  },
25
- }, { explicitlyTyped: true });
25
+ }, {
26
+ explicitlyTyped: true,
27
+ preProcessSnapshot: snap => {
28
+ return snap.uri
29
+ ? {
30
+ ...snap,
31
+ chainLocation: {
32
+ uri: snap.uri,
33
+ baseUri: snap.baseUri,
34
+ },
35
+ }
36
+ : snap;
37
+ },
38
+ });
26
39
  exports.default = ChainAdapter;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paf_chain2paf = paf_chain2paf;
4
+ const util_1 = require("@jbrowse/core/util");
4
5
  function generate_record(qname, qstart, qend, qstrand, tname, tstart, tend, cigar, numMatches) {
5
6
  return {
6
7
  qname,
@@ -36,7 +37,7 @@ function paf_chain2paf(buffer, opts) {
36
37
  const decoder = new TextDecoder('utf8');
37
38
  while (blockStart < buffer.length) {
38
39
  if (i++ % 10000 === 0) {
39
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
40
+ statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
40
41
  }
41
42
  const n = buffer.indexOf(10, blockStart);
42
43
  if (n === -1) {
@@ -25,5 +25,18 @@ const DeltaAdapter = (0, configuration_1.ConfigurationSchema)('DeltaAdapter', {
25
25
  locationType: 'UriLocation',
26
26
  },
27
27
  },
28
- }, { explicitlyTyped: true });
28
+ }, {
29
+ explicitlyTyped: true,
30
+ preProcessSnapshot: snap => {
31
+ return snap.uri
32
+ ? {
33
+ ...snap,
34
+ deltaLocation: {
35
+ uri: snap.uri,
36
+ baseUri: snap.baseUri,
37
+ },
38
+ }
39
+ : snap;
40
+ },
41
+ });
29
42
  exports.default = DeltaAdapter;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paf_delta2paf = paf_delta2paf;
4
+ const util_1 = require("@jbrowse/core/util");
4
5
  function paf_delta2paf(buffer, opts) {
5
6
  const { statusCallback = () => { } } = opts || {};
6
7
  let rname = '';
@@ -23,7 +24,7 @@ function paf_delta2paf(buffer, opts) {
23
24
  const decoder = new TextDecoder('utf8');
24
25
  while (blockStart < buffer.length) {
25
26
  if (j++ % 10000 === 0) {
26
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
27
+ statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
27
28
  }
28
29
  const n = buffer.indexOf(10, blockStart);
29
30
  if (n === -1) {
@@ -69,7 +69,7 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
69
69
  const index = assemblyNames.indexOf(region.assemblyName);
70
70
  if (index !== -1) {
71
71
  const flip = index === 0;
72
- feats.forEach(f => {
72
+ for (const f of feats) {
73
73
  const [r1, r2, score, rowNum] = f;
74
74
  const [f1, f2] = !flip ? [r2, r1] : [r1, r2];
75
75
  if (f1.refName === region.refName &&
@@ -87,7 +87,7 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
87
87
  },
88
88
  }));
89
89
  }
90
- });
90
+ }
91
91
  }
92
92
  observer.complete();
93
93
  });
@@ -28,5 +28,26 @@ const MCScanAnchorsAdapter = (0, configuration_1.ConfigurationSchema)('MCScanAnc
28
28
  type: 'stringArray',
29
29
  defaultValue: [],
30
30
  },
31
- }, { explicitlyTyped: true });
31
+ }, {
32
+ explicitlyTyped: true,
33
+ preProcessSnapshot: snap => {
34
+ return snap.uri && snap.bed1 && snap.bed2
35
+ ? {
36
+ ...snap,
37
+ mcscanAnchorsLocation: {
38
+ uri: snap.uri,
39
+ baseUri: snap.baseUri,
40
+ },
41
+ bed1Location: {
42
+ uri: snap.bed1,
43
+ baseUri: snap.baseUri,
44
+ },
45
+ bed2Location: {
46
+ uri: snap.bed2,
47
+ baseUri: snap.baseUri,
48
+ },
49
+ }
50
+ : snap;
51
+ },
52
+ });
32
53
  exports.default = MCScanAnchorsAdapter;
@@ -90,7 +90,7 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
90
90
  const index = assemblyNames.indexOf(region.assemblyName);
91
91
  if (index !== -1) {
92
92
  const flip = index === 0;
93
- feats.forEach(f => {
93
+ for (const f of feats) {
94
94
  const [f11, f12, f21, f22, score, strand, rowNum] = f;
95
95
  let r1 = {
96
96
  refName: f11.refName,
@@ -121,7 +121,7 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
121
121
  },
122
122
  }));
123
123
  }
124
- });
124
+ }
125
125
  }
126
126
  observer.complete();
127
127
  });
@@ -28,5 +28,26 @@ const MCScanSimpleAnchorsAdapter = (0, configuration_1.ConfigurationSchema)('MCS
28
28
  type: 'stringArray',
29
29
  defaultValue: [],
30
30
  },
31
- }, { explicitlyTyped: true });
31
+ }, {
32
+ explicitlyTyped: true,
33
+ preProcessSnapshot: snap => {
34
+ return snap.uri && snap.bed1 && snap.bed2
35
+ ? {
36
+ ...snap,
37
+ mcscanSimpleAnchorsLocation: {
38
+ uri: snap.uri,
39
+ baseUri: snap.baseUri,
40
+ },
41
+ bed1Location: {
42
+ uri: snap.bed1,
43
+ baseUri: snap.baseUri,
44
+ },
45
+ bed2Location: {
46
+ uri: snap.bed2,
47
+ baseUri: snap.baseUri,
48
+ },
49
+ }
50
+ : snap;
51
+ },
52
+ });
32
53
  exports.default = MCScanSimpleAnchorsAdapter;
@@ -25,5 +25,18 @@ const MashMapAdapter = (0, configuration_1.ConfigurationSchema)('MashMapAdapter'
25
25
  locationType: 'UriLocation',
26
26
  },
27
27
  },
28
- }, { explicitlyTyped: true });
28
+ }, {
29
+ explicitlyTyped: true,
30
+ preProcessSnapshot: snap => {
31
+ return snap.uri
32
+ ? {
33
+ ...snap,
34
+ outLocation: {
35
+ uri: snap.uri,
36
+ baseUri: snap.baseUri,
37
+ },
38
+ }
39
+ : snap;
40
+ },
41
+ });
29
42
  exports.default = MashMapAdapter;
@@ -25,5 +25,18 @@ const PAFAdapter = (0, configuration_1.ConfigurationSchema)('PAFAdapter', {
25
25
  locationType: 'UriLocation',
26
26
  },
27
27
  },
28
- }, { explicitlyTyped: true });
28
+ }, {
29
+ explicitlyTyped: true,
30
+ preProcessSnapshot: snap => {
31
+ return snap.uri
32
+ ? {
33
+ ...snap,
34
+ pafLocation: {
35
+ uri: snap.uri,
36
+ baseUri: snap.baseUri,
37
+ },
38
+ }
39
+ : snap;
40
+ },
41
+ });
29
42
  exports.default = PAFAdapter;
@@ -41,5 +41,24 @@ const PairwiseIndexedPAFAdapter = (0, configuration_1.ConfigurationSchema)('Pair
41
41
  },
42
42
  },
43
43
  }),
44
- }, { explicitlyTyped: true });
44
+ }, {
45
+ explicitlyTyped: true,
46
+ preProcessSnapshot: snap => {
47
+ return snap.uri
48
+ ? {
49
+ ...snap,
50
+ pifGzLocation: {
51
+ uri: snap.uri,
52
+ baseUri: snap.baseUri,
53
+ },
54
+ index: {
55
+ location: {
56
+ uri: `${snap.uri}.tbi`,
57
+ baseUri: snap.baseUri,
58
+ },
59
+ },
60
+ }
61
+ : snap;
62
+ },
63
+ });
45
64
  exports.default = PairwiseIndexedPAFAdapter;
package/dist/util.js CHANGED
@@ -53,7 +53,7 @@ function parseLineByLine(buffer, cb, opts) {
53
53
  }
54
54
  }
55
55
  if (i++ % 10000 === 0) {
56
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
56
+ statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
57
57
  }
58
58
  blockStart = n + 1;
59
59
  }
@@ -20,5 +20,18 @@ const ChainAdapter = ConfigurationSchema('ChainAdapter', {
20
20
  type: 'fileLocation',
21
21
  defaultValue: { uri: '/path/to/file.chain', locationType: 'UriLocation' },
22
22
  },
23
- }, { explicitlyTyped: true });
23
+ }, {
24
+ explicitlyTyped: true,
25
+ preProcessSnapshot: snap => {
26
+ return snap.uri
27
+ ? {
28
+ ...snap,
29
+ chainLocation: {
30
+ uri: snap.uri,
31
+ baseUri: snap.baseUri,
32
+ },
33
+ }
34
+ : snap;
35
+ },
36
+ });
24
37
  export default ChainAdapter;
@@ -1,3 +1,4 @@
1
+ import { getProgressDisplayStr } from '@jbrowse/core/util';
1
2
  function generate_record(qname, qstart, qend, qstrand, tname, tstart, tend, cigar, numMatches) {
2
3
  return {
3
4
  qname,
@@ -33,7 +34,7 @@ export function paf_chain2paf(buffer, opts) {
33
34
  const decoder = new TextDecoder('utf8');
34
35
  while (blockStart < buffer.length) {
35
36
  if (i++ % 10000 === 0) {
36
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
37
+ statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
37
38
  }
38
39
  const n = buffer.indexOf(10, blockStart);
39
40
  if (n === -1) {
@@ -23,5 +23,18 @@ const DeltaAdapter = ConfigurationSchema('DeltaAdapter', {
23
23
  locationType: 'UriLocation',
24
24
  },
25
25
  },
26
- }, { explicitlyTyped: true });
26
+ }, {
27
+ explicitlyTyped: true,
28
+ preProcessSnapshot: snap => {
29
+ return snap.uri
30
+ ? {
31
+ ...snap,
32
+ deltaLocation: {
33
+ uri: snap.uri,
34
+ baseUri: snap.baseUri,
35
+ },
36
+ }
37
+ : snap;
38
+ },
39
+ });
27
40
  export default DeltaAdapter;
@@ -1,3 +1,4 @@
1
+ import { getProgressDisplayStr } from '@jbrowse/core/util';
1
2
  export function paf_delta2paf(buffer, opts) {
2
3
  const { statusCallback = () => { } } = opts || {};
3
4
  let rname = '';
@@ -20,7 +21,7 @@ export function paf_delta2paf(buffer, opts) {
20
21
  const decoder = new TextDecoder('utf8');
21
22
  while (blockStart < buffer.length) {
22
23
  if (j++ % 10000 === 0) {
23
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
24
+ statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
24
25
  }
25
26
  const n = buffer.indexOf(10, blockStart);
26
27
  if (n === -1) {
@@ -67,7 +67,7 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
67
67
  const index = assemblyNames.indexOf(region.assemblyName);
68
68
  if (index !== -1) {
69
69
  const flip = index === 0;
70
- feats.forEach(f => {
70
+ for (const f of feats) {
71
71
  const [r1, r2, score, rowNum] = f;
72
72
  const [f1, f2] = !flip ? [r2, r1] : [r1, r2];
73
73
  if (f1.refName === region.refName &&
@@ -85,7 +85,7 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
85
85
  },
86
86
  }));
87
87
  }
88
- });
88
+ }
89
89
  }
90
90
  observer.complete();
91
91
  });
@@ -26,5 +26,26 @@ const MCScanAnchorsAdapter = ConfigurationSchema('MCScanAnchorsAdapter', {
26
26
  type: 'stringArray',
27
27
  defaultValue: [],
28
28
  },
29
- }, { explicitlyTyped: true });
29
+ }, {
30
+ explicitlyTyped: true,
31
+ preProcessSnapshot: snap => {
32
+ return snap.uri && snap.bed1 && snap.bed2
33
+ ? {
34
+ ...snap,
35
+ mcscanAnchorsLocation: {
36
+ uri: snap.uri,
37
+ baseUri: snap.baseUri,
38
+ },
39
+ bed1Location: {
40
+ uri: snap.bed1,
41
+ baseUri: snap.baseUri,
42
+ },
43
+ bed2Location: {
44
+ uri: snap.bed2,
45
+ baseUri: snap.baseUri,
46
+ },
47
+ }
48
+ : snap;
49
+ },
50
+ });
30
51
  export default MCScanAnchorsAdapter;
@@ -85,7 +85,7 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
85
85
  const index = assemblyNames.indexOf(region.assemblyName);
86
86
  if (index !== -1) {
87
87
  const flip = index === 0;
88
- feats.forEach(f => {
88
+ for (const f of feats) {
89
89
  const [f11, f12, f21, f22, score, strand, rowNum] = f;
90
90
  let r1 = {
91
91
  refName: f11.refName,
@@ -116,7 +116,7 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
116
116
  },
117
117
  }));
118
118
  }
119
- });
119
+ }
120
120
  }
121
121
  observer.complete();
122
122
  });
@@ -26,5 +26,26 @@ const MCScanSimpleAnchorsAdapter = ConfigurationSchema('MCScanSimpleAnchorsAdapt
26
26
  type: 'stringArray',
27
27
  defaultValue: [],
28
28
  },
29
- }, { explicitlyTyped: true });
29
+ }, {
30
+ explicitlyTyped: true,
31
+ preProcessSnapshot: snap => {
32
+ return snap.uri && snap.bed1 && snap.bed2
33
+ ? {
34
+ ...snap,
35
+ mcscanSimpleAnchorsLocation: {
36
+ uri: snap.uri,
37
+ baseUri: snap.baseUri,
38
+ },
39
+ bed1Location: {
40
+ uri: snap.bed1,
41
+ baseUri: snap.baseUri,
42
+ },
43
+ bed2Location: {
44
+ uri: snap.bed2,
45
+ baseUri: snap.baseUri,
46
+ },
47
+ }
48
+ : snap;
49
+ },
50
+ });
30
51
  export default MCScanSimpleAnchorsAdapter;
@@ -23,5 +23,18 @@ const MashMapAdapter = ConfigurationSchema('MashMapAdapter', {
23
23
  locationType: 'UriLocation',
24
24
  },
25
25
  },
26
- }, { explicitlyTyped: true });
26
+ }, {
27
+ explicitlyTyped: true,
28
+ preProcessSnapshot: snap => {
29
+ return snap.uri
30
+ ? {
31
+ ...snap,
32
+ outLocation: {
33
+ uri: snap.uri,
34
+ baseUri: snap.baseUri,
35
+ },
36
+ }
37
+ : snap;
38
+ },
39
+ });
27
40
  export default MashMapAdapter;
@@ -23,5 +23,18 @@ const PAFAdapter = ConfigurationSchema('PAFAdapter', {
23
23
  locationType: 'UriLocation',
24
24
  },
25
25
  },
26
- }, { explicitlyTyped: true });
26
+ }, {
27
+ explicitlyTyped: true,
28
+ preProcessSnapshot: snap => {
29
+ return snap.uri
30
+ ? {
31
+ ...snap,
32
+ pafLocation: {
33
+ uri: snap.uri,
34
+ baseUri: snap.baseUri,
35
+ },
36
+ }
37
+ : snap;
38
+ },
39
+ });
27
40
  export default PAFAdapter;
@@ -39,5 +39,24 @@ const PairwiseIndexedPAFAdapter = ConfigurationSchema('PairwiseIndexedPAFAdapter
39
39
  },
40
40
  },
41
41
  }),
42
- }, { explicitlyTyped: true });
42
+ }, {
43
+ explicitlyTyped: true,
44
+ preProcessSnapshot: snap => {
45
+ return snap.uri
46
+ ? {
47
+ ...snap,
48
+ pifGzLocation: {
49
+ uri: snap.uri,
50
+ baseUri: snap.baseUri,
51
+ },
52
+ index: {
53
+ location: {
54
+ uri: `${snap.uri}.tbi`,
55
+ baseUri: snap.baseUri,
56
+ },
57
+ },
58
+ }
59
+ : snap;
60
+ },
61
+ });
43
62
  export default PairwiseIndexedPAFAdapter;
package/esm/util.js CHANGED
@@ -1,4 +1,4 @@
1
- import { fetchAndMaybeUnzipText } from '@jbrowse/core/util';
1
+ import { fetchAndMaybeUnzipText, getProgressDisplayStr, } from '@jbrowse/core/util';
2
2
  export function parseBed(text) {
3
3
  return new Map(text
4
4
  .split(/\n|\r\n|\r/)
@@ -44,7 +44,7 @@ export function parseLineByLine(buffer, cb, opts) {
44
44
  }
45
45
  }
46
46
  if (i++ % 10000 === 0) {
47
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
47
+ statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
48
48
  }
49
49
  blockStart = n + 1;
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-comparative-adapters",
3
- "version": "3.0.5",
3
+ "version": "3.2.0",
4
4
  "description": "JBrowse 2 comparative adapters",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -38,9 +38,9 @@
38
38
  "dependencies": {
39
39
  "@gmod/bgzf-filehandle": "^2.0.1",
40
40
  "@gmod/tabix": "^2.0.0",
41
- "@jbrowse/core": "^3.0.5",
42
- "@jbrowse/plugin-alignments": "^3.0.5",
43
- "@jbrowse/plugin-linear-genome-view": "^3.0.5",
41
+ "@jbrowse/core": "^3.2.0",
42
+ "@jbrowse/plugin-alignments": "^3.2.0",
43
+ "@jbrowse/plugin-linear-genome-view": "^3.2.0",
44
44
  "@mui/material": "^6.0.0",
45
45
  "generic-filehandle2": "^1.0.0",
46
46
  "mobx": "^6.0.0",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "a03749efe19e51609922272b845a331897346789"
61
+ "gitHead": "c750e3f56706a490c19ba75abd807fec5e38aebf"
62
62
  }