@jbrowse/plugin-config 2.9.0 → 2.10.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/FromConfigAdapter/FromConfigAdapter.d.ts +2 -8
- package/dist/FromConfigAdapter/FromConfigAdapter.js +23 -29
- package/dist/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +3 -6
- package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +2 -8
- package/esm/FromConfigAdapter/FromConfigAdapter.js +21 -29
- package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +3 -3
- package/package.json +2 -2
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import
|
|
2
|
+
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
3
3
|
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
4
4
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
5
5
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
6
6
|
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
|
-
|
|
8
|
-
* Adapter that just returns the features defined in its `features` configuration
|
|
9
|
-
* key, like:
|
|
10
|
-
* `"features": [ { "refName": "ctgA", "start":1, "end":20 }, ... ]`
|
|
11
|
-
*/
|
|
7
|
+
export declare function makeFeatures(fdata: SimpleFeatureSerialized[]): Map<string, Feature[]>;
|
|
12
8
|
export default class FromConfigAdapter extends BaseFeatureDataAdapter {
|
|
13
9
|
protected features: Map<string, Feature[]>;
|
|
14
10
|
constructor(conf: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
15
|
-
static makeFeatures(fdata: SimpleFeatureSerialized[]): Map<string, Feature[]>;
|
|
16
|
-
static makeFeature(data: SimpleFeatureSerialized): SimpleFeature;
|
|
17
11
|
getRefNames(): Promise<string[]>;
|
|
18
12
|
getRefNameAliases(): Promise<{
|
|
19
13
|
refName: string;
|
|
@@ -3,43 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.makeFeatures = void 0;
|
|
6
7
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
7
8
|
const simpleFeature_1 = __importDefault(require("@jbrowse/core/util/simpleFeature"));
|
|
8
9
|
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
9
10
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function makeFeatures(fdata) {
|
|
12
|
+
const features = new Map();
|
|
13
|
+
for (const entry of fdata) {
|
|
14
|
+
if (entry) {
|
|
15
|
+
const f = new simpleFeature_1.default(entry);
|
|
16
|
+
const refName = f.get('refName');
|
|
17
|
+
let bucket = features.get(refName);
|
|
18
|
+
if (!bucket) {
|
|
19
|
+
bucket = [];
|
|
20
|
+
features.set(refName, bucket);
|
|
21
|
+
}
|
|
22
|
+
bucket.push(f);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// sort the features on each reference sequence by start coordinate
|
|
26
|
+
for (const refFeatures of features.values()) {
|
|
27
|
+
refFeatures.sort((a, b) => a.get('start') - b.get('start'));
|
|
28
|
+
}
|
|
29
|
+
return features;
|
|
30
|
+
}
|
|
31
|
+
exports.makeFeatures = makeFeatures;
|
|
15
32
|
class FromConfigAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
16
33
|
constructor(conf, getSubAdapter, pluginManager) {
|
|
17
34
|
super(conf, getSubAdapter, pluginManager);
|
|
18
35
|
const feats = (0, configuration_1.readConfObject)(conf, 'features');
|
|
19
|
-
this.features =
|
|
20
|
-
}
|
|
21
|
-
static makeFeatures(fdata) {
|
|
22
|
-
const features = new Map();
|
|
23
|
-
for (const entry of fdata) {
|
|
24
|
-
if (entry) {
|
|
25
|
-
const f = this.makeFeature(entry);
|
|
26
|
-
const refName = f.get('refName');
|
|
27
|
-
let bucket = features.get(refName);
|
|
28
|
-
if (!bucket) {
|
|
29
|
-
bucket = [];
|
|
30
|
-
features.set(refName, bucket);
|
|
31
|
-
}
|
|
32
|
-
bucket.push(f);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// sort the features on each reference sequence by start coordinate
|
|
36
|
-
for (const refFeatures of features.values()) {
|
|
37
|
-
refFeatures.sort((a, b) => a.get('start') - b.get('start'));
|
|
38
|
-
}
|
|
39
|
-
return features;
|
|
40
|
-
}
|
|
41
|
-
static makeFeature(data) {
|
|
42
|
-
return new simpleFeature_1.default(data);
|
|
36
|
+
this.features = makeFeatures(feats || []);
|
|
43
37
|
}
|
|
44
38
|
async getRefNames() {
|
|
45
39
|
return [...this.features.keys()];
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
7
4
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
8
|
-
const FromConfigAdapter_1 =
|
|
5
|
+
const FromConfigAdapter_1 = require("../FromConfigAdapter/FromConfigAdapter");
|
|
9
6
|
/**
|
|
10
7
|
* Adapter that just returns the features defined in its `features` configuration
|
|
11
8
|
* key, like:
|
|
@@ -14,8 +11,8 @@ const FromConfigAdapter_1 = __importDefault(require("../FromConfigAdapter/FromCo
|
|
|
14
11
|
class FromConfigRegionsAdapter extends BaseAdapter_1.BaseAdapter {
|
|
15
12
|
constructor(config, getSubAdapter, pluginManager) {
|
|
16
13
|
super(config, getSubAdapter, pluginManager);
|
|
17
|
-
const
|
|
18
|
-
this.features = FromConfigAdapter_1.
|
|
14
|
+
const f = (0, configuration_1.readConfObject)(config, 'features');
|
|
15
|
+
this.features = (0, FromConfigAdapter_1.makeFeatures)(f || []);
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
21
18
|
* Get refName, start, and end for all features after collapsing any overlaps
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import
|
|
2
|
+
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
3
3
|
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
4
4
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
5
5
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
6
6
|
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
|
-
|
|
8
|
-
* Adapter that just returns the features defined in its `features` configuration
|
|
9
|
-
* key, like:
|
|
10
|
-
* `"features": [ { "refName": "ctgA", "start":1, "end":20 }, ... ]`
|
|
11
|
-
*/
|
|
7
|
+
export declare function makeFeatures(fdata: SimpleFeatureSerialized[]): Map<string, Feature[]>;
|
|
12
8
|
export default class FromConfigAdapter extends BaseFeatureDataAdapter {
|
|
13
9
|
protected features: Map<string, Feature[]>;
|
|
14
10
|
constructor(conf: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
15
|
-
static makeFeatures(fdata: SimpleFeatureSerialized[]): Map<string, Feature[]>;
|
|
16
|
-
static makeFeature(data: SimpleFeatureSerialized): SimpleFeature;
|
|
17
11
|
getRefNames(): Promise<string[]>;
|
|
18
12
|
getRefNameAliases(): Promise<{
|
|
19
13
|
refName: string;
|
|
@@ -2,39 +2,31 @@ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
|
2
2
|
import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
3
3
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
4
4
|
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export function makeFeatures(fdata) {
|
|
6
|
+
const features = new Map();
|
|
7
|
+
for (const entry of fdata) {
|
|
8
|
+
if (entry) {
|
|
9
|
+
const f = new SimpleFeature(entry);
|
|
10
|
+
const refName = f.get('refName');
|
|
11
|
+
let bucket = features.get(refName);
|
|
12
|
+
if (!bucket) {
|
|
13
|
+
bucket = [];
|
|
14
|
+
features.set(refName, bucket);
|
|
15
|
+
}
|
|
16
|
+
bucket.push(f);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// sort the features on each reference sequence by start coordinate
|
|
20
|
+
for (const refFeatures of features.values()) {
|
|
21
|
+
refFeatures.sort((a, b) => a.get('start') - b.get('start'));
|
|
22
|
+
}
|
|
23
|
+
return features;
|
|
24
|
+
}
|
|
10
25
|
export default class FromConfigAdapter extends BaseFeatureDataAdapter {
|
|
11
26
|
constructor(conf, getSubAdapter, pluginManager) {
|
|
12
27
|
super(conf, getSubAdapter, pluginManager);
|
|
13
28
|
const feats = readConfObject(conf, 'features');
|
|
14
|
-
this.features =
|
|
15
|
-
}
|
|
16
|
-
static makeFeatures(fdata) {
|
|
17
|
-
const features = new Map();
|
|
18
|
-
for (const entry of fdata) {
|
|
19
|
-
if (entry) {
|
|
20
|
-
const f = this.makeFeature(entry);
|
|
21
|
-
const refName = f.get('refName');
|
|
22
|
-
let bucket = features.get(refName);
|
|
23
|
-
if (!bucket) {
|
|
24
|
-
bucket = [];
|
|
25
|
-
features.set(refName, bucket);
|
|
26
|
-
}
|
|
27
|
-
bucket.push(f);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// sort the features on each reference sequence by start coordinate
|
|
31
|
-
for (const refFeatures of features.values()) {
|
|
32
|
-
refFeatures.sort((a, b) => a.get('start') - b.get('start'));
|
|
33
|
-
}
|
|
34
|
-
return features;
|
|
35
|
-
}
|
|
36
|
-
static makeFeature(data) {
|
|
37
|
-
return new SimpleFeature(data);
|
|
29
|
+
this.features = makeFeatures(feats || []);
|
|
38
30
|
}
|
|
39
31
|
async getRefNames() {
|
|
40
32
|
return [...this.features.keys()];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
3
|
-
import
|
|
3
|
+
import { makeFeatures } from '../FromConfigAdapter/FromConfigAdapter';
|
|
4
4
|
/**
|
|
5
5
|
* Adapter that just returns the features defined in its `features` configuration
|
|
6
6
|
* key, like:
|
|
@@ -9,8 +9,8 @@ import FromConfigAdapter from '../FromConfigAdapter/FromConfigAdapter';
|
|
|
9
9
|
export default class FromConfigRegionsAdapter extends BaseAdapter {
|
|
10
10
|
constructor(config, getSubAdapter, pluginManager) {
|
|
11
11
|
super(config, getSubAdapter, pluginManager);
|
|
12
|
-
const
|
|
13
|
-
this.features =
|
|
12
|
+
const f = readConfObject(config, 'features');
|
|
13
|
+
this.features = makeFeatures(f || []);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Get refName, start, and end for all features after collapsing any overlaps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "JBrowse 2 config utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"distModule": "esm/index.js",
|
|
57
57
|
"srcModule": "src/index.ts",
|
|
58
58
|
"module": "esm/index.js",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "223d8bfb68fd1bacaf22852639ad5920f1b7f43b"
|
|
60
60
|
}
|