@jbrowse/plugin-gtf 2.17.0 → 2.18.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,7 +1,8 @@
1
- import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { NoAssemblyRegion } from '@jbrowse/core/util/types';
3
1
  import IntervalTree from '@flatten-js/interval-tree';
4
- import { Feature } from '@jbrowse/core/util';
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 { NoAssemblyRegion } from '@jbrowse/core/util/types';
5
6
  type StatusCallback = (arg: string) => void;
6
7
  export default class GtfAdapter extends BaseFeatureDataAdapter {
7
8
  calculatedIntervalTreeMap: Record<string, IntervalTree>;
@@ -3,13 +3,12 @@ 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
+ const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
6
7
  const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
8
+ const util_1 = require("@jbrowse/core/util");
7
9
  const io_1 = require("@jbrowse/core/util/io");
8
10
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
9
- const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
10
- const util_1 = require("@jbrowse/core/util");
11
11
  const gtf_nostream_1 = require("gtf-nostream");
12
- // locals
13
12
  const util_2 = require("../util");
14
13
  class GtfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
15
14
  constructor() {
@@ -27,7 +26,6 @@ class GtfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
27
26
  const decoder = new TextDecoder('utf8');
28
27
  while (blockStart < buffer.length) {
29
28
  const n = buffer.indexOf('\n', blockStart);
30
- // could be a non-newline ended file, so slice to end of file if n===-1
31
29
  const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
32
30
  const line = decoder.decode(b).trim();
33
31
  if (line) {
@@ -105,8 +103,8 @@ class GtfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
105
103
  catch (e) {
106
104
  observer.error(e);
107
105
  }
108
- }, opts.signal);
106
+ }, opts.stopToken);
109
107
  }
110
- freeResources( /* { region } */) { }
108
+ freeResources() { }
111
109
  }
112
110
  exports.default = GtfAdapter;
@@ -1,7 +1,4 @@
1
1
  declare const GtfAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  gtfLocation: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config GtfAdapter
6
- * #category adapter
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
9
5
  const GtfAdapter = (0, configuration_1.ConfigurationSchema)('GtfAdapter', {
10
- /**
11
- * #slot
12
- */
13
6
  gtfLocation: {
14
7
  type: 'fileLocation',
15
8
  defaultValue: { uri: '/path/to/my.gtf', locationType: 'UriLocation' },
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
2
1
  import Plugin from '@jbrowse/core/Plugin';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class GtfPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/dist/index.js CHANGED
@@ -26,10 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
30
29
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
31
- const GtfAdapter_1 = require("./GtfAdapter");
30
+ const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
32
31
  const tracks_1 = require("@jbrowse/core/util/tracks");
32
+ const GtfAdapter_1 = require("./GtfAdapter");
33
33
  class GtfPlugin extends Plugin_1.default {
34
34
  constructor() {
35
35
  super(...arguments);
package/dist/util.js CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.featureData = featureData;
4
4
  function featureData(data) {
5
5
  const f = { ...data };
6
- f.start -= 1; // convert to interbase
7
- f.strand = { '+': 1, '-': -1, '.': 0, '?': undefined }[data.strand]; // convert strand
6
+ f.start -= 1;
7
+ f.strand = { '+': 1, '-': -1, '.': 0, '?': undefined }[data.strand];
8
8
  f.phase = Number(data.frame);
9
9
  f.refName = data.seq_name;
10
10
  if (data.score === null) {
@@ -26,15 +26,11 @@ function featureData(data) {
26
26
  for (const a of Object.keys(data.attributes)) {
27
27
  let b = a.toLowerCase();
28
28
  if (defaultFields.has(b)) {
29
- // add "suffix" to tag name if it already exists
30
- // reproduces behavior of NCList
31
29
  b += '2';
32
30
  }
33
31
  if (data.attributes[a]) {
34
32
  let attr = data.attributes[a];
35
33
  if (Array.isArray(attr) && attr.length === 1) {
36
- // gtf uses double quotes for text values in the attributes column,
37
- // remove them
38
34
  attr = attr[0].replaceAll(/^"|"$/g, '');
39
35
  }
40
36
  f[b] = attr;
@@ -42,7 +38,6 @@ function featureData(data) {
42
38
  }
43
39
  f.refName = f.seq_name;
44
40
  f.type = f.featureType;
45
- // the SimpleFeature constructor takes care of recursively inflating subfeatures
46
41
  if (data.child_features && data.child_features.length > 0) {
47
42
  f.subfeatures = data.child_features.flatMap(childLocs => childLocs.map(childLoc => featureData(childLoc)));
48
43
  }
@@ -1,7 +1,8 @@
1
- import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { NoAssemblyRegion } from '@jbrowse/core/util/types';
3
1
  import IntervalTree from '@flatten-js/interval-tree';
4
- import { Feature } from '@jbrowse/core/util';
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 { NoAssemblyRegion } from '@jbrowse/core/util/types';
5
6
  type StatusCallback = (arg: string) => void;
6
7
  export default class GtfAdapter extends BaseFeatureDataAdapter {
7
8
  calculatedIntervalTreeMap: Record<string, IntervalTree>;
@@ -1,10 +1,9 @@
1
- import { BaseFeatureDataAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { openLocation } from '@jbrowse/core/util/io';
3
- import { ObservableCreate } from '@jbrowse/core/util/rxjs';
4
1
  import IntervalTree from '@flatten-js/interval-tree';
2
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
5
3
  import { SimpleFeature, fetchAndMaybeUnzip } from '@jbrowse/core/util';
4
+ import { openLocation } from '@jbrowse/core/util/io';
5
+ import { ObservableCreate } from '@jbrowse/core/util/rxjs';
6
6
  import { parseStringSync } from 'gtf-nostream';
7
- // locals
8
7
  import { featureData } from '../util';
9
8
  export default class GtfAdapter extends BaseFeatureDataAdapter {
10
9
  constructor() {
@@ -22,7 +21,6 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
22
21
  const decoder = new TextDecoder('utf8');
23
22
  while (blockStart < buffer.length) {
24
23
  const n = buffer.indexOf('\n', blockStart);
25
- // could be a non-newline ended file, so slice to end of file if n===-1
26
24
  const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
27
25
  const line = decoder.decode(b).trim();
28
26
  if (line) {
@@ -100,7 +98,7 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
100
98
  catch (e) {
101
99
  observer.error(e);
102
100
  }
103
- }, opts.signal);
101
+ }, opts.stopToken);
104
102
  }
105
- freeResources( /* { region } */) { }
103
+ freeResources() { }
106
104
  }
@@ -1,7 +1,4 @@
1
1
  declare const GtfAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  gtfLocation: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -1,13 +1,6 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
- /**
3
- * #config GtfAdapter
4
- * #category adapter
5
- */
6
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ function x() { }
7
3
  const GtfAdapter = ConfigurationSchema('GtfAdapter', {
8
- /**
9
- * #slot
10
- */
11
4
  gtfLocation: {
12
5
  type: 'fileLocation',
13
6
  defaultValue: { uri: '/path/to/my.gtf', locationType: 'UriLocation' },
package/esm/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
2
1
  import Plugin from '@jbrowse/core/Plugin';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class GtfPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
2
1
  import Plugin from '@jbrowse/core/Plugin';
3
- import { configSchema as gtfAdapterConfigSchema } from './GtfAdapter';
2
+ import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
4
3
  import { getFileName } from '@jbrowse/core/util/tracks';
4
+ import { configSchema as gtfAdapterConfigSchema } from './GtfAdapter';
5
5
  export default class GtfPlugin extends Plugin {
6
6
  constructor() {
7
7
  super(...arguments);
package/esm/util.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export function featureData(data) {
2
2
  const f = { ...data };
3
- f.start -= 1; // convert to interbase
4
- f.strand = { '+': 1, '-': -1, '.': 0, '?': undefined }[data.strand]; // convert strand
3
+ f.start -= 1;
4
+ f.strand = { '+': 1, '-': -1, '.': 0, '?': undefined }[data.strand];
5
5
  f.phase = Number(data.frame);
6
6
  f.refName = data.seq_name;
7
7
  if (data.score === null) {
@@ -23,15 +23,11 @@ export function featureData(data) {
23
23
  for (const a of Object.keys(data.attributes)) {
24
24
  let b = a.toLowerCase();
25
25
  if (defaultFields.has(b)) {
26
- // add "suffix" to tag name if it already exists
27
- // reproduces behavior of NCList
28
26
  b += '2';
29
27
  }
30
28
  if (data.attributes[a]) {
31
29
  let attr = data.attributes[a];
32
30
  if (Array.isArray(attr) && attr.length === 1) {
33
- // gtf uses double quotes for text values in the attributes column,
34
- // remove them
35
31
  attr = attr[0].replaceAll(/^"|"$/g, '');
36
32
  }
37
33
  f[b] = attr;
@@ -39,7 +35,6 @@ export function featureData(data) {
39
35
  }
40
36
  f.refName = f.seq_name;
41
37
  f.type = f.featureType;
42
- // the SimpleFeature constructor takes care of recursively inflating subfeatures
43
38
  if (data.child_features && data.child_features.length > 0) {
44
39
  f.subfeatures = data.child_features.flatMap(childLocs => childLocs.map(childLoc => featureData(childLoc)));
45
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-gtf",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "description": "JBrowse 2 gtf feature adapter",
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": "eed30b5e671f8f7823652d7cecc51aa89226de46"
59
+ "gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
60
60
  }