@jbrowse/plugin-comparative-adapters 2.16.1 → 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.
Files changed (101) hide show
  1. package/dist/BlastTabularAdapter/BlastTabularAdapter.d.ts +66 -0
  2. package/dist/BlastTabularAdapter/BlastTabularAdapter.js +200 -0
  3. package/dist/BlastTabularAdapter/configSchema.d.ts +30 -0
  4. package/dist/BlastTabularAdapter/configSchema.js +34 -0
  5. package/dist/BlastTabularAdapter/index.d.ts +2 -0
  6. package/dist/BlastTabularAdapter/index.js +42 -0
  7. package/dist/ChainAdapter/ChainAdapter.d.ts +1 -1
  8. package/dist/ChainAdapter/ChainAdapter.js +3 -6
  9. package/dist/ChainAdapter/configSchema.d.ts +0 -14
  10. package/dist/ChainAdapter/configSchema.js +1 -19
  11. package/dist/ChainAdapter/index.d.ts +1 -1
  12. package/dist/ChainAdapter/util.js +3 -50
  13. package/dist/DeltaAdapter/DeltaAdapter.d.ts +1 -1
  14. package/dist/DeltaAdapter/DeltaAdapter.js +3 -6
  15. package/dist/DeltaAdapter/configSchema.d.ts +0 -14
  16. package/dist/DeltaAdapter/configSchema.js +1 -19
  17. package/dist/DeltaAdapter/index.d.ts +1 -1
  18. package/dist/DeltaAdapter/util.js +4 -31
  19. package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +3 -7
  20. package/dist/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +2 -15
  21. package/dist/MCScanAnchorsAdapter/configSchema.d.ts +0 -12
  22. package/dist/MCScanAnchorsAdapter/configSchema.js +1 -16
  23. package/dist/MCScanAnchorsAdapter/index.d.ts +1 -1
  24. package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +4 -8
  25. package/dist/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +2 -13
  26. package/dist/MCScanSimpleAnchorsAdapter/configSchema.d.ts +0 -12
  27. package/dist/MCScanSimpleAnchorsAdapter/configSchema.js +1 -16
  28. package/dist/MCScanSimpleAnchorsAdapter/index.d.ts +1 -1
  29. package/dist/MashMapAdapter/MashMapAdapter.d.ts +13 -2
  30. package/dist/MashMapAdapter/MashMapAdapter.js +2 -5
  31. package/dist/MashMapAdapter/configSchema.d.ts +0 -12
  32. package/dist/MashMapAdapter/configSchema.js +1 -16
  33. package/dist/MashMapAdapter/index.d.ts +1 -1
  34. package/dist/PAFAdapter/PAFAdapter.d.ts +6 -5
  35. package/dist/PAFAdapter/PAFAdapter.js +5 -18
  36. package/dist/PAFAdapter/configSchema.d.ts +0 -12
  37. package/dist/PAFAdapter/configSchema.js +1 -16
  38. package/dist/PAFAdapter/index.d.ts +1 -1
  39. package/dist/PAFAdapter/util.d.ts +1 -1
  40. package/dist/PAFAdapter/util.js +1 -36
  41. package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +7 -6
  42. package/dist/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +5 -6
  43. package/dist/PairwiseIndexedPAFAdapter/configSchema.d.ts +0 -21
  44. package/dist/PairwiseIndexedPAFAdapter/configSchema.js +1 -25
  45. package/dist/PairwiseIndexedPAFAdapter/index.d.ts +1 -1
  46. package/dist/SyntenyFeature/index.js +0 -1
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +7 -5
  49. package/dist/util.d.ts +4 -4
  50. package/dist/util.js +9 -6
  51. package/esm/BlastTabularAdapter/BlastTabularAdapter.d.ts +66 -0
  52. package/esm/BlastTabularAdapter/BlastTabularAdapter.js +195 -0
  53. package/esm/BlastTabularAdapter/configSchema.d.ts +30 -0
  54. package/esm/BlastTabularAdapter/configSchema.js +32 -0
  55. package/esm/BlastTabularAdapter/index.d.ts +2 -0
  56. package/esm/BlastTabularAdapter/index.js +13 -0
  57. package/esm/ChainAdapter/ChainAdapter.d.ts +1 -1
  58. package/esm/ChainAdapter/ChainAdapter.js +3 -6
  59. package/esm/ChainAdapter/configSchema.d.ts +0 -14
  60. package/esm/ChainAdapter/configSchema.js +1 -19
  61. package/esm/ChainAdapter/index.d.ts +1 -1
  62. package/esm/ChainAdapter/util.js +3 -50
  63. package/esm/DeltaAdapter/DeltaAdapter.d.ts +1 -1
  64. package/esm/DeltaAdapter/DeltaAdapter.js +3 -6
  65. package/esm/DeltaAdapter/configSchema.d.ts +0 -14
  66. package/esm/DeltaAdapter/configSchema.js +1 -19
  67. package/esm/DeltaAdapter/index.d.ts +1 -1
  68. package/esm/DeltaAdapter/util.js +4 -31
  69. package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.d.ts +3 -7
  70. package/esm/MCScanAnchorsAdapter/MCScanAnchorsAdapter.js +4 -17
  71. package/esm/MCScanAnchorsAdapter/configSchema.d.ts +0 -12
  72. package/esm/MCScanAnchorsAdapter/configSchema.js +1 -16
  73. package/esm/MCScanAnchorsAdapter/index.d.ts +1 -1
  74. package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.d.ts +4 -8
  75. package/esm/MCScanSimpleAnchorsAdapter/MCScanSimpleAnchorsAdapter.js +4 -15
  76. package/esm/MCScanSimpleAnchorsAdapter/configSchema.d.ts +0 -12
  77. package/esm/MCScanSimpleAnchorsAdapter/configSchema.js +1 -16
  78. package/esm/MCScanSimpleAnchorsAdapter/index.d.ts +1 -1
  79. package/esm/MashMapAdapter/MashMapAdapter.d.ts +13 -2
  80. package/esm/MashMapAdapter/MashMapAdapter.js +2 -5
  81. package/esm/MashMapAdapter/configSchema.d.ts +0 -12
  82. package/esm/MashMapAdapter/configSchema.js +1 -16
  83. package/esm/MashMapAdapter/index.d.ts +1 -1
  84. package/esm/PAFAdapter/PAFAdapter.d.ts +6 -5
  85. package/esm/PAFAdapter/PAFAdapter.js +7 -20
  86. package/esm/PAFAdapter/configSchema.d.ts +0 -12
  87. package/esm/PAFAdapter/configSchema.js +1 -16
  88. package/esm/PAFAdapter/index.d.ts +1 -1
  89. package/esm/PAFAdapter/util.d.ts +1 -1
  90. package/esm/PAFAdapter/util.js +1 -36
  91. package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.d.ts +7 -6
  92. package/esm/PairwiseIndexedPAFAdapter/PairwiseIndexedPAFAdapter.js +6 -7
  93. package/esm/PairwiseIndexedPAFAdapter/configSchema.d.ts +0 -21
  94. package/esm/PairwiseIndexedPAFAdapter/configSchema.js +1 -25
  95. package/esm/PairwiseIndexedPAFAdapter/index.d.ts +1 -1
  96. package/esm/SyntenyFeature/index.js +0 -1
  97. package/esm/index.d.ts +1 -1
  98. package/esm/index.js +7 -5
  99. package/esm/util.d.ts +4 -4
  100. package/esm/util.js +10 -7
  101. package/package.json +2 -2
@@ -1,31 +1,19 @@
1
1
  declare const PAFAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  assemblyNames: {
6
3
  type: string;
7
4
  defaultValue: never[];
8
5
  description: string;
9
6
  };
10
- /**
11
- * #slot
12
- */
13
7
  targetAssembly: {
14
8
  type: string;
15
9
  defaultValue: string;
16
10
  description: string;
17
11
  };
18
- /**
19
- * #slot
20
- */
21
12
  queryAssembly: {
22
13
  type: string;
23
14
  defaultValue: string;
24
15
  description: string;
25
16
  };
26
- /**
27
- * #slot
28
- */
29
17
  pafLocation: {
30
18
  type: string;
31
19
  defaultValue: {
@@ -1,38 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config PAFAdapter
6
- */
7
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
8
5
  const PAFAdapter = (0, configuration_1.ConfigurationSchema)('PAFAdapter', {
9
- /**
10
- * #slot
11
- */
12
6
  assemblyNames: {
13
7
  type: 'stringArray',
14
8
  defaultValue: [],
15
9
  description: 'Array of assembly names to use for this file. The query assembly name is the first value in the array, target assembly name is the second',
16
10
  },
17
- /**
18
- * #slot
19
- */
20
11
  targetAssembly: {
21
12
  type: 'string',
22
13
  defaultValue: '',
23
14
  description: 'Alternative to assemblyNames: the target assembly name',
24
15
  },
25
- /**
26
- * #slot
27
- */
28
16
  queryAssembly: {
29
17
  type: 'string',
30
18
  defaultValue: '',
31
19
  description: 'Alternative to assemblyNames: the query assembly name',
32
20
  },
33
- /**
34
- * #slot
35
- */
36
21
  pafLocation: {
37
22
  type: 'fileLocation',
38
23
  defaultValue: {
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function PAFAdapterF(pluginManager: PluginManager): void;
@@ -9,7 +9,7 @@ export interface PAFRecord {
9
9
  extra: {
10
10
  cg?: string;
11
11
  blockLen?: number;
12
- mappingQual: number;
12
+ mappingQual?: number;
13
13
  numMatches?: number;
14
14
  meanScore?: number;
15
15
  };
@@ -2,40 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWeightedMeans = getWeightedMeans;
4
4
  const util_1 = require("../util");
5
- // based on "weighted mean" method from https://github.com/tpoorten/dotPlotly
6
- // License reproduced here
7
- //
8
- // MIT License
9
- // Copyright (c) 2017 Tom Poorten
10
- // Permission is hereby granted, free of charge, to any person obtaining a copy
11
- // of this software and associated documentation files (the "Software"), to deal
12
- // in the Software without restriction, including without limitation the rights
13
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- // copies of the Software, and to permit persons to whom the Software is
15
- // furnished to do so, subject to the following conditions:
16
- // The above copyright notice and this permission notice shall be included in all
17
- // copies or substantial portions of the Software.
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- // SOFTWARE.
25
- //
26
- // Notes: in the weighted mean longer alignments factor in more heavily of all
27
- // the fragments of a query vs the reference that it mapped to
28
- //
29
- // this uses a combined key query+'-'+ref to iteratively map all the alignments
30
- // that match a particular ref from a particular query (so 1d array of what
31
- // could be a 2d map)
32
- //
33
- // the result is a single number that says e.g. chr5 from human mapped to chr5
34
- // on mouse with 0.8 quality, and that0.8 is then attached to all the pieces of
35
- // chr5 on human that mapped to chr5 on mouse. if chr5 on human also more
36
- // weakly mapped to chr6 on mouse, then it would have another value e.g. 0.6.
37
- // this can show strong and weak levels of synteny, especially in polyploidy
38
- // situations
39
5
  function getWeightedMeans(ret) {
40
6
  const scoreMap = {};
41
7
  for (const entry of ret) {
@@ -45,7 +11,7 @@ function getWeightedMeans(ret) {
45
11
  if (!scoreMap[key]) {
46
12
  scoreMap[key] = { quals: [], len: [] };
47
13
  }
48
- scoreMap[key].quals.push(entry.extra.mappingQual);
14
+ scoreMap[key].quals.push(entry.extra.mappingQual || 1);
49
15
  scoreMap[key].len.push(entry.extra.blockLen || 1);
50
16
  }
51
17
  const meanScoreMap = Object.fromEntries(Object.entries(scoreMap).map(([key, val]) => {
@@ -70,7 +36,6 @@ function getWeightedMeans(ret) {
70
36
  }
71
37
  return ret;
72
38
  }
73
- // https://gist.github.com/stekhn/a12ed417e91f90ecec14bcfa4c2ae16a
74
39
  function weightedMean(tuples) {
75
40
  const [valueSum, weightSum] = tuples.reduce(([valueSum, weightSum], [value, weight]) => [
76
41
  valueSum + value * weight,
@@ -1,10 +1,11 @@
1
- import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { Region } from '@jbrowse/core/util/types';
3
- import { Feature } from '@jbrowse/core/util';
4
- import { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
- import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
6
- import PluginManager from '@jbrowse/core/PluginManager';
7
1
  import { TabixIndexedFile } from '@gmod/tabix';
2
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import type PluginManager from '@jbrowse/core/PluginManager';
4
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
6
+ import type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
7
+ import type { Feature } from '@jbrowse/core/util';
8
+ import type { Region } from '@jbrowse/core/util/types';
8
9
  interface PAFOptions extends BaseOptions {
9
10
  config?: AnyConfigurationModel;
10
11
  }
@@ -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 tabix_1 = require("@gmod/tabix");
6
7
  const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
7
- const rxjs_1 = require("@jbrowse/core/util/rxjs");
8
8
  const io_1 = require("@jbrowse/core/util/io");
9
- const tabix_1 = require("@gmod/tabix");
10
- // locals
11
- const util_1 = require("../util");
9
+ const rxjs_1 = require("@jbrowse/core/util/rxjs");
12
10
  const SyntenyFeature_1 = __importDefault(require("../SyntenyFeature"));
11
+ const util_1 = require("../util");
13
12
  class PAFAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
14
13
  constructor(config, getSubAdapter, pluginManager) {
15
14
  super(config, getSubAdapter, pluginManager);
@@ -98,12 +97,12 @@ class PAFAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
98
97
  },
99
98
  }));
100
99
  },
101
- signal: opts.signal,
100
+ stopToken: opts.stopToken,
102
101
  });
103
102
  observer.complete();
104
103
  });
105
104
  }
106
- freeResources( /* { query } */) { }
105
+ freeResources() { }
107
106
  }
108
107
  PAFAdapter.capabilities = ['getFeatures', 'getRefNames'];
109
108
  exports.default = PAFAdapter;
@@ -1,31 +1,19 @@
1
1
  declare const PairwiseIndexedPAFAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  assemblyNames: {
6
3
  type: string;
7
4
  defaultValue: never[];
8
5
  description: string;
9
6
  };
10
- /**
11
- * #slot
12
- */
13
7
  targetAssembly: {
14
8
  type: string;
15
9
  defaultValue: string;
16
10
  description: string;
17
11
  };
18
- /**
19
- * #slot
20
- */
21
12
  queryAssembly: {
22
13
  type: string;
23
14
  defaultValue: string;
24
15
  description: string;
25
16
  };
26
- /**
27
- * #slot
28
- */
29
17
  pifGzLocation: {
30
18
  type: string;
31
19
  description: string;
@@ -34,21 +22,12 @@ declare const PairwiseIndexedPAFAdapter: import("@jbrowse/core/configuration/con
34
22
  locationType: string;
35
23
  };
36
24
  };
37
- /**
38
- * #slot
39
- */
40
25
  index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
41
- /**
42
- * #slot index.indexType
43
- */
44
26
  indexType: {
45
27
  model: import("mobx-state-tree").ISimpleType<string>;
46
28
  type: string;
47
29
  defaultValue: string;
48
30
  };
49
- /**
50
- * #slot index.location
51
- */
52
31
  location: {
53
32
  type: string;
54
33
  defaultValue: {
@@ -2,38 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
4
  const mobx_state_tree_1 = require("mobx-state-tree");
5
- /**
6
- * #config PairwiseIndexedPAFAdapter
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ function x() { }
9
6
  const PairwiseIndexedPAFAdapter = (0, configuration_1.ConfigurationSchema)('PairwiseIndexedPAFAdapter', {
10
- /**
11
- * #slot
12
- */
13
7
  assemblyNames: {
14
8
  type: 'stringArray',
15
9
  defaultValue: [],
16
10
  description: 'Array of assembly names to use for this file. The query assembly name is the first value in the array, target assembly name is the second',
17
11
  },
18
- /**
19
- * #slot
20
- */
21
12
  targetAssembly: {
22
13
  type: 'string',
23
14
  defaultValue: '',
24
15
  description: 'Alternative to assemblyNames: the target assembly name',
25
16
  },
26
- /**
27
- * #slot
28
- */
29
17
  queryAssembly: {
30
18
  type: 'string',
31
19
  defaultValue: '',
32
20
  description: 'Alternative to assemblyNames: the query assembly name',
33
21
  },
34
- /**
35
- * #slot
36
- */
37
22
  pifGzLocation: {
38
23
  type: 'fileLocation',
39
24
  description: 'location of pairwise tabix indexed PAF (pif)',
@@ -42,21 +27,12 @@ const PairwiseIndexedPAFAdapter = (0, configuration_1.ConfigurationSchema)('Pair
42
27
  locationType: 'UriLocation',
43
28
  },
44
29
  },
45
- /**
46
- * #slot
47
- */
48
30
  index: (0, configuration_1.ConfigurationSchema)('TabixIndex', {
49
- /**
50
- * #slot index.indexType
51
- */
52
31
  indexType: {
53
32
  model: mobx_state_tree_1.types.enumeration('IndexType', ['TBI', 'CSI']),
54
33
  type: 'stringEnum',
55
34
  defaultValue: 'TBI',
56
35
  },
57
- /**
58
- * #slot index.location
59
- */
60
36
  location: {
61
37
  type: 'fileLocation',
62
38
  defaultValue: {
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function PairwiseIndexedPAFAdapterF(pluginManager: PluginManager): void;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const util_1 = require("@jbrowse/core/util");
4
4
  const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
5
- // locals
6
5
  const { getMismatches } = plugin_alignments_1.MismatchParser;
7
6
  class SyntenyFeature extends util_1.SimpleFeature {
8
7
  get(arg) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import PluginManager from '@jbrowse/core/PluginManager';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class ComparativeAdaptersPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/dist/index.js CHANGED
@@ -4,14 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
7
- const PAFAdapter_1 = __importDefault(require("./PAFAdapter"));
8
- const PairwiseIndexedPAFAdapter_1 = __importDefault(require("./PairwiseIndexedPAFAdapter"));
7
+ const tracks_1 = require("@jbrowse/core/util/tracks");
8
+ const BlastTabularAdapter_1 = __importDefault(require("./BlastTabularAdapter"));
9
+ const ChainAdapter_1 = __importDefault(require("./ChainAdapter"));
10
+ const DeltaAdapter_1 = __importDefault(require("./DeltaAdapter"));
9
11
  const MCScanAnchorsAdapter_1 = __importDefault(require("./MCScanAnchorsAdapter"));
10
12
  const MCScanSimpleAnchorsAdapter_1 = __importDefault(require("./MCScanSimpleAnchorsAdapter"));
11
13
  const MashMapAdapter_1 = __importDefault(require("./MashMapAdapter"));
12
- const DeltaAdapter_1 = __importDefault(require("./DeltaAdapter"));
13
- const ChainAdapter_1 = __importDefault(require("./ChainAdapter"));
14
- const tracks_1 = require("@jbrowse/core/util/tracks");
14
+ const PAFAdapter_1 = __importDefault(require("./PAFAdapter"));
15
+ const PairwiseIndexedPAFAdapter_1 = __importDefault(require("./PairwiseIndexedPAFAdapter"));
15
16
  class ComparativeAdaptersPlugin extends Plugin_1.default {
16
17
  constructor() {
17
18
  super(...arguments);
@@ -25,6 +26,7 @@ class ComparativeAdaptersPlugin extends Plugin_1.default {
25
26
  (0, MCScanAnchorsAdapter_1.default)(pluginManager);
26
27
  (0, MCScanSimpleAnchorsAdapter_1.default)(pluginManager);
27
28
  (0, MashMapAdapter_1.default)(pluginManager);
29
+ (0, BlastTabularAdapter_1.default)(pluginManager);
28
30
  pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
29
31
  return (file, index, adapterHint) => {
30
32
  const regexGuess = /\.paf/i;
package/dist/util.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { GenericFilehandle } from 'generic-filehandle';
1
+ import type { PAFRecord } from './PAFAdapter/util';
2
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
3
  import type { Buffer } from 'buffer';
4
- import { PAFRecord } from './PAFAdapter/util';
4
+ import type { GenericFilehandle } from 'generic-filehandle';
5
5
  export declare function parseBed(text: string): Map<string | undefined, {
6
6
  refName: string | undefined;
7
7
  start: number;
@@ -12,7 +12,7 @@ export declare function parseBed(text: string): Map<string | undefined, {
12
12
  }>;
13
13
  export declare function readFile(file: GenericFilehandle, opts?: BaseOptions): Promise<string>;
14
14
  export declare function zip(a: number[], b: number[]): [number, number][];
15
- export declare function parseLineByLine(buffer: Buffer, cb: (line: string) => PAFRecord): PAFRecord[];
15
+ export declare function parseLineByLine<T>(buffer: Buffer, cb: (line: string) => T | undefined): T[];
16
16
  export declare function parsePAFLine(line: string): PAFRecord;
17
17
  export declare function flipCigar(cigar: string[]): (string | undefined)[];
18
18
  export declare function swapIndelCigar(cigar: string): string;
package/dist/util.js CHANGED
@@ -7,7 +7,6 @@ exports.parseLineByLine = parseLineByLine;
7
7
  exports.parsePAFLine = parsePAFLine;
8
8
  exports.flipCigar = flipCigar;
9
9
  exports.swapIndelCigar = swapIndelCigar;
10
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
11
10
  const util_1 = require("@jbrowse/core/util");
12
11
  function parseBed(text) {
13
12
  return new Map(text
@@ -29,25 +28,29 @@ function parseBed(text) {
29
28
  }));
30
29
  }
31
30
  async function readFile(file, opts) {
32
- const buffer = (await file.readFile(opts));
33
- return new TextDecoder('utf8', { fatal: true }).decode((0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer);
31
+ const buf = await (0, util_1.fetchAndMaybeUnzip)(file, opts);
32
+ const decoder = new TextDecoder('utf8');
33
+ return decoder.decode(buf);
34
34
  }
35
35
  function zip(a, b) {
36
36
  return a.map((e, i) => [e, b[i]]);
37
37
  }
38
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
39
38
  function parseLineByLine(buffer, cb) {
40
39
  let blockStart = 0;
41
40
  const entries = [];
41
+ const decoder = new TextDecoder('utf8');
42
42
  while (blockStart < buffer.length) {
43
43
  const n = buffer.indexOf('\n', blockStart);
44
44
  if (n === -1) {
45
45
  break;
46
46
  }
47
47
  const b = buffer.subarray(blockStart, n);
48
- const line = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
48
+ const line = decoder.decode(b).trim();
49
49
  if (line) {
50
- entries.push(cb(line));
50
+ const entry = cb(line);
51
+ if (entry) {
52
+ entries.push(entry);
53
+ }
51
54
  }
52
55
  blockStart = n + 1;
53
56
  }
@@ -0,0 +1,66 @@
1
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import type { Feature, Region } from '@jbrowse/core/util';
4
+ interface BlastColumns {
5
+ qseqid?: string;
6
+ qgi?: string;
7
+ qacc?: string;
8
+ sseqid?: string;
9
+ sallseqid?: string;
10
+ sgi?: string;
11
+ sallgi?: string;
12
+ sacc?: string;
13
+ sallacc?: string;
14
+ qstart?: number;
15
+ qend?: number;
16
+ sstart?: number;
17
+ send?: number;
18
+ qseq?: string;
19
+ sseq?: string;
20
+ evalue?: string;
21
+ bitscore?: string;
22
+ score?: string;
23
+ length?: string;
24
+ pident?: string;
25
+ nident?: string;
26
+ mismatch?: string;
27
+ positive?: string;
28
+ gapopen?: string;
29
+ gaps?: string;
30
+ ppos?: string;
31
+ frames?: string;
32
+ qframe?: string;
33
+ sframe?: string;
34
+ btop?: string;
35
+ staxids?: string;
36
+ sscinames?: string;
37
+ scomnames?: string;
38
+ sblastnames?: string;
39
+ sskingdoms?: string;
40
+ stitle?: string;
41
+ salltitles?: string;
42
+ sstrand?: string;
43
+ qcovs?: string;
44
+ qcovhsp?: string;
45
+ qcovus?: string;
46
+ }
47
+ interface BlastRecord extends BlastColumns {
48
+ qseqid: string;
49
+ sseqid: string;
50
+ qstart: number;
51
+ qend: number;
52
+ sstart: number;
53
+ send: number;
54
+ }
55
+ export default class BlastTabularAdapter extends BaseFeatureDataAdapter {
56
+ private data;
57
+ static capabilities: string[];
58
+ getData(opts?: BaseOptions): Promise<BlastRecord[]>;
59
+ setup(opts?: BaseOptions): Promise<BlastRecord[]>;
60
+ hasDataForRefName(): Promise<boolean>;
61
+ getAssemblyNames(): string[];
62
+ getRefNames(opts?: BaseOptions): Promise<string[]>;
63
+ getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
64
+ freeResources(): void;
65
+ }
66
+ export {};