@jbrowse/plugin-gtf 3.6.5 → 4.0.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.
@@ -1,15 +1,16 @@
1
- import IntervalTree from '@flatten-js/interval-tree';
1
+ import { IntervalTree } from '@flatten-js/interval-tree';
2
2
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
3
  import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
4
- import type { Feature } from '@jbrowse/core/util';
4
+ import type { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util';
5
5
  import type { Region } from '@jbrowse/core/util/types';
6
6
  import type { Observer } from 'rxjs';
7
7
  type StatusCallback = (arg: string) => void;
8
+ type SimpleFeat = SimpleFeatureSerialized;
8
9
  export default class GtfAdapter extends BaseFeatureDataAdapter {
9
- calculatedIntervalTreeMap: Record<string, IntervalTree>;
10
+ calculatedIntervalTreeMap: Record<string, IntervalTree<SimpleFeat>>;
10
11
  gtfFeatures?: Promise<{
11
12
  header: string;
12
- intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree>;
13
+ intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree<SimpleFeat>>;
13
14
  }>;
14
15
  private loadDataP;
15
16
  private loadData;
@@ -1,16 +1,14 @@
1
- import IntervalTree from '@flatten-js/interval-tree';
1
+ import { IntervalTree } from '@flatten-js/interval-tree';
2
2
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
3
  import { SimpleFeature, doesIntersect2, fetchAndMaybeUnzip, max, min, } from '@jbrowse/core/util';
4
4
  import { openLocation } from '@jbrowse/core/util/io';
5
5
  import { parseLineByLine } from '@jbrowse/core/util/parseLineByLine';
6
6
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
7
7
  import { parseStringSync } from 'gtf-nostream';
8
- import { featureData } from '../util';
8
+ import { featureData } from "../util.js";
9
9
  export default class GtfAdapter extends BaseFeatureDataAdapter {
10
- constructor() {
11
- super(...arguments);
12
- this.calculatedIntervalTreeMap = {};
13
- }
10
+ calculatedIntervalTreeMap = {};
11
+ gtfFeatures;
14
12
  async loadDataP(opts) {
15
13
  const loc = openLocation(this.getConf('gtfLocation'), this.pluginManager);
16
14
  const buffer = await fetchAndMaybeUnzip(loc, opts);
@@ -32,12 +30,12 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
32
30
  featureMap[refName] += `${line}\n`;
33
31
  }
34
32
  return true;
35
- }, opts === null || opts === void 0 ? void 0 : opts.statusCallback);
33
+ }, opts?.statusCallback);
36
34
  const intervalTreeMap = Object.fromEntries(Object.entries(featureMap).map(([refName, lines]) => [
37
35
  refName,
38
36
  (sc) => {
39
37
  if (!this.calculatedIntervalTreeMap[refName]) {
40
- sc === null || sc === void 0 ? void 0 : sc('Parsing GTF data');
38
+ sc?.('Parsing GTF data');
41
39
  const intervalTree = new IntervalTree();
42
40
  for (const obj of parseStringSync(lines)
43
41
  .flat()
@@ -87,11 +85,10 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
87
85
  }, opts.stopToken);
88
86
  }
89
87
  async getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery = query, }) {
90
- var _a;
91
88
  const aggregateField = this.getConf('aggregateField');
92
89
  const { start, end, refName } = query;
93
90
  const { intervalTreeMap } = await this.loadData(opts);
94
- const feats = (_a = intervalTreeMap[refName]) === null || _a === void 0 ? void 0 : _a.call(intervalTreeMap, opts.statusCallback).search([
91
+ const feats = intervalTreeMap[refName]?.(opts.statusCallback).search([
95
92
  start,
96
93
  end,
97
94
  ]);
@@ -116,8 +113,8 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
116
113
  await this.getFeaturesHelper({
117
114
  query: {
118
115
  ...query,
119
- start: minStart - 500000,
120
- end: maxEnd + 500000,
116
+ start: minStart - 500_000,
117
+ end: maxEnd + 500_000,
121
118
  },
122
119
  opts,
123
120
  observer,
@@ -128,9 +125,6 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
128
125
  }
129
126
  }
130
127
  const parentAggregation = {};
131
- if (feats.some(f => f.uniqueId === undefined)) {
132
- throw new Error('found uniqueId undefined');
133
- }
134
128
  for (const feat of feats) {
135
129
  const aggr = feat[aggregateField];
136
130
  if (!parentAggregation[aggr]) {
@@ -1,4 +1,4 @@
1
- declare const GtfAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const GtfAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  gtfLocation: {
3
3
  type: string;
4
4
  description: string;
@@ -12,5 +12,5 @@ declare const GtfAdapter: import("@jbrowse/core/configuration/configurationSchem
12
12
  description: string;
13
13
  defaultValue: string;
14
14
  };
15
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
15
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
16
16
  export default GtfAdapter;
@@ -1,10 +1,10 @@
1
1
  import { AdapterType } from '@jbrowse/core/pluggableElementTypes';
2
- import configSchema from './configSchema';
2
+ import configSchema from "./configSchema.js";
3
3
  export default function GtfAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => new AdapterType({
5
5
  name: 'GtfAdapter',
6
6
  displayName: 'GTF adapter',
7
7
  configSchema,
8
- getAdapterClass: () => import('./GtfAdapter').then(r => r.default),
8
+ getAdapterClass: () => import("./GtfAdapter.js").then(r => r.default),
9
9
  }));
10
10
  }
package/esm/index.js CHANGED
@@ -1,11 +1,8 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import GtfAdapterF from './GtfAdapter';
3
- import GuessAdapterF from './GuessAdapter';
2
+ import GtfAdapterF from "./GtfAdapter/index.js";
3
+ import GuessAdapterF from "./GuessAdapter/index.js";
4
4
  export default class GtfPlugin extends Plugin {
5
- constructor() {
6
- super(...arguments);
7
- this.name = 'GTFPlugin';
8
- }
5
+ name = 'GTFPlugin';
9
6
  install(pluginManager) {
10
7
  GtfAdapterF(pluginManager);
11
8
  GuessAdapterF(pluginManager);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-gtf",
3
- "version": "3.6.5",
3
+ "version": "4.0.0",
4
4
  "description": "JBrowse 2 gtf feature adapter",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -15,37 +15,21 @@
15
15
  "directory": "plugins/gtf"
16
16
  },
17
17
  "author": "JBrowse Team",
18
- "distMain": "dist/index.js",
19
- "srcMain": "src/index.ts",
20
- "main": "dist/index.js",
18
+ "main": "esm/index.js",
21
19
  "files": [
22
- "dist",
23
20
  "esm"
24
21
  ],
25
- "scripts": {
26
- "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest --passWithNoTests plugins/gtf --passWithNoTests",
28
- "prepublishOnly": "yarn test",
29
- "prepack": "yarn build && yarn useDist",
30
- "postpack": "yarn useSrc",
31
- "useDist": "node ../../scripts/useDist.js",
32
- "useSrc": "node ../../scripts/useSrc.js",
33
- "prebuild": "npm run clean",
34
- "build:esm": "tsc --build tsconfig.build.esm.json",
35
- "build:commonjs": "tsc --build tsconfig.build.commonjs.json",
36
- "clean": "rimraf dist esm *.tsbuildinfo"
37
- },
38
22
  "dependencies": {
39
- "@flatten-js/interval-tree": "^1.0.15",
40
- "@gmod/bgzf-filehandle": "^4.0.0",
41
- "@jbrowse/core": "^3.6.5",
42
- "@jbrowse/plugin-linear-genome-view": "^3.6.5",
43
- "@mui/material": "^7.0.0",
44
- "gtf-nostream": "^1.0.0",
45
- "mobx": "^6.0.0",
46
- "mobx-react": "^9.0.0",
47
- "mobx-state-tree": "^5.0.0",
48
- "rxjs": "^7.0.0"
23
+ "@flatten-js/interval-tree": "^2.0.3",
24
+ "@gmod/bgzf-filehandle": "^6.0.9",
25
+ "@jbrowse/mobx-state-tree": "^5.5.0",
26
+ "@mui/material": "^7.3.6",
27
+ "gtf-nostream": "^1.3.4",
28
+ "mobx": "^6.15.0",
29
+ "mobx-react": "^9.2.1",
30
+ "rxjs": "^7.8.2",
31
+ "@jbrowse/core": "^4.0.0",
32
+ "@jbrowse/plugin-linear-genome-view": "^4.0.0"
49
33
  },
50
34
  "peerDependencies": {
51
35
  "react": ">=18.0.0"
@@ -53,8 +37,19 @@
53
37
  "publishConfig": {
54
38
  "access": "public"
55
39
  },
56
- "distModule": "esm/index.js",
57
- "srcModule": "src/index.ts",
58
- "module": "esm/index.js",
59
- "gitHead": "354d0a87b757b4d84f824b47507662f6f3a1693f"
60
- }
40
+ "sideEffects": false,
41
+ "scripts": {
42
+ "build": "pnpm run /^build:/",
43
+ "test": "cd ../..; jest --passWithNoTests plugins/gtf --passWithNoTests",
44
+ "prebuild": "pnpm clean",
45
+ "build:esm": "tsc -p tsconfig.build.esm.json",
46
+ "clean": "rimraf esm *.tsbuildinfo"
47
+ },
48
+ "types": "esm/index.d.ts",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./esm/index.d.ts",
52
+ "import": "./esm/index.js"
53
+ }
54
+ }
55
+ }
@@ -1,27 +0,0 @@
1
- import IntervalTree from '@flatten-js/interval-tree';
2
- import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
4
- import type { Feature } from '@jbrowse/core/util';
5
- import type { Region } from '@jbrowse/core/util/types';
6
- import type { Observer } from 'rxjs';
7
- type StatusCallback = (arg: string) => void;
8
- export default class GtfAdapter extends BaseFeatureDataAdapter {
9
- calculatedIntervalTreeMap: Record<string, IntervalTree>;
10
- gtfFeatures?: Promise<{
11
- header: string;
12
- intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree>;
13
- }>;
14
- private loadDataP;
15
- private loadData;
16
- getRefNames(opts?: BaseOptions): Promise<string[]>;
17
- getHeader(opts?: BaseOptions): Promise<string>;
18
- getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
19
- getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery, }: {
20
- query: Region;
21
- opts: BaseOptions;
22
- observer: Observer<Feature>;
23
- allowRedispatch: boolean;
24
- originalQuery?: Region;
25
- }): Promise<void>;
26
- }
27
- export {};
@@ -1,177 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
7
- const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
8
- const util_1 = require("@jbrowse/core/util");
9
- const io_1 = require("@jbrowse/core/util/io");
10
- const parseLineByLine_1 = require("@jbrowse/core/util/parseLineByLine");
11
- const rxjs_1 = require("@jbrowse/core/util/rxjs");
12
- const gtf_nostream_1 = require("gtf-nostream");
13
- const util_2 = require("../util");
14
- class GtfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
15
- constructor() {
16
- super(...arguments);
17
- this.calculatedIntervalTreeMap = {};
18
- }
19
- async loadDataP(opts) {
20
- const loc = (0, io_1.openLocation)(this.getConf('gtfLocation'), this.pluginManager);
21
- const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
22
- const headerLines = [];
23
- const featureMap = {};
24
- (0, parseLineByLine_1.parseLineByLine)(buffer, line => {
25
- if (line.startsWith('#')) {
26
- headerLines.push(line);
27
- }
28
- else if (line.startsWith('>')) {
29
- return false;
30
- }
31
- else {
32
- const ret = line.indexOf('\t');
33
- const refName = line.slice(0, ret);
34
- if (!featureMap[refName]) {
35
- featureMap[refName] = '';
36
- }
37
- featureMap[refName] += `${line}\n`;
38
- }
39
- return true;
40
- }, opts === null || opts === void 0 ? void 0 : opts.statusCallback);
41
- const intervalTreeMap = Object.fromEntries(Object.entries(featureMap).map(([refName, lines]) => [
42
- refName,
43
- (sc) => {
44
- if (!this.calculatedIntervalTreeMap[refName]) {
45
- sc === null || sc === void 0 ? void 0 : sc('Parsing GTF data');
46
- const intervalTree = new interval_tree_1.default();
47
- for (const obj of (0, gtf_nostream_1.parseStringSync)(lines)
48
- .flat()
49
- .map((f, i) => (0, util_2.featureData)(f, `${this.id}-${refName}-${i}`))) {
50
- intervalTree.insert([obj.start, obj.end], obj);
51
- }
52
- this.calculatedIntervalTreeMap[refName] = intervalTree;
53
- }
54
- return this.calculatedIntervalTreeMap[refName];
55
- },
56
- ]));
57
- return {
58
- header: headerLines.join('\n'),
59
- intervalTreeMap,
60
- };
61
- }
62
- async loadData(opts = {}) {
63
- if (!this.gtfFeatures) {
64
- this.gtfFeatures = this.loadDataP(opts).catch((e) => {
65
- this.gtfFeatures = undefined;
66
- throw e;
67
- });
68
- }
69
- return this.gtfFeatures;
70
- }
71
- async getRefNames(opts = {}) {
72
- const { intervalTreeMap } = await this.loadData(opts);
73
- return Object.keys(intervalTreeMap);
74
- }
75
- async getHeader(opts = {}) {
76
- const { header } = await this.loadData(opts);
77
- return header;
78
- }
79
- getFeatures(query, opts = {}) {
80
- return (0, rxjs_1.ObservableCreate)(async (observer) => {
81
- try {
82
- await this.getFeaturesHelper({
83
- query,
84
- opts,
85
- observer,
86
- allowRedispatch: true,
87
- });
88
- }
89
- catch (e) {
90
- observer.error(e);
91
- }
92
- }, opts.stopToken);
93
- }
94
- async getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery = query, }) {
95
- var _a;
96
- const aggregateField = this.getConf('aggregateField');
97
- const { start, end, refName } = query;
98
- const { intervalTreeMap } = await this.loadData(opts);
99
- const feats = (_a = intervalTreeMap[refName]) === null || _a === void 0 ? void 0 : _a.call(intervalTreeMap, opts.statusCallback).search([
100
- start,
101
- end,
102
- ]);
103
- if (feats) {
104
- if (allowRedispatch && feats.length) {
105
- let minStart = Number.POSITIVE_INFINITY;
106
- let maxEnd = Number.NEGATIVE_INFINITY;
107
- let hasAnyAggregateField = false;
108
- for (const feat of feats) {
109
- if (feat.start < minStart) {
110
- minStart = feat.start;
111
- }
112
- if (feat.end > maxEnd) {
113
- maxEnd = feat.end;
114
- }
115
- if (feat[aggregateField]) {
116
- hasAnyAggregateField = true;
117
- }
118
- }
119
- if (hasAnyAggregateField &&
120
- (maxEnd > query.end || minStart < query.start)) {
121
- await this.getFeaturesHelper({
122
- query: {
123
- ...query,
124
- start: minStart - 500000,
125
- end: maxEnd + 500000,
126
- },
127
- opts,
128
- observer,
129
- allowRedispatch: false,
130
- originalQuery: query,
131
- });
132
- return;
133
- }
134
- }
135
- const parentAggregation = {};
136
- if (feats.some(f => f.uniqueId === undefined)) {
137
- throw new Error('found uniqueId undefined');
138
- }
139
- for (const feat of feats) {
140
- const aggr = feat[aggregateField];
141
- if (!parentAggregation[aggr]) {
142
- parentAggregation[aggr] = [];
143
- }
144
- if (aggr) {
145
- parentAggregation[aggr].push(feat);
146
- }
147
- else {
148
- observer.next(new util_1.SimpleFeature({
149
- id: feat.uniqueId,
150
- data: feat,
151
- }));
152
- }
153
- }
154
- for (const [name, subfeatures] of Object.entries(parentAggregation)) {
155
- const s = (0, util_1.min)(subfeatures.map(f => f.start));
156
- const e = (0, util_1.max)(subfeatures.map(f => f.end));
157
- if ((0, util_1.doesIntersect2)(s, e, originalQuery.start, originalQuery.end)) {
158
- const { uniqueId, strand } = subfeatures[0];
159
- observer.next(new util_1.SimpleFeature({
160
- id: `${uniqueId}-parent`,
161
- data: {
162
- type: 'gene',
163
- subfeatures,
164
- strand,
165
- name,
166
- start: s,
167
- end: e,
168
- refName: query.refName,
169
- },
170
- }));
171
- }
172
- }
173
- }
174
- observer.complete();
175
- }
176
- }
177
- exports.default = GtfAdapter;
@@ -1,16 +0,0 @@
1
- declare const GtfAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- gtfLocation: {
3
- type: string;
4
- description: string;
5
- defaultValue: {
6
- uri: string;
7
- locationType: string;
8
- };
9
- };
10
- aggregateField: {
11
- type: string;
12
- description: string;
13
- defaultValue: string;
14
- };
15
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
16
- export default GtfAdapter;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const configuration_1 = require("@jbrowse/core/configuration");
4
- function x() { }
5
- const GtfAdapter = (0, configuration_1.ConfigurationSchema)('GtfAdapter', {
6
- gtfLocation: {
7
- type: 'fileLocation',
8
- description: 'path to gtf file, also allows for gzipped gtf',
9
- defaultValue: {
10
- uri: '/path/to/my.gtf',
11
- locationType: 'UriLocation',
12
- },
13
- },
14
- aggregateField: {
15
- type: 'string',
16
- description: 'field used to aggregate multiple transcripts into a single parent gene feature',
17
- defaultValue: 'gene_name',
18
- },
19
- }, {
20
- explicitlyTyped: true,
21
- preProcessSnapshot: snap => {
22
- return snap.uri
23
- ? {
24
- ...snap,
25
- gtfLocation: {
26
- uri: snap.uri,
27
- baseUri: snap.baseUri,
28
- },
29
- }
30
- : snap;
31
- },
32
- });
33
- exports.default = GtfAdapter;
@@ -1,2 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function GtfAdapterF(pluginManager: PluginManager): void;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = GtfAdapterF;
40
- const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
41
- const configSchema_1 = __importDefault(require("./configSchema"));
42
- function GtfAdapterF(pluginManager) {
43
- pluginManager.addAdapterType(() => new pluggableElementTypes_1.AdapterType({
44
- name: 'GtfAdapter',
45
- displayName: 'GTF adapter',
46
- configSchema: configSchema_1.default,
47
- getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./GtfAdapter'))).then(r => r.default),
48
- }));
49
- }
@@ -1,2 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function GuessAdapterF(pluginManager: PluginManager): void;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = GuessAdapterF;
4
- const util_1 = require("@jbrowse/core/util");
5
- const tracks_1 = require("@jbrowse/core/util/tracks");
6
- function GuessAdapterF(pluginManager) {
7
- pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
8
- return (file, index, adapterHint) => {
9
- const fileName = (0, tracks_1.getFileName)(file);
10
- return (0, util_1.testAdapter)(fileName, /\.gtf(\.gz)?$/i, adapterHint, 'GtfAdapter')
11
- ? {
12
- type: 'GtfAdapter',
13
- gtfLocation: file,
14
- }
15
- : adapterGuesser(file, index, adapterHint);
16
- };
17
- });
18
- }
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import Plugin from '@jbrowse/core/Plugin';
2
- import type PluginManager from '@jbrowse/core/PluginManager';
3
- export default class GtfPlugin extends Plugin {
4
- name: string;
5
- install(pluginManager: PluginManager): void;
6
- }
package/dist/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
7
- const GtfAdapter_1 = __importDefault(require("./GtfAdapter"));
8
- const GuessAdapter_1 = __importDefault(require("./GuessAdapter"));
9
- class GtfPlugin extends Plugin_1.default {
10
- constructor() {
11
- super(...arguments);
12
- this.name = 'GTFPlugin';
13
- }
14
- install(pluginManager) {
15
- (0, GtfAdapter_1.default)(pluginManager);
16
- (0, GuessAdapter_1.default)(pluginManager);
17
- }
18
- }
19
- exports.default = GtfPlugin;
package/dist/util.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export type Strand = '+' | '-' | '.' | '?';
2
- export interface FeatureLoc {
3
- [key: string]: unknown;
4
- start: number;
5
- end: number;
6
- strand: Strand;
7
- seq_name: string;
8
- child_features?: FeatureLoc[][];
9
- data: unknown;
10
- derived_features: unknown;
11
- attributes: Record<string, unknown[]>;
12
- }
13
- export declare function featureData(data: FeatureLoc, id?: string): Record<string, unknown>;
package/dist/util.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.featureData = featureData;
4
- function featureData(data, id) {
5
- const f = { ...data };
6
- f.start -= 1;
7
- f.strand = { '+': 1, '-': -1, '.': 0, '?': undefined }[data.strand];
8
- f.phase = Number(data.frame);
9
- f.refName = data.seq_name;
10
- if (data.score === null) {
11
- f.score = undefined;
12
- }
13
- if (data.frame === null) {
14
- f.score = undefined;
15
- }
16
- const defaultFields = new Set([
17
- 'start',
18
- 'end',
19
- 'seq_name',
20
- 'score',
21
- 'featureType',
22
- 'source',
23
- 'frame',
24
- 'strand',
25
- ]);
26
- for (const a of Object.keys(data.attributes)) {
27
- let b = a.toLowerCase();
28
- if (defaultFields.has(b)) {
29
- b += '2';
30
- }
31
- if (data.attributes[a]) {
32
- let attr = data.attributes[a];
33
- if (Array.isArray(attr) && attr.length === 1) {
34
- attr = attr[0].replaceAll(/^"|"$/g, '');
35
- }
36
- f[b] = attr;
37
- }
38
- }
39
- f.refName = f.seq_name;
40
- f.type = f.featureType;
41
- if (data.child_features && data.child_features.length > 0) {
42
- f.subfeatures = data.child_features.flatMap(childLocs => childLocs.map(childLoc => featureData(childLoc)));
43
- }
44
- f.child_features = undefined;
45
- f.data = undefined;
46
- f.derived_features = undefined;
47
- f._linehash = undefined;
48
- f.attributes = undefined;
49
- f.seq_name = undefined;
50
- f.featureType = undefined;
51
- f.frame = undefined;
52
- if (f.transcript_id) {
53
- f.name = f.transcript_id;
54
- }
55
- if (id !== undefined) {
56
- f.uniqueId = id;
57
- }
58
- return f;
59
- }