@jbrowse/plugin-comparative-adapters 2.16.0 → 2.17.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 (47) hide show
  1. package/dist/BlastTabularAdapter/BlastTabularAdapter.d.ts +120 -0
  2. package/dist/BlastTabularAdapter/BlastTabularAdapter.js +207 -0
  3. package/dist/BlastTabularAdapter/configSchema.d.ts +45 -0
  4. package/dist/BlastTabularAdapter/configSchema.js +52 -0
  5. package/dist/BlastTabularAdapter/index.d.ts +2 -0
  6. package/dist/BlastTabularAdapter/index.js +42 -0
  7. package/dist/ChainAdapter/ChainAdapter.js +1 -3
  8. package/dist/ChainAdapter/configSchema.js +1 -1
  9. package/dist/ChainAdapter/util.js +2 -2
  10. package/dist/DeltaAdapter/DeltaAdapter.js +1 -3
  11. package/dist/DeltaAdapter/configSchema.js +5 -2
  12. package/dist/DeltaAdapter/util.js +2 -2
  13. package/dist/MashMapAdapter/MashMapAdapter.d.ts +12 -1
  14. package/dist/MashMapAdapter/MashMapAdapter.js +1 -3
  15. package/dist/MashMapAdapter/configSchema.js +1 -1
  16. package/dist/PAFAdapter/PAFAdapter.js +4 -6
  17. package/dist/PAFAdapter/configSchema.js +1 -1
  18. package/dist/PAFAdapter/util.d.ts +1 -1
  19. package/dist/PAFAdapter/util.js +1 -1
  20. package/dist/PairwiseIndexedPAFAdapter/configSchema.js +1 -1
  21. package/dist/index.js +2 -0
  22. package/dist/util.d.ts +1 -1
  23. package/dist/util.js +9 -6
  24. package/esm/BlastTabularAdapter/BlastTabularAdapter.d.ts +120 -0
  25. package/esm/BlastTabularAdapter/BlastTabularAdapter.js +202 -0
  26. package/esm/BlastTabularAdapter/configSchema.d.ts +45 -0
  27. package/esm/BlastTabularAdapter/configSchema.js +50 -0
  28. package/esm/BlastTabularAdapter/index.d.ts +2 -0
  29. package/esm/BlastTabularAdapter/index.js +13 -0
  30. package/esm/ChainAdapter/ChainAdapter.js +2 -4
  31. package/esm/ChainAdapter/configSchema.js +1 -1
  32. package/esm/ChainAdapter/util.js +2 -2
  33. package/esm/DeltaAdapter/DeltaAdapter.js +2 -4
  34. package/esm/DeltaAdapter/configSchema.js +5 -2
  35. package/esm/DeltaAdapter/util.js +2 -2
  36. package/esm/MashMapAdapter/MashMapAdapter.d.ts +12 -1
  37. package/esm/MashMapAdapter/MashMapAdapter.js +2 -4
  38. package/esm/MashMapAdapter/configSchema.js +1 -1
  39. package/esm/PAFAdapter/PAFAdapter.js +5 -7
  40. package/esm/PAFAdapter/configSchema.js +1 -1
  41. package/esm/PAFAdapter/util.d.ts +1 -1
  42. package/esm/PAFAdapter/util.js +1 -1
  43. package/esm/PairwiseIndexedPAFAdapter/configSchema.js +1 -1
  44. package/esm/index.js +2 -0
  45. package/esm/util.d.ts +1 -1
  46. package/esm/util.js +10 -7
  47. package/package.json +2 -2
@@ -0,0 +1,120 @@
1
+ import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
+ import { Feature, Region } from '@jbrowse/core/util';
3
+ interface BlastColumns {
4
+ /** Query Seq-id */
5
+ qseqid?: string;
6
+ /** Query GI */
7
+ qgi?: string;
8
+ /** Query accesion */
9
+ qacc?: string;
10
+ /** Subject Seq-id */
11
+ sseqid?: string;
12
+ /** All subject Seq-id(s), separated by a ';' */
13
+ sallseqid?: string;
14
+ /** Subject GI */
15
+ sgi?: string;
16
+ /** All subject GIs */
17
+ sallgi?: string;
18
+ /** Subject accession */
19
+ sacc?: string;
20
+ /** All subject accessions */
21
+ sallacc?: string;
22
+ /** Start of alignment in query */
23
+ qstart?: number;
24
+ /** End of alignment in query */
25
+ qend?: number;
26
+ /** Start of alignment in subject */
27
+ sstart?: number;
28
+ /** End of alignment in subject */
29
+ send?: number;
30
+ /** Aligned part of query sequence */
31
+ qseq?: string;
32
+ /** Aligned part of subject sequence */
33
+ sseq?: string;
34
+ /** Expect value */
35
+ evalue?: string;
36
+ /** Bit score */
37
+ bitscore?: string;
38
+ /** Raw score */
39
+ score?: string;
40
+ /** Alignment length */
41
+ length?: string;
42
+ /** Percentage of identical matches */
43
+ pident?: string;
44
+ /** Number of identical matches */
45
+ nident?: string;
46
+ /** Number of mismatches */
47
+ mismatch?: string;
48
+ /** Number of positive-scoring matches */
49
+ positive?: string;
50
+ /** Number of gap openings */
51
+ gapopen?: string;
52
+ /** Total number of gap */
53
+ gaps?: string;
54
+ /** Percentage of positive-scoring matches */
55
+ ppos?: string;
56
+ /** Query and subject frames separated by a '/' */
57
+ frames?: string;
58
+ /** Query frame */
59
+ qframe?: string;
60
+ /** Subject frame */
61
+ sframe?: string;
62
+ /** Blast traceback operations (BTOP) */
63
+ btop?: string;
64
+ /** Unique Subject Taxonomy ID(s), separated by a ';'(in numerical order) */
65
+ staxids?: string;
66
+ /** Unique Subject Scientific Name(s), separated by a ';' */
67
+ sscinames?: string;
68
+ /** Unique Subject Common Name(s), separated by a ';' */
69
+ scomnames?: string;
70
+ /**
71
+ * Unique Subject Blast Name(s), separated by a ';' (in alphabetical order)
72
+ */
73
+ sblastnames?: string;
74
+ /**
75
+ * Unique Subject Super Kingdom(s), separated by a ';' (in alphabetical order)
76
+ */
77
+ sskingdoms?: string;
78
+ /** Subject Title */
79
+ stitle?: string;
80
+ /** All Subject Title(s), separated by a '<>' */
81
+ salltitles?: string;
82
+ /** Subject Strand */
83
+ sstrand?: string;
84
+ /** Query Coverage Per Subject (for all HSPs) */
85
+ qcovs?: string;
86
+ /** Query Coverage Per HSP */
87
+ qcovhsp?: string;
88
+ /**
89
+ * A measure of Query Coverage that counts a position in a subject sequence
90
+ * for this measure only once. The second time the position is aligned to the
91
+ * query is not counted towards this measure.
92
+ */
93
+ qcovus?: string;
94
+ }
95
+ interface BlastRecord extends BlastColumns {
96
+ /** Query Seq-id */
97
+ qseqid: string;
98
+ /** Subject Seq-id */
99
+ sseqid: string;
100
+ /** Start of alignment in query */
101
+ qstart: number;
102
+ /** End of alignment in query */
103
+ qend: number;
104
+ /** Start of alignment in subject */
105
+ sstart: number;
106
+ /** End of alignment in subject */
107
+ send: number;
108
+ }
109
+ export default class BlastTabularAdapter extends BaseFeatureDataAdapter {
110
+ private data;
111
+ static capabilities: string[];
112
+ getData(opts?: BaseOptions): Promise<BlastRecord[]>;
113
+ setup(opts?: BaseOptions): Promise<BlastRecord[]>;
114
+ hasDataForRefName(): Promise<boolean>;
115
+ getAssemblyNames(): string[];
116
+ getRefNames(opts?: BaseOptions): Promise<string[]>;
117
+ getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
118
+ freeResources(): void;
119
+ }
120
+ export {};
@@ -0,0 +1,207 @@
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 configuration_1 = require("@jbrowse/core/configuration");
7
+ const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
8
+ const rxjs_1 = require("@jbrowse/core/util/rxjs");
9
+ const util_1 = require("@jbrowse/core/util");
10
+ const io_1 = require("@jbrowse/core/util/io");
11
+ const util_2 = require("../util");
12
+ const SyntenyFeature_1 = __importDefault(require("../SyntenyFeature"));
13
+ function createBlastLineParser(columns) {
14
+ const columnNames = columns.trim().split(' ');
15
+ const qseqidIndex = columnNames.indexOf('qseqid');
16
+ if (qseqidIndex === -1) {
17
+ throw new Error('Missing required column "qseqid"');
18
+ }
19
+ const sseqidIndex = columnNames.indexOf('sseqid');
20
+ if (sseqidIndex === -1) {
21
+ throw new Error('Missing required column "sseqid"');
22
+ }
23
+ const qstartIndex = columnNames.indexOf('qstart');
24
+ if (qstartIndex === -1) {
25
+ throw new Error('Missing required column "qstart"');
26
+ }
27
+ const qendIndex = columnNames.indexOf('qend');
28
+ if (qendIndex === -1) {
29
+ throw new Error('Missing required column "qend"');
30
+ }
31
+ const sstartIndex = columnNames.indexOf('sstart');
32
+ if (sstartIndex === -1) {
33
+ throw new Error('Missing required column "sstart"');
34
+ }
35
+ const sendIndex = columnNames.indexOf('send');
36
+ if (sendIndex === -1) {
37
+ throw new Error('Missing required column "send"');
38
+ }
39
+ const columnNameSet = new Map(columnNames
40
+ .map((c, idx) => [c, idx])
41
+ .filter(f => !['qseqid', 'sseqid', 'qstart', 'qend', 'sstart', 'send'].includes(f[0])));
42
+ return (line) => {
43
+ if (line.startsWith('#')) {
44
+ return;
45
+ }
46
+ const row = line.split('\t');
47
+ const qseqid = row[qseqidIndex];
48
+ const sseqid = row[sseqidIndex];
49
+ const qstart = row[qstartIndex];
50
+ const qend = row[qendIndex];
51
+ const sstart = row[sstartIndex];
52
+ const send = row[sendIndex];
53
+ if (!(qseqid && sseqid && qstart && qend && sstart && send)) {
54
+ console.warn('Invalid BLAST line');
55
+ console.warn(line);
56
+ return;
57
+ }
58
+ const record = {
59
+ qseqid,
60
+ sseqid,
61
+ qstart: Number.parseInt(qstart),
62
+ qend: Number.parseInt(qend),
63
+ sstart: Number.parseInt(sstart),
64
+ send: Number.parseInt(send),
65
+ };
66
+ for (const [columnName, idx] of columnNameSet.entries()) {
67
+ const value = row[idx];
68
+ if (!value) {
69
+ continue;
70
+ }
71
+ // @ts-expect-error
72
+ record[columnName] = value;
73
+ }
74
+ return record;
75
+ };
76
+ }
77
+ class BlastTabularAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
78
+ getData(opts) {
79
+ if (!this.data) {
80
+ this.data = this.setup(opts).catch((e) => {
81
+ this.data = undefined;
82
+ throw e;
83
+ });
84
+ }
85
+ return this.data;
86
+ }
87
+ async setup(opts) {
88
+ const pm = this.pluginManager;
89
+ const buf = await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)((0, configuration_1.readConfObject)(this.config, 'blastTableLocation'), pm), opts);
90
+ const columns = (0, configuration_1.readConfObject)(this.config, 'columns');
91
+ return (0, util_2.parseLineByLine)(buf, createBlastLineParser(columns));
92
+ }
93
+ async hasDataForRefName() {
94
+ // determining this properly is basically a call to getFeatures
95
+ // so is not really that important, and has to be true or else
96
+ // getFeatures is never called (BaseAdapter filters it out)
97
+ return true;
98
+ }
99
+ getAssemblyNames() {
100
+ const assemblyNames = this.getConf('assemblyNames');
101
+ if (assemblyNames.length === 0) {
102
+ const query = this.getConf('queryAssembly');
103
+ const target = this.getConf('targetAssembly');
104
+ return [query, target];
105
+ }
106
+ return assemblyNames;
107
+ }
108
+ async getRefNames(opts = {}) {
109
+ var _a;
110
+ // @ts-expect-error
111
+ const r1 = (_a = opts.regions) === null || _a === void 0 ? void 0 : _a[0].assemblyName;
112
+ const feats = await this.getData(opts);
113
+ const idx = this.getAssemblyNames().indexOf(r1);
114
+ if (idx !== -1) {
115
+ const set = new Set();
116
+ for (const feat of feats) {
117
+ set.add(idx === 0 ? feat.qseqid : feat.sseqid);
118
+ }
119
+ return [...set];
120
+ }
121
+ console.warn('Unable to do ref renaming on adapter');
122
+ return [];
123
+ }
124
+ getFeatures(query, opts = {}) {
125
+ return (0, rxjs_1.ObservableCreate)(async (observer) => {
126
+ const blastRecords = await this.getData(opts);
127
+ const [queryAssembly, targetAssembly] = this.getAssemblyNames();
128
+ // The index of the assembly name in the query list corresponds to the
129
+ // adapter in the subadapters list
130
+ const { refName: queryRefName, assemblyName: queryAssemblyName, start: queryStart, end: queryEnd, } = query;
131
+ if (queryAssemblyName !== targetAssembly &&
132
+ queryAssemblyName !== queryAssembly) {
133
+ console.warn(`${queryAssemblyName} not found in this adapter`);
134
+ observer.complete();
135
+ return;
136
+ }
137
+ for (let i = 0; i < blastRecords.length; i++) {
138
+ const r = blastRecords[i];
139
+ let start;
140
+ let end;
141
+ let refName;
142
+ let assemblyName;
143
+ let mateStart;
144
+ let mateEnd;
145
+ let mateRefName;
146
+ let mateAssemblyName;
147
+ const { qseqid, sseqid, qstart, qend, sstart, send, ...rest } = r;
148
+ if (queryAssemblyName === queryAssembly) {
149
+ start = qstart;
150
+ end = qend;
151
+ refName = qseqid;
152
+ assemblyName = queryAssembly;
153
+ mateStart = sstart;
154
+ mateEnd = send;
155
+ mateRefName = sseqid;
156
+ mateAssemblyName = targetAssembly;
157
+ }
158
+ else {
159
+ start = sstart;
160
+ end = send;
161
+ refName = sseqid;
162
+ assemblyName = targetAssembly;
163
+ mateStart = qstart;
164
+ mateEnd = qend;
165
+ mateRefName = qseqid;
166
+ mateAssemblyName = queryAssembly;
167
+ }
168
+ let strand = 1;
169
+ let mateStrand = 1;
170
+ if (start > end) {
171
+ ;
172
+ [start, end] = [end, start];
173
+ strand = -1;
174
+ }
175
+ if (mateStart > mateEnd) {
176
+ ;
177
+ [mateStart, mateEnd] = [mateEnd, mateStart];
178
+ mateStrand = -1;
179
+ }
180
+ if (refName === queryRefName &&
181
+ (0, util_1.doesIntersect2)(queryStart, queryEnd, start, end)) {
182
+ observer.next(new SyntenyFeature_1.default({
183
+ uniqueId: i + queryAssemblyName,
184
+ assemblyName,
185
+ start,
186
+ end,
187
+ type: 'match',
188
+ refName,
189
+ strand: strand * mateStrand,
190
+ syntenyId: i,
191
+ ...rest,
192
+ mate: {
193
+ start: mateStart,
194
+ end: mateEnd,
195
+ refName: mateRefName,
196
+ assemblyName: mateAssemblyName,
197
+ },
198
+ }));
199
+ }
200
+ }
201
+ observer.complete();
202
+ });
203
+ }
204
+ freeResources( /* { query } */) { }
205
+ }
206
+ BlastTabularAdapter.capabilities = ['getFeatures', 'getRefNames'];
207
+ exports.default = BlastTabularAdapter;
@@ -0,0 +1,45 @@
1
+ declare const BlastTabularAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ /**
3
+ * #slot
4
+ */
5
+ assemblyNames: {
6
+ type: string;
7
+ defaultValue: never[];
8
+ description: string;
9
+ };
10
+ /**
11
+ * #slot
12
+ */
13
+ targetAssembly: {
14
+ type: string;
15
+ defaultValue: string;
16
+ description: string;
17
+ };
18
+ /**
19
+ * #slot
20
+ */
21
+ queryAssembly: {
22
+ type: string;
23
+ defaultValue: string;
24
+ description: string;
25
+ };
26
+ /**
27
+ * #slot
28
+ */
29
+ blastTableLocation: {
30
+ type: string;
31
+ defaultValue: {
32
+ uri: string;
33
+ locationType: string;
34
+ };
35
+ };
36
+ /**
37
+ * #slot
38
+ */
39
+ columns: {
40
+ type: string;
41
+ description: string;
42
+ defaultValue: string;
43
+ };
44
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
45
+ export default BlastTabularAdapter;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const configuration_1 = require("@jbrowse/core/configuration");
4
+ /**
5
+ * #config BlastTabularAdapter
6
+ */
7
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
8
+ const BlastTabularAdapter = (0, configuration_1.ConfigurationSchema)('BlastTabularAdapter', {
9
+ /**
10
+ * #slot
11
+ */
12
+ assemblyNames: {
13
+ type: 'stringArray',
14
+ defaultValue: [],
15
+ description: 'Query assembly is the first value in the array, target assembly is the second',
16
+ },
17
+ /**
18
+ * #slot
19
+ */
20
+ targetAssembly: {
21
+ type: 'string',
22
+ defaultValue: '',
23
+ description: 'Alternative to assemblyNames array: the target assembly',
24
+ },
25
+ /**
26
+ * #slot
27
+ */
28
+ queryAssembly: {
29
+ type: 'string',
30
+ defaultValue: '',
31
+ description: 'Alternative to assemblyNames array: the query assembly',
32
+ },
33
+ /**
34
+ * #slot
35
+ */
36
+ blastTableLocation: {
37
+ type: 'fileLocation',
38
+ defaultValue: {
39
+ uri: '/path/to/blastTable.tsv',
40
+ locationType: 'UriLocation',
41
+ },
42
+ },
43
+ /**
44
+ * #slot
45
+ */
46
+ columns: {
47
+ type: 'string',
48
+ description: 'Optional space-separated column name list. If custom columns were used in outfmt, enter them here exactly as specified in the command. At least qseqid, sseqid, qstart, qend, sstart, and send are required',
49
+ defaultValue: 'qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore',
50
+ },
51
+ }, { explicitlyTyped: true });
52
+ exports.default = BlastTabularAdapter;
@@ -0,0 +1,2 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function BlastTabularAdapterF(pluginManager: PluginManager): void;
@@ -0,0 +1,42 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.default = BlastTabularAdapterF;
30
+ const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
31
+ const configSchema_1 = __importDefault(require("./configSchema"));
32
+ function BlastTabularAdapterF(pluginManager) {
33
+ pluginManager.addAdapterType(() => new AdapterType_1.default({
34
+ name: 'BlastTabularAdapter',
35
+ displayName: 'Tabular BLAST output adapter',
36
+ configSchema: configSchema_1.default,
37
+ adapterMetadata: {
38
+ hiddenFromGUI: true,
39
+ },
40
+ getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BlastTabularAdapter'))).then(r => r.default),
41
+ }));
42
+ }
@@ -5,15 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const io_1 = require("@jbrowse/core/util/io");
7
7
  const util_1 = require("@jbrowse/core/util");
8
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
9
8
  // locals
10
9
  const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
11
10
  const util_2 = require("./util");
12
11
  class ChainAdapter extends PAFAdapter_1.default {
13
12
  async setupPre(opts) {
14
13
  const loc = (0, io_1.openLocation)(this.getConf('chainLocation'), this.pluginManager);
15
- const buffer = (await loc.readFile(opts));
16
- const buf = (0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
14
+ const buf = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
17
15
  return (0, util_2.paf_chain2paf)(buf);
18
16
  }
19
17
  }
@@ -13,7 +13,7 @@ const ChainAdapter = (0, configuration_1.ConfigurationSchema)('ChainAdapter', {
13
13
  assemblyNames: {
14
14
  type: 'stringArray',
15
15
  defaultValue: [],
16
- description: 'Target is the first value in the array, query is the second',
16
+ 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
17
  },
18
18
  /**
19
19
  * #slot
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paf_chain2paf = paf_chain2paf;
4
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
5
4
  /* adapted from chain2paf by Andrea Guarracino, license reproduced below
6
5
  *
7
6
  * MIT License
@@ -56,13 +55,14 @@ function paf_chain2paf(buffer) {
56
55
  let cigar = '';
57
56
  const records = [];
58
57
  let blockStart = 0;
58
+ const decoder = new TextDecoder('utf8');
59
59
  while (blockStart < buffer.length) {
60
60
  const n = buffer.indexOf('\n', blockStart);
61
61
  if (n === -1) {
62
62
  break;
63
63
  }
64
64
  const b = buffer.subarray(blockStart, n);
65
- const l = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
65
+ const l = decoder.decode(b).trim();
66
66
  blockStart = n + 1;
67
67
  const l_tab = l.replaceAll(' ', '\t'); // There are CHAIN files with space-separated fields
68
68
  const l_vec = l_tab.split('\t');
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const io_1 = require("@jbrowse/core/util/io");
7
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
8
7
  const util_1 = require("@jbrowse/core/util");
9
8
  // locals
10
9
  const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
@@ -12,8 +11,7 @@ const util_2 = require("./util");
12
11
  class DeltaAdapter extends PAFAdapter_1.default {
13
12
  async setupPre(opts) {
14
13
  const loc = (0, io_1.openLocation)(this.getConf('deltaLocation'), this.pluginManager);
15
- const buffer = (await loc.readFile(opts));
16
- const buf = (0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
14
+ const buf = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
17
15
  return (0, util_2.paf_delta2paf)(buf);
18
16
  }
19
17
  }
@@ -13,7 +13,7 @@ const DeltaAdapter = (0, configuration_1.ConfigurationSchema)('DeltaAdapter', {
13
13
  assemblyNames: {
14
14
  type: 'stringArray',
15
15
  defaultValue: [],
16
- description: 'Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second',
16
+ 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
17
  },
18
18
  /**
19
19
  * #slot
@@ -38,7 +38,10 @@ const DeltaAdapter = (0, configuration_1.ConfigurationSchema)('DeltaAdapter', {
38
38
  */
39
39
  deltaLocation: {
40
40
  type: 'fileLocation',
41
- defaultValue: { uri: '/path/to/file.delta', locationType: 'UriLocation' },
41
+ defaultValue: {
42
+ uri: '/path/to/file.delta',
43
+ locationType: 'UriLocation',
44
+ },
42
45
  },
43
46
  }, { explicitlyTyped: true });
44
47
  exports.default = DeltaAdapter;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paf_delta2paf = paf_delta2paf;
4
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
5
4
  /* paf2delta from paftools.js in the minimap2 repository, license reproduced below
6
5
  *
7
6
  * The MIT License
@@ -46,13 +45,14 @@ function paf_delta2paf(buffer) {
46
45
  const regex = new RegExp(/^>(\S+)\s+(\S+)\s+(\d+)\s+(\d+)/);
47
46
  let blockStart = 0;
48
47
  let i = 0;
48
+ const decoder = new TextDecoder('utf8');
49
49
  while (blockStart < buffer.length) {
50
50
  const n = buffer.indexOf('\n', blockStart);
51
51
  if (n === -1) {
52
52
  break;
53
53
  }
54
54
  const b = buffer.subarray(blockStart, n);
55
- const line = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
55
+ const line = decoder.decode(b).trim();
56
56
  blockStart = n + 1;
57
57
  i++;
58
58
  if (line) {
@@ -1,5 +1,16 @@
1
1
  import { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
2
  import PAFAdapter from '../PAFAdapter/PAFAdapter';
3
3
  export default class MashMapAdapter extends PAFAdapter {
4
- setupPre(opts?: BaseOptions): Promise<import("../PAFAdapter/util").PAFRecord[]>;
4
+ setupPre(opts?: BaseOptions): Promise<{
5
+ tname: string;
6
+ tstart: number;
7
+ tend: number;
8
+ qname: string;
9
+ qstart: number;
10
+ qend: number;
11
+ strand: number;
12
+ extra: {
13
+ mappingQual: number;
14
+ };
15
+ }[]>;
5
16
  }
@@ -4,15 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const io_1 = require("@jbrowse/core/util/io");
7
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
8
7
  const util_1 = require("@jbrowse/core/util");
9
8
  const PAFAdapter_1 = __importDefault(require("../PAFAdapter/PAFAdapter"));
10
9
  const util_2 = require("../util");
11
10
  class MashMapAdapter extends PAFAdapter_1.default {
12
11
  async setupPre(opts) {
13
12
  const outLoc = (0, io_1.openLocation)(this.getConf('outLocation'), this.pluginManager);
14
- const buffer = (await outLoc.readFile(opts));
15
- const buf = (0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
13
+ const buf = await (0, util_1.fetchAndMaybeUnzip)(outLoc, opts);
16
14
  return (0, util_2.parseLineByLine)(buf, parseMashMapLine);
17
15
  }
18
16
  }
@@ -12,7 +12,7 @@ const MashMapAdapter = (0, configuration_1.ConfigurationSchema)('MashMapAdapter'
12
12
  assemblyNames: {
13
13
  type: 'stringArray',
14
14
  defaultValue: [],
15
- description: 'Target is the first value in the array, query is the second',
15
+ 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
16
  },
17
17
  /**
18
18
  * #slot
@@ -9,7 +9,6 @@ const io_1 = require("@jbrowse/core/util/io");
9
9
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
10
10
  const util_1 = require("@jbrowse/core/util");
11
11
  const configuration_1 = require("@jbrowse/core/configuration");
12
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
13
12
  const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
14
13
  // locals
15
14
  const SyntenyFeature_1 = __importDefault(require("../SyntenyFeature"));
@@ -29,14 +28,13 @@ class PAFAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
29
28
  async setupPre(opts) {
30
29
  const pm = this.pluginManager;
31
30
  const pafLocation = (0, io_1.openLocation)(this.getConf('pafLocation'), pm);
32
- const buffer = (await pafLocation.readFile(opts));
33
- const buf = (0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
31
+ const buf = await (0, util_1.fetchAndMaybeUnzip)(pafLocation, opts);
34
32
  return (0, util_2.parseLineByLine)(buf, util_2.parsePAFLine);
35
33
  }
36
34
  async hasDataForRefName() {
37
- // determining this properly is basically a call to getFeatures
38
- // so is not really that important, and has to be true or else
39
- // getFeatures is never called (BaseAdapter filters it out)
35
+ // determining this properly is basically a call to getFeatures so is not
36
+ // really that important, and has to be true or else getFeatures is never
37
+ // called (BaseAdapter filters it out)
40
38
  return true;
41
39
  }
42
40
  getAssemblyNames() {
@@ -12,7 +12,7 @@ const PAFAdapter = (0, configuration_1.ConfigurationSchema)('PAFAdapter', {
12
12
  assemblyNames: {
13
13
  type: 'stringArray',
14
14
  defaultValue: [],
15
- description: 'Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second',
15
+ 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
16
  },
17
17
  /**
18
18
  * #slot