@jbrowse/plugin-comparative-adapters 2.15.4 → 2.16.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.
@@ -74,10 +74,10 @@ function paf_delta2paf(buffer) {
74
74
  const t3 = +t[3];
75
75
  const t4 = +t[4];
76
76
  strand = (t0 < t1 && t2 < t3) || (t0 > t1 && t2 > t3) ? 1 : -1;
77
- rs = +(t0 < t1 ? t0 : t1) - 1;
78
- re = +(t1 > t0 ? t1 : t0);
79
- qs = +(t2 < t3 ? t2 : t3) - 1;
80
- qe = +(t3 > t2 ? t3 : t2);
77
+ rs = +Math.min(t0, t1) - 1;
78
+ re = +Math.max(t1, t0);
79
+ qs = +Math.min(t2, t3) - 1;
80
+ qe = +Math.max(t3, t2);
81
81
  x = y = 0;
82
82
  NM = t4;
83
83
  cigar = [];
@@ -21,7 +21,8 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
21
21
  feats: Row[];
22
22
  }>;
23
23
  hasDataForRefName(): Promise<boolean>;
24
- getRefNames(): Promise<never[]>;
24
+ getAssemblyNames(): string[];
25
+ getRefNames(opts?: BaseOptions): Promise<string[]>;
25
26
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
26
27
  /**
27
28
  * called to provide a hint that data tied to a certain region
@@ -42,13 +42,29 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
42
42
  };
43
43
  }
44
44
  async hasDataForRefName() {
45
- // determining this properly is basically a call to getFeatures
46
- // so is not really that important, and has to be true or else
47
- // getFeatures is never called (BaseFeatureDataAdapter filters it out)
45
+ // determining this properly is basically a call to getFeatures so is not
46
+ // really that important, and has to be true or else getFeatures is never
47
+ // called (BaseFeatureDataAdapter filters it out)
48
48
  return true;
49
49
  }
50
- async getRefNames() {
51
- // we cannot determine this accurately
50
+ getAssemblyNames() {
51
+ const assemblyNames = this.getConf('assemblyNames');
52
+ return assemblyNames;
53
+ }
54
+ async getRefNames(opts = {}) {
55
+ var _a;
56
+ // @ts-expect-error
57
+ const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
58
+ const { feats } = await this.setup(opts);
59
+ const idx = this.getAssemblyNames().indexOf(r1);
60
+ if (idx !== -1) {
61
+ const set = new Set();
62
+ for (const feat of feats) {
63
+ set.add(idx === 0 ? feat[0].refName : feat[1].refName);
64
+ }
65
+ return [...set];
66
+ }
67
+ console.warn('Unable to do ref renaming on adapter');
52
68
  return [];
53
69
  }
54
70
  getFeatures(region, opts = {}) {
@@ -29,7 +29,8 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
29
29
  feats: Row[];
30
30
  }>;
31
31
  hasDataForRefName(): Promise<boolean>;
32
- getRefNames(): Promise<never[]>;
32
+ getAssemblyNames(): string[];
33
+ getRefNames(opts?: BaseOptions): Promise<string[]>;
33
34
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
34
35
  /**
35
36
  * called to provide a hint that data tied to a certain region
@@ -61,8 +61,31 @@ class MCScanAnchorsAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
61
61
  // getFeatures is never called (BaseFeatureDataAdapter filters it out)
62
62
  return true;
63
63
  }
64
- async getRefNames() {
65
- // we cannot determine this accurately
64
+ getAssemblyNames() {
65
+ const assemblyNames = this.getConf('assemblyNames');
66
+ return assemblyNames;
67
+ }
68
+ async getRefNames(opts = {}) {
69
+ var _a;
70
+ // @ts-expect-error
71
+ const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
72
+ const { feats } = await this.setup(opts);
73
+ const idx = this.getAssemblyNames().indexOf(r1);
74
+ if (idx !== -1) {
75
+ const set = new Set();
76
+ for (const feat of feats) {
77
+ if (idx === 0) {
78
+ set.add(feat[0].refName);
79
+ set.add(feat[1].refName);
80
+ }
81
+ else {
82
+ set.add(feat[2].refName);
83
+ set.add(feat[3].refName);
84
+ }
85
+ }
86
+ return [...set];
87
+ }
88
+ console.warn('Unable to do ref renaming on adapter');
66
89
  return [];
67
90
  }
68
91
  getFeatures(region, opts = {}) {
@@ -71,10 +71,10 @@ export function paf_delta2paf(buffer) {
71
71
  const t3 = +t[3];
72
72
  const t4 = +t[4];
73
73
  strand = (t0 < t1 && t2 < t3) || (t0 > t1 && t2 > t3) ? 1 : -1;
74
- rs = +(t0 < t1 ? t0 : t1) - 1;
75
- re = +(t1 > t0 ? t1 : t0);
76
- qs = +(t2 < t3 ? t2 : t3) - 1;
77
- qe = +(t3 > t2 ? t3 : t2);
74
+ rs = +Math.min(t0, t1) - 1;
75
+ re = +Math.max(t1, t0);
76
+ qs = +Math.min(t2, t3) - 1;
77
+ qe = +Math.max(t3, t2);
78
78
  x = y = 0;
79
79
  NM = t4;
80
80
  cigar = [];
@@ -21,7 +21,8 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
21
21
  feats: Row[];
22
22
  }>;
23
23
  hasDataForRefName(): Promise<boolean>;
24
- getRefNames(): Promise<never[]>;
24
+ getAssemblyNames(): string[];
25
+ getRefNames(opts?: BaseOptions): Promise<string[]>;
25
26
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
26
27
  /**
27
28
  * called to provide a hint that data tied to a certain region
@@ -40,13 +40,29 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
40
40
  };
41
41
  }
42
42
  async hasDataForRefName() {
43
- // determining this properly is basically a call to getFeatures
44
- // so is not really that important, and has to be true or else
45
- // getFeatures is never called (BaseFeatureDataAdapter filters it out)
43
+ // determining this properly is basically a call to getFeatures so is not
44
+ // really that important, and has to be true or else getFeatures is never
45
+ // called (BaseFeatureDataAdapter filters it out)
46
46
  return true;
47
47
  }
48
- async getRefNames() {
49
- // we cannot determine this accurately
48
+ getAssemblyNames() {
49
+ const assemblyNames = this.getConf('assemblyNames');
50
+ return assemblyNames;
51
+ }
52
+ async getRefNames(opts = {}) {
53
+ var _a;
54
+ // @ts-expect-error
55
+ const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
56
+ const { feats } = await this.setup(opts);
57
+ const idx = this.getAssemblyNames().indexOf(r1);
58
+ if (idx !== -1) {
59
+ const set = new Set();
60
+ for (const feat of feats) {
61
+ set.add(idx === 0 ? feat[0].refName : feat[1].refName);
62
+ }
63
+ return [...set];
64
+ }
65
+ console.warn('Unable to do ref renaming on adapter');
50
66
  return [];
51
67
  }
52
68
  getFeatures(region, opts = {}) {
@@ -29,7 +29,8 @@ export default class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
29
29
  feats: Row[];
30
30
  }>;
31
31
  hasDataForRefName(): Promise<boolean>;
32
- getRefNames(): Promise<never[]>;
32
+ getAssemblyNames(): string[];
33
+ getRefNames(opts?: BaseOptions): Promise<string[]>;
33
34
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
34
35
  /**
35
36
  * called to provide a hint that data tied to a certain region
@@ -56,8 +56,31 @@ class MCScanAnchorsAdapter extends BaseFeatureDataAdapter {
56
56
  // getFeatures is never called (BaseFeatureDataAdapter filters it out)
57
57
  return true;
58
58
  }
59
- async getRefNames() {
60
- // we cannot determine this accurately
59
+ getAssemblyNames() {
60
+ const assemblyNames = this.getConf('assemblyNames');
61
+ return assemblyNames;
62
+ }
63
+ async getRefNames(opts = {}) {
64
+ var _a;
65
+ // @ts-expect-error
66
+ const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
67
+ const { feats } = await this.setup(opts);
68
+ const idx = this.getAssemblyNames().indexOf(r1);
69
+ if (idx !== -1) {
70
+ const set = new Set();
71
+ for (const feat of feats) {
72
+ if (idx === 0) {
73
+ set.add(feat[0].refName);
74
+ set.add(feat[1].refName);
75
+ }
76
+ else {
77
+ set.add(feat[2].refName);
78
+ set.add(feat[3].refName);
79
+ }
80
+ }
81
+ return [...set];
82
+ }
83
+ console.warn('Unable to do ref renaming on adapter');
61
84
  return [];
62
85
  }
63
86
  getFeatures(region, opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-comparative-adapters",
3
- "version": "2.15.4",
3
+ "version": "2.16.0",
4
4
  "description": "JBrowse 2 comparative adapters",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "686b4ad9016b3586e8230180f7adb44c238ba4fb"
61
+ "gitHead": "1e6d4fbc27ce684eed19e3c217f34bd2da24ab75"
62
62
  }