@jbrowse/plugin-gtf 5.0.0-beta.1 → 5.0.0-beta.11
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/esm/GtfAdapter/GtfAdapter.js +1 -1
- package/esm/GtfAdapter/configSchema.d.ts +12 -16
- package/esm/GtfAdapter/configSchema.js +2 -10
- package/esm/GtfTabixAdapter/GtfTabixAdapter.js +15 -6
- package/esm/GtfTabixAdapter/configSchema.d.ts +27 -43
- package/esm/GtfTabixAdapter/configSchema.js +9 -2
- package/package.json +7 -5
|
@@ -18,25 +18,21 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
declare const GtfAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
type: {
|
|
22
|
+
type: "string";
|
|
23
|
+
} & {
|
|
24
|
+
defaultValue: string;
|
|
25
|
+
};
|
|
24
26
|
readonly gtfLocation: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
readonly uri: "/path/to/my.gtf";
|
|
29
|
-
readonly locationType: "UriLocation";
|
|
30
|
-
};
|
|
27
|
+
type: "fileLocation";
|
|
28
|
+
} & {
|
|
29
|
+
defaultValue: unknown;
|
|
31
30
|
};
|
|
32
|
-
/**
|
|
33
|
-
* #slot
|
|
34
|
-
*/
|
|
35
31
|
readonly aggregateField: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
type: "string";
|
|
33
|
+
} & {
|
|
34
|
+
defaultValue: string;
|
|
39
35
|
};
|
|
40
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
36
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
41
37
|
export type GtfAdapterConfig = Instance<typeof GtfAdapter>;
|
|
42
38
|
export default GtfAdapter;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
1
|
+
import { ConfigurationSchema, expandUriShorthand, } from '@jbrowse/core/configuration';
|
|
2
2
|
export function normalizeSnapshot(snap) {
|
|
3
|
-
return snap
|
|
4
|
-
? {
|
|
5
|
-
...snap,
|
|
6
|
-
gtfLocation: {
|
|
7
|
-
uri: snap.uri,
|
|
8
|
-
baseUri: snap.baseUri,
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
: snap;
|
|
3
|
+
return expandUriShorthand(snap, 'gtfLocation');
|
|
12
4
|
}
|
|
13
5
|
/**
|
|
14
6
|
* #config GtfAdapter
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
2
2
|
import { BaseFeatureDataAdapter, cachedSetup, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
3
|
import { SimpleFeature, downloadStatus } from '@jbrowse/core/util';
|
|
4
|
-
import { sharedBgzfWorkerPool } from '@jbrowse/core/util/bgzfWorkerPool';
|
|
5
4
|
import { decompressedBytesBudget } from '@jbrowse/core/util/cacheBudgets';
|
|
6
5
|
import { openLocation, openTabixIndexFilehandle } from '@jbrowse/core/util/io';
|
|
7
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
@@ -10,19 +9,18 @@ import { aggregateGtfFeatures, parseGtfToFeatures } from '../util.js';
|
|
|
10
9
|
export default class GtfTabixAdapter extends BaseFeatureDataAdapter {
|
|
11
10
|
configure = cachedSetup({
|
|
12
11
|
label: 'Downloading index',
|
|
13
|
-
setup: async (
|
|
12
|
+
setup: async (opts, onProgress) => {
|
|
14
13
|
const gtf = new TabixIndexedFile({
|
|
15
14
|
filehandle: openLocation(this.getConf('gtfGzLocation'), this.pluginManager),
|
|
16
15
|
...openTabixIndexFilehandle(this.getConf(['index', 'location']), this.getConf(['index', 'indexType']), this.pluginManager),
|
|
17
16
|
chunkCacheBudget: decompressedBytesBudget,
|
|
18
|
-
bgzfWorkerPool: sharedBgzfWorkerPool(),
|
|
19
17
|
});
|
|
20
18
|
return {
|
|
21
19
|
gtf,
|
|
22
20
|
dontRedispatchSet: new Set(this.getConf('dontRedispatch')),
|
|
23
21
|
// the index is a whole-file read, so its byte ticks turn the
|
|
24
22
|
// "Downloading index" label into a determinate bar
|
|
25
|
-
header: await gtf.getHeader({ onProgress }),
|
|
23
|
+
header: await gtf.getHeader({ onProgress, signal: opts.signal }),
|
|
26
24
|
};
|
|
27
25
|
},
|
|
28
26
|
});
|
|
@@ -45,7 +43,18 @@ export default class GtfTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
45
43
|
return ObservableCreate(async (observer) => {
|
|
46
44
|
try {
|
|
47
45
|
const { gtf, dontRedispatchSet } = await this.configure(opts);
|
|
48
|
-
|
|
46
|
+
// The type list alone, and `opts.topLevelOnly` is deliberately not
|
|
47
|
+
// honoured — both for the same reason. A GTF line has no `ID`/`Parent`,
|
|
48
|
+
// so there is no cheap "can this have children"; and a GTF top-level
|
|
49
|
+
// feature is not a line at all, it is synthesized by
|
|
50
|
+
// `aggregateGtfFeatures` from the transcripts in the FETCHED set, whose
|
|
51
|
+
// span it takes from them. So the argument that lets GFF3 skip the
|
|
52
|
+
// flanks — a top-level feature overlapping the query is already in the
|
|
53
|
+
// query's own read — does not transfer, and a narrower bound could draw
|
|
54
|
+
// a gene short rather than merely flat. Nothing is lost by declining:
|
|
55
|
+
// no GTF record shape makes this bound expensive (the fixtures top out
|
|
56
|
+
// at 19 kb, against GFF3's chromosome-long `match`).
|
|
57
|
+
const lines = await readTabixLinesRedispatched(gtf, query, line => !dontRedispatchSet.has(line.type), opts);
|
|
49
58
|
const feats = parseGtfToFeatures(lines, record => `${this.id}-offset-${record.offset}`);
|
|
50
59
|
const aggregated = aggregateGtfFeatures({
|
|
51
60
|
feats,
|
|
@@ -63,6 +72,6 @@ export default class GtfTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
63
72
|
catch (e) {
|
|
64
73
|
observer.error(e);
|
|
65
74
|
}
|
|
66
|
-
}, opts.
|
|
75
|
+
}, opts.signal);
|
|
67
76
|
}
|
|
68
77
|
}
|
|
@@ -18,59 +18,43 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
declare const GtfTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
readonly densityAdapter: {
|
|
22
|
+
type: "maybeFrozen";
|
|
23
|
+
};
|
|
24
|
+
type: {
|
|
25
|
+
type: "string";
|
|
26
|
+
} & {
|
|
27
|
+
defaultValue: string;
|
|
28
|
+
};
|
|
26
29
|
readonly gtfGzLocation: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly locationType: "UriLocation";
|
|
31
|
-
};
|
|
30
|
+
type: "fileLocation";
|
|
31
|
+
} & {
|
|
32
|
+
defaultValue: unknown;
|
|
32
33
|
};
|
|
33
34
|
readonly index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
34
35
|
readonly indexType: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
type: "stringEnum";
|
|
37
|
+
} & {
|
|
38
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<"CSI" | "TBI">;
|
|
39
|
+
} & {
|
|
40
|
+
defaultValue: string;
|
|
39
41
|
};
|
|
40
42
|
readonly location: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
readonly locationType: 'UriLocation';
|
|
45
|
-
};
|
|
46
|
-
readonly description: 'location of the tabix index. Only needed when it is not named `<file>.tbi` (or `.csi`), which is what the `uri` shorthand assumes.';
|
|
43
|
+
type: "fileLocation";
|
|
44
|
+
} & {
|
|
45
|
+
defaultValue: unknown;
|
|
47
46
|
};
|
|
48
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
49
|
-
/**
|
|
50
|
-
* #slot
|
|
51
|
-
* the GtfTabixAdapter has to "redispatch" if it fetches a region and
|
|
52
|
-
* features it finds inside that region extend outside the region we
|
|
53
|
-
* requested. you can disable this for certain feature types to avoid
|
|
54
|
-
* fetching e.g. the entire chromosome
|
|
55
|
-
*
|
|
56
|
-
* the defaults are the whole-sequence records the common annotation sources
|
|
57
|
-
* emit: `region` (NCBI), `supercontig`/`scaffold` (Ensembl, for
|
|
58
|
-
* non-chromosomal sequences), plus `chromosome` and `contig`. They span an
|
|
59
|
-
* entire reference and have no children, so letting one expand the fetch
|
|
60
|
-
* would pull a whole chromosome to gain nothing
|
|
61
|
-
*/
|
|
47
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
62
48
|
readonly dontRedispatch: {
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
type: "stringArray";
|
|
50
|
+
} & {
|
|
51
|
+
defaultValue: unknown;
|
|
65
52
|
};
|
|
66
|
-
/**
|
|
67
|
-
* #slot
|
|
68
|
-
*/
|
|
69
53
|
readonly aggregateField: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
type: "string";
|
|
55
|
+
} & {
|
|
56
|
+
defaultValue: string;
|
|
73
57
|
};
|
|
74
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
58
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
75
59
|
export type GtfTabixAdapterConfig = Instance<typeof GtfTabixAdapter>;
|
|
76
60
|
export default GtfTabixAdapter;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConfigurationSchema, expandTabixShorthand,
|
|
1
|
+
import { ConfigurationSchema, expandTabixShorthand, tabixIndexSchema, } from '@jbrowse/core/configuration';
|
|
2
|
+
import { densityAdapterConfigSchemaFields } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
3
|
export function normalizeSnapshot(snap) {
|
|
3
4
|
return expandTabixShorthand(snap, 'gtfGzLocation');
|
|
4
5
|
}
|
|
@@ -32,7 +33,12 @@ const GtfTabixAdapter = ConfigurationSchema('GtfTabixAdapter', {
|
|
|
32
33
|
locationType: 'UriLocation',
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
|
-
|
|
36
|
+
/**
|
|
37
|
+
* #slot
|
|
38
|
+
* where the tabix index is and which kind it is. The `uri` shorthand derives
|
|
39
|
+
* both, so a config using it states neither.
|
|
40
|
+
*/
|
|
41
|
+
index: tabixIndexSchema(),
|
|
36
42
|
/**
|
|
37
43
|
* #slot
|
|
38
44
|
* the GtfTabixAdapter has to "redispatch" if it fetches a region and
|
|
@@ -64,6 +70,7 @@ const GtfTabixAdapter = ConfigurationSchema('GtfTabixAdapter', {
|
|
|
64
70
|
description: 'attribute naming the parent gene that transcripts are aggregated into. transcripts are grouped by gene_id where the file has one (gene names are not unique within a reference), so this is the gene label, and the grouping key only for files with no gene_id',
|
|
65
71
|
defaultValue: 'gene_name',
|
|
66
72
|
},
|
|
73
|
+
...densityAdapterConfigSchemaFields,
|
|
67
74
|
}, {
|
|
68
75
|
explicitlyTyped: true,
|
|
69
76
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-gtf",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 gtf feature adapter",
|
|
6
6
|
"keywords": [
|
|
@@ -21,13 +21,15 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gmod/tabix": "^3.
|
|
25
|
-
"@jbrowse/mobx-state-tree": "^6.
|
|
24
|
+
"@gmod/tabix": "^3.9.1",
|
|
25
|
+
"@jbrowse/mobx-state-tree": "^6.7.0",
|
|
26
|
+
"mobx": "^7.0.5",
|
|
26
27
|
"rxjs": "^7.8.2",
|
|
27
|
-
"@jbrowse/core": "^5.0.0-beta.
|
|
28
|
+
"@jbrowse/core": "^5.0.0-beta.11"
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
30
|
-
"react": ">=19.0.0"
|
|
31
|
+
"react": ">=19.0.0",
|
|
32
|
+
"react-dom": ">=19.0.0"
|
|
31
33
|
},
|
|
32
34
|
"publishConfig": {
|
|
33
35
|
"access": "public"
|