@jbrowse/plugin-comparative-adapters 2.15.3 → 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.
- package/dist/ChainAdapter/ChainAdapter.js +1 -0
- package/dist/ChainAdapter/util.d.ts +1 -0
- package/dist/DeltaAdapter/DeltaAdapter.js +5 -4
- package/dist/DeltaAdapter/util.d.ts +1 -0
- package/dist/DeltaAdapter/util.js +4 -4
- package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +2 -1
- package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +21 -5
- package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +2 -1
- package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +25 -2
- package/dist/util.d.ts +1 -0
- package/esm/ChainAdapter/ChainAdapter.js +1 -0
- package/esm/ChainAdapter/util.d.ts +1 -0
- package/esm/DeltaAdapter/DeltaAdapter.js +2 -1
- package/esm/DeltaAdapter/util.d.ts +1 -0
- package/esm/DeltaAdapter/util.js +4 -4
- package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +2 -1
- package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +21 -5
- package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +2 -1
- package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +25 -2
- package/esm/util.d.ts +1 -0
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const io_1 = require("@jbrowse/core/util/io");
|
|
7
7
|
const util_1 = require("@jbrowse/core/util");
|
|
8
8
|
const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
|
|
9
|
+
// locals
|
|
9
10
|
const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
|
|
10
11
|
const util_2 = require("./util");
|
|
11
12
|
class ChainAdapter extends PAFAdapter_1.default {
|
|
@@ -5,15 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const io_1 = require("@jbrowse/core/util/io");
|
|
7
7
|
const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
|
|
8
|
+
const util_1 = require("@jbrowse/core/util");
|
|
9
|
+
// locals
|
|
8
10
|
const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
|
|
9
|
-
const
|
|
10
|
-
const util_2 = require("@jbrowse/core/util");
|
|
11
|
+
const util_2 = require("./util");
|
|
11
12
|
class DeltaAdapter extends PAFAdapter_1.default {
|
|
12
13
|
async setupPre(opts) {
|
|
13
14
|
const loc = (0, io_1.openLocation)(this.getConf('deltaLocation'), this.pluginManager);
|
|
14
15
|
const buffer = (await loc.readFile(opts));
|
|
15
|
-
const buf = (0,
|
|
16
|
-
return (0,
|
|
16
|
+
const buf = (0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
|
|
17
|
+
return (0, util_2.paf_delta2paf)(buf);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
exports.default = DeltaAdapter;
|
|
@@ -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
|
|
78
|
-
re = +(t1
|
|
79
|
-
qs = +(t2
|
|
80
|
-
qe = +(t3
|
|
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
|
-
|
|
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
|
-
//
|
|
47
|
-
//
|
|
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
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65
|
-
|
|
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 = {}) {
|
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { GenericFilehandle } from 'generic-filehandle';
|
|
3
|
+
import type { Buffer } from 'buffer';
|
|
3
4
|
import { PAFRecord } from './PAFAdapter/util';
|
|
4
5
|
export declare function parseBed(text: string): Map<string | undefined, {
|
|
5
6
|
refName: string | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
2
2
|
import { isGzip } from '@jbrowse/core/util';
|
|
3
3
|
import { unzip } from '@gmod/bgzf-filehandle';
|
|
4
|
+
// locals
|
|
4
5
|
import PAFAdapter from '../PAFAdapter/PAFAdapter';
|
|
5
6
|
import { paf_chain2paf } from './util';
|
|
6
7
|
export default class ChainAdapter extends PAFAdapter {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
2
2
|
import { unzip } from '@gmod/bgzf-filehandle';
|
|
3
|
+
import { isGzip } from '@jbrowse/core/util';
|
|
4
|
+
// locals
|
|
3
5
|
import PAFAdapter from '../PAFAdapter/PAFAdapter';
|
|
4
6
|
import { paf_delta2paf } from './util';
|
|
5
|
-
import { isGzip } from '@jbrowse/core/util';
|
|
6
7
|
export default class DeltaAdapter extends PAFAdapter {
|
|
7
8
|
async setupPre(opts) {
|
|
8
9
|
const loc = openLocation(this.getConf('deltaLocation'), this.pluginManager);
|
package/esm/DeltaAdapter/util.js
CHANGED
|
@@ -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
|
|
75
|
-
re = +(t1
|
|
76
|
-
qs = +(t2
|
|
77
|
-
qe = +(t3
|
|
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
|
-
|
|
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
|
-
//
|
|
45
|
-
//
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
|
|
60
|
-
|
|
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/esm/util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { GenericFilehandle } from 'generic-filehandle';
|
|
3
|
+
import type { Buffer } from 'buffer';
|
|
3
4
|
import { PAFRecord } from './PAFAdapter/util';
|
|
4
5
|
export declare function parseBed(text: string): Map<string | undefined, {
|
|
5
6
|
refName: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-comparative-adapters",
|
|
3
|
-
"version": "2.
|
|
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": "
|
|
61
|
+
"gitHead": "1e6d4fbc27ce684eed19e3c217f34bd2da24ab75"
|
|
62
62
|
}
|