@gmod/gbz-base 1.0.0 → 2.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.
package/README.md CHANGED
@@ -1,45 +1,131 @@
1
1
  # @gmod/gbz-base
2
2
 
3
- A pure TypeScript reader for [gbz-base](https://github.com/jltsiren/gbz-base)
4
- pangenome databases (`.gbz.db`). It answers the same subgraph queries as
5
- `gbz-base query`, reading only the SQLite pages a query touches, so a
6
- multi-gigabyte database on an HTTP server is queried through range requests
7
- without downloading it or compiling anything to WebAssembly.
3
+ [![NPM version](https://img.shields.io/npm/v/@gmod/gbz-base.svg?style=flat-square)](https://npmjs.org/package/@gmod/gbz-base)
4
+ ![Build Status](https://img.shields.io/github/actions/workflow/status/GMOD/gbz-base-js/publish.yml?branch=main)
8
5
 
9
- No SQLite library is involved. The reader walks the SQLite b-trees directly
10
- (rowid lookups, index seeks, overflow chains) and decodes the GBWT node records
11
- the same way gbwt-rs does. Databases are produced by unmodified upstream
12
- `gbz-base construct`.
6
+ A pure TypeScript reader for [gbz-base](https://github.com/jltsiren/gbz-base)
7
+ pangenome databases (`.gbz.db`).
13
8
 
14
9
  ## Usage
15
10
 
16
11
  ```ts
17
12
  import { RemoteFile } from 'generic-filehandle2'
18
- import { GBZBase, subgraphInInterval } from '@gmod/gbz-base'
13
+ import { GBZBase } from '@gmod/gbz-base'
19
14
 
20
15
  const db = await GBZBase.open(
21
16
  new RemoteFile('https://example.org/graph.gbz.db'),
22
17
  )
23
- const subgraph = await subgraphInInterval(
24
- db,
25
- { sample: 'GRCh38', contig: 'chr6' },
18
+
19
+ // one record per haplotype fragment crossing the window
20
+ const alignments = await db.getAlignmentsForRange(
21
+ 'GRCh38#0#chr6',
22
+ 31500000,
23
+ 31501000,
24
+ )
25
+
26
+ // the same window as a subgraph, for a pangenome view
27
+ const subgraph = await db.getSubgraphForRange(
28
+ 'GRCh38#0#chr6',
26
29
  31500000,
27
30
  31501000,
28
- { context: 0, haplotypes: 'all' },
29
31
  )
30
- const { nodes, edges, paths } = subgraph.toJSON(true)
32
+ const gfa = await subgraph?.toGFA({ names: 'resolved' })
31
33
  ```
32
34
 
33
- `paths[0]` is the reference interval, named `GRCh38#0#chr6[start-end]`. Every
34
- other entry is one haplotype's walk through the subgraph with a `cigar` relative
35
- to the reference, computed like upstream: a node-length-weighted LCS, with the
36
- diverging stretches scored using vg's match, mismatch and gap parameters.
35
+ Coordinates are 0-based half-open, and are offsets along the path you named, so
36
+ `('GRCh38#0#chr6', 31500000, 31501000)` is the same window
37
+ `gbz-base query --interval 31500000..31501000` gives.
38
+
39
+ The path is a PanSN `sample#haplotype#contig` string, or a bare contig for a
40
+ graph whose reference paths have no sample. `{ sample, haplotype, contig }`
41
+ works too, and `parsePathName` is the parser if you want it separately.
42
+
43
+ Both take `{ context, haplotypes, snarls, limit, signal }` and both resolve
44
+ haplotype names when the database can. `signal` is an `AbortSignal`; a query
45
+ checks it between range requests, so an abort stops the next fetch rather than
46
+ the one in flight.
47
+
48
+ ### One returns records, the other a query object
49
+
50
+ `getAlignmentsForRange` hands back data, and spans path fragments — a window
51
+ crossing a boundary queries each fragment and concatenates, which is
52
+ coordinate-correct because a record's `refStart`/`refEnd` are absolute.
53
+
54
+ `getSubgraphForRange` hands back the `Subgraph` itself, because two disjoint
55
+ fragments do not merge into one graph. It answers for the first fragment
56
+ overlapping the window, clamped to it, and `subgraph.referenceInterval` says
57
+ which interval that was. It is `undefined` when the path is unknown, when no
58
+ fragment overlaps the window, or when the clamped window is empty. Use
59
+ `pathFragmentsForRange` to see the fragments yourself, and `hasPath` to ask
60
+ about a path alone.
61
+
62
+ A path that exists but was never indexed for random access throws rather than
63
+ returning nothing — that is a database that needs rebuilding, not an empty
64
+ window.
65
+
66
+ ### What an alignment is
67
+
68
+ ```ts
69
+ for (const alignment of alignments) {
70
+ const { refStart, refEnd, strand, cigar } = alignment
71
+ if (alignment.resolved) {
72
+ console.log(alignment.label, alignment.hapStart, alignment.hapEnd)
73
+ }
74
+ }
75
+ ```
76
+
77
+ `refStart`/`refEnd` are the fragment's span on the reference path you queried.
78
+ They run to node boundaries, so a record can begin before the window you asked
79
+ for and end after it. `cigar` is its alignment to that reference, computed like
80
+ upstream: a node-length-weighted LCS, with the diverging stretches scored using
81
+ vg's match, mismatch and gap parameters. `path` is the walk as node handles,
82
+ `weight` is how many identical haplotypes it stands for, and `start` is its GBWT
83
+ position, which is a property of the graph and so is stable across refetches of
84
+ the same window.
85
+
86
+ Naming a fragment needs the haplotype index described below, and a database
87
+ without one cannot do it, so the record is a union on `resolved` rather than a
88
+ handful of separately-undefined fields. A resolved one adds the `PathName` as
89
+ `name`, its `HG02723#1#JAHEOU010000100.1[4392999-4393486]` rendering as `label`,
90
+ the `pathHandle`, and `hapStart`/`hapEnd` in that haplotype's own coordinates.
91
+
92
+ A haplotype whose walk shares no node with the reference has
93
+ `refEnd <= refStart` and an all-insertion CIGAR; those come back like any other,
94
+ to drop or keep as you like.
95
+
96
+ ### Sources
37
97
 
38
98
  Any object with `read(length, position)` and `stat()` works as a source, so
39
99
  `LocalFile`, `RemoteFile` and `BlobFile` from `generic-filehandle2` all do.
40
100
  Pages are fetched in blocks (64 KiB by default, `blockSize` in the open options)
41
101
  and cached.
42
102
 
103
+ ### Lower-level queries
104
+
105
+ The two above cover the interval query and hide where a contig is stored split
106
+ into path fragments. The four query functions underneath are what
107
+ `gbz-base query` itself does, take a window you have already resolved, and leave
108
+ identification to you:
109
+
110
+ ```ts
111
+ import { subgraphAtOffset, subgraphInInterval } from '@gmod/gbz-base'
112
+
113
+ const subgraph = await subgraphInInterval(
114
+ db,
115
+ { sample: 'GRCh38', contig: 'chr6' },
116
+ 31500000,
117
+ 31501000,
118
+ { context: 0, haplotypes: 'all' },
119
+ )
120
+ await subgraph.identifyPaths()
121
+ const graph = subgraph.toSubgraphJson({ cigar: true, names: 'resolved' })
122
+ const gfa = await subgraph.toGFA({ cigar: true, names: 'resolved' })
123
+ ```
124
+
125
+ `subgraphAtOffset` and `subgraphAroundNodes` are the other two;
126
+ `subgraphBetween` is described under Snarls. They throw for a window that runs
127
+ past the end of a path fragment, where `getAlignmentsForRange` clamps.
128
+
43
129
  The command line mirrors the upstream tool for the query types it supports:
44
130
 
45
131
  ```
@@ -50,6 +136,27 @@ gbz-base-query https://host/graph.gbz.db --contig chrM --offset 1000 --context 5
50
136
  `--stats` reports how many range requests a query made and how many bytes they
51
137
  carried.
52
138
 
139
+ ## Snarls
140
+
141
+ A `.gbz.db` built by upstream `gbz-base construct` stores the top-level chains
142
+ of the snarl decomposition as `next` links on the boundary node records (the
143
+ `chains` and `chain_links` tags say how many). The query functions take a
144
+ `snarls` option that uses them the way upstream's `--snarls` and
145
+ `--extend-snarls` do:
146
+
147
+ - `contained` adds every top-level snarl whose two boundary nodes are both in
148
+ the subgraph. With `context: 0` an interval query returns only the reference
149
+ walk, and this is what brings the variation back without a bp radius.
150
+ - `overlapping` also follows a boundary node whose partner lies outside the
151
+ subgraph, and, when the subgraph holds no chain link at all, walks out to the
152
+ snarl containing it. The subgraph must be connected, so a node query may give
153
+ only one node. A snarl can be far larger than the window (a large deletion, a
154
+ centromere), so set `limit` when using this mode.
155
+
156
+ `subgraphBetween(db, start, end)` is upstream's `--between`: everything between
157
+ two oriented boundary handles of one chain, with no context. On the command line
158
+ these are `--snarls`, `--extend-snarls` and `--between 129+:160+`.
159
+
53
160
  ## Naming haplotypes
54
161
 
55
162
  Upstream gbz-base cannot say which haplotype a subgraph path belongs to, so it
@@ -64,7 +171,27 @@ cd tools/haplotype-index && cargo build --release
64
171
 
65
172
  The second form walks the paths through the database's own node records, so a
66
173
  database whose GBZ is no longer at hand can still be augmented; the two forms
67
- write identical tables.
174
+ write identical tables. Walking a GBZ uses every core (`--threads`).
175
+
176
+ With `--output index.db` the tool writes the same tables into a standalone
177
+ companion database instead, and the reader opens the two side by side:
178
+
179
+ ```
180
+ ./target/release/gbz-haplotype-index --interval 16384 --output graph.haplotype-index.db graph.gbz
181
+ gbz-base-query https://host/graph.gbz.db --haplotype-index https://host/graph.haplotype-index.db ...
182
+ ```
183
+
184
+ ```ts
185
+ const db = await GBZBase.open(new RemoteFile(graphUrl), {
186
+ haplotypeIndex: new RemoteFile(indexUrl),
187
+ })
188
+ ```
189
+
190
+ This is how a database someone else publishes gets haplotype names without
191
+ anyone rehosting it: HPRC publishes `hprc-v2.1-mc-grch38.gbz.db` (10 GB) beside
192
+ its graphs, and the companion for it is built from the 5 GB GBZ. The companion
193
+ records the graph's path count and the reader refuses one built for a different
194
+ graph.
68
195
 
69
196
  `HaplotypeSamples` holds one GBWT position every `--interval` bp along every
70
197
  path in both orientations, with the path handle and the forward coordinate of
@@ -74,15 +201,28 @@ binary keeps working on the augmented database.
74
201
  At query time `subgraph.identifyPaths()` loads the samples for the window's node
75
202
  range in one index scan, chains each haplotype's fragments to the next through
76
203
  the private nodes between them, and walks at most one interval past the window
77
- for a chain that met no sample inside it. `subgraph.alignments()` then gives one
78
- record per fragment: PanSN name, strand, haplotype interval in that contig's
79
- coordinates, reference interval, and a CIGAR clipped to the fragment's own
80
- reference span. `toJSON(cigar, { names: 'resolved' })` names the paths the same
81
- way. On the command line, `--resolve` and `--alignments`.
204
+ for a chain that met no sample inside it. This is what fills in the `resolved`
205
+ half of a feature: PanSN name, haplotype interval in that contig's coordinates,
206
+ and the path handle. `getAlignmentsForRange` and `getSubgraphForRange` run it
207
+ for you when the database has the tables; on the lower-level path you call it
208
+ yourself before `alignments()` or `toSubgraphJson({ names: 'resolved' })`. On
209
+ the command line, `--resolve` and `--alignments`.
82
210
 
83
211
  The tests check every resolved fragment against an independent backward walk
84
212
  through the bidirectional GBWT to the path's recorded start position.
85
213
 
214
+ ## Technical notes
215
+
216
+ It answers the same subgraph queries as `gbz-base query`, reading only the
217
+ SQLite pages a query touches, so a multi-gigabyte database on an HTTP server is
218
+ queried through range requests without downloading it or compiling anything to
219
+ WebAssembly.
220
+
221
+ No SQLite library is involved. The reader walks the SQLite b-trees directly
222
+ (rowid lookups, index seeks, overflow chains) and decodes the GBWT node records
223
+ the same way gbwt-rs does. Databases are produced by unmodified upstream
224
+ `gbz-base construct`.
225
+
86
226
  ## Fidelity
87
227
 
88
228
  `test/data/oracle/` holds JSON written by upstream `gbz-base query` for the
@@ -92,7 +232,7 @@ The test suite requires this library's output to be deep equal to every one of
92
232
  them, CIGAR strings included. `generate.sh` regenerates the oracle with an
93
233
  upstream binary.
94
234
 
95
- Not ported: snarl extension (`--snarls`, `--between`), GFA output, GAF-base.
235
+ Not ported: GAF-base.
96
236
 
97
237
  CIGARs are computed by matching each shared node to its earliest usable
98
238
  occurrence on the reference walk, which is weight-optimal whenever every shared
package/bin/query.js CHANGED
File without changes
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LocalFile, RemoteFile } from 'generic-filehandle2';
2
- import { GBZBase, formatPathName } from "./db.js";
3
- import { subgraphAroundNodes, subgraphAtOffset, subgraphInInterval, } from "./query.js";
2
+ import { GBZBase } from "./db.js";
3
+ import { encodeNode } from "./gbwt/node.js";
4
+ import { subgraphAroundNodes, subgraphAtOffset, subgraphBetween, subgraphInInterval, } from "./query.js";
4
5
  const USAGE = `Usage: gbz-base-query [options] graph.gbz.db
5
6
 
6
7
  --sample STR sample name (default: generic path)
@@ -9,23 +10,38 @@ const USAGE = `Usage: gbz-base-query [options] graph.gbz.db
9
10
  -o, --offset INT sequence offset
10
11
  -i, --interval A..B half-open sequence interval
11
12
  -n, --node INT node identifier (may repeat)
13
+ -b, --between A:B subgraph between two chain boundary handles, each INT[+-]
12
14
  --context INT context length in bp (default: 100)
15
+ --snarls extend the subgraph with contained top-level snarls
16
+ --extend-snarls extend the subgraph with overlapping top-level snarls
13
17
  --limit INT safety limit for the number of nodes
14
18
  --haplotypes SEL all, distinct, reference-only or none (default: all)
15
19
  --cigar output CIGAR strings for the haplotypes
20
+ --format FMT json (default) or gfa
16
21
  --resolve name haplotypes from the HaplotypeSamples table
17
22
  --alignments print one alignment record per haplotype fragment instead of the subgraph
23
+ --haplotype-index F companion database written by gbz-haplotype-index --output
18
24
  --block-size INT bytes fetched per range request (default: 65536)
19
25
  --stats print fetch statistics to stderr
20
26
  `;
27
+ function parseHandle(text) {
28
+ const orientation = text.endsWith('-') ? 'reverse' : 'forward';
29
+ const digits = /[+-]$/.test(text) ? text.slice(0, -1) : text;
30
+ if (!/^\d+$/.test(digits)) {
31
+ throw new Error(`Failed to parse oriented node ${text}`);
32
+ }
33
+ return encodeNode(Number(digits), orientation);
34
+ }
21
35
  function parseArgs(argv) {
22
36
  const args = {
23
37
  file: '',
24
38
  haplotype: 0,
25
39
  nodes: [],
26
40
  context: 100,
41
+ snarls: 'none',
27
42
  haplotypes: 'all',
28
43
  cigar: false,
44
+ format: 'json',
29
45
  resolve: false,
30
46
  alignments: false,
31
47
  blockSize: 65536,
@@ -64,9 +80,25 @@ function parseArgs(argv) {
64
80
  case '--node':
65
81
  args.nodes.push(Number(next(i++)));
66
82
  break;
83
+ case '-b':
84
+ case '--between': {
85
+ const [a, b, extra] = next(i++).split(':');
86
+ if (a === undefined || b === undefined || extra !== undefined) {
87
+ throw new Error(`--between needs two oriented nodes, like 14+:17-`);
88
+ }
89
+ args.between = [parseHandle(a), parseHandle(b)];
90
+ break;
91
+ }
67
92
  case '--context':
68
93
  args.context = Number(next(i++));
69
94
  break;
95
+ case '--snarls':
96
+ args.snarls =
97
+ args.snarls === 'overlapping' ? 'overlapping' : 'contained';
98
+ break;
99
+ case '--extend-snarls':
100
+ args.snarls = 'overlapping';
101
+ break;
70
102
  case '--limit':
71
103
  args.limit = Number(next(i++));
72
104
  break;
@@ -86,12 +118,20 @@ function parseArgs(argv) {
86
118
  case '--block-size':
87
119
  args.blockSize = Number(next(i++));
88
120
  break;
121
+ case '--haplotype-index':
122
+ args.haplotypeIndex = next(i++);
123
+ break;
89
124
  case '--stats':
90
125
  args.stats = true;
91
126
  break;
92
- case '--format':
93
- next(i++);
127
+ case '--format': {
128
+ const format = next(i++);
129
+ if (format !== 'json' && format !== 'gfa') {
130
+ throw new Error(`Unknown output format ${format}`);
131
+ }
132
+ args.format = format;
94
133
  break;
134
+ }
95
135
  case '-h':
96
136
  case '--help':
97
137
  process.stdout.write(USAGE);
@@ -109,15 +149,23 @@ function parseArgs(argv) {
109
149
  }
110
150
  return args;
111
151
  }
152
+ function alignmentRecord(alignment) {
153
+ const { start, ...rest } = alignment;
154
+ return rest.resolved ? { ...rest, name: rest.label, label: undefined } : rest;
155
+ }
112
156
  export async function main(argv) {
113
157
  const args = parseArgs(argv);
114
- const source = /^https?:\/\//.test(args.file)
115
- ? new RemoteFile(args.file)
116
- : new LocalFile(args.file);
117
- const db = await GBZBase.open(source, { blockSize: args.blockSize });
158
+ const open = (file) => /^https?:\/\//.test(file) ? new RemoteFile(file) : new LocalFile(file);
159
+ const db = await GBZBase.open(open(args.file), {
160
+ blockSize: args.blockSize,
161
+ ...(args.haplotypeIndex === undefined
162
+ ? {}
163
+ : { haplotypeIndex: open(args.haplotypeIndex) }),
164
+ });
118
165
  const opts = {
119
166
  context: args.context,
120
167
  haplotypes: args.haplotypes,
168
+ snarls: args.snarls,
121
169
  ...(args.limit === undefined ? {} : { limit: args.limit }),
122
170
  };
123
171
  const query = {
@@ -125,35 +173,35 @@ export async function main(argv) {
125
173
  haplotype: args.haplotype,
126
174
  ...(args.sample === undefined ? {} : { sample: args.sample }),
127
175
  };
128
- const subgraph = args.nodes.length > 0
129
- ? await subgraphAroundNodes(db, args.nodes, opts)
130
- : args.interval
131
- ? await subgraphInInterval(db, query, args.interval[0], args.interval[1], opts)
132
- : args.offset !== undefined
133
- ? await subgraphAtOffset(db, query, args.offset, opts)
134
- : undefined;
176
+ const subgraph = args.between
177
+ ? await subgraphBetween(db, args.between[0], args.between[1], opts)
178
+ : args.nodes.length > 0
179
+ ? await subgraphAroundNodes(db, args.nodes, opts)
180
+ : args.interval
181
+ ? await subgraphInInterval(db, query, args.interval[0], args.interval[1], opts)
182
+ : args.offset !== undefined
183
+ ? await subgraphAtOffset(db, query, args.offset, opts)
184
+ : undefined;
135
185
  if (!subgraph) {
136
- throw new Error('Query type must be specified using --offset, --interval or --node');
186
+ throw new Error('Query type must be specified using --offset, --interval, --node or --between');
137
187
  }
138
188
  if (args.resolve) {
139
189
  await subgraph.identifyPaths();
140
190
  }
191
+ const names = args.resolve ? 'resolved' : 'anonymous';
141
192
  const output = args.alignments
142
- ? subgraph.alignments().map(a => ({
143
- ...a,
144
- name: a.name && a.hapStart !== undefined && a.hapEnd !== undefined
145
- ? formatPathName({ ...a.name, fragment: a.hapStart }, a.hapEnd)
146
- : undefined,
147
- start: undefined,
148
- }))
149
- : subgraph.toJSON(args.cigar, {
150
- names: args.resolve ? 'resolved' : 'anonymous',
151
- });
152
- process.stdout.write(`${JSON.stringify(output)}\n`);
193
+ ? subgraph.alignments().map(alignmentRecord)
194
+ : subgraph.toSubgraphJson({ cigar: args.cigar, names });
195
+ process.stdout.write(args.format === 'gfa' && !args.alignments
196
+ ? await subgraph.toGFA({ cigar: args.cigar, names })
197
+ : `${JSON.stringify(output)}\n`);
153
198
  if (args.stats) {
154
199
  const { fetches, bytesFetched } = db.sqlite.pager;
200
+ const index = db.index === db.sqlite
201
+ ? ''
202
+ : ` (haplotype index: ${db.index.pager.fetches} fetches, ${db.index.pager.bytesFetched} bytes)`;
155
203
  const { orderedAlignments, lcsAlignments, identificationSteps, identificationFetches, } = subgraph.stats;
156
- process.stderr.write(`Subgraph contains ${subgraph.nodeCount} nodes and ${subgraph.pathCount} paths; ${fetches} fetches, ${bytesFetched} bytes; ${orderedAlignments} ordered + ${lcsAlignments} lcs alignments; identification ${identificationSteps} steps, ${identificationFetches} lookups\n`);
204
+ process.stderr.write(`Subgraph contains ${subgraph.nodeCount} nodes and ${subgraph.pathCount} paths; ${fetches} fetches, ${bytesFetched} bytes${index}; ${orderedAlignments} ordered + ${lcsAlignments} lcs alignments; identification ${identificationSteps} steps, ${identificationFetches} lookups\n`);
157
205
  }
158
206
  }
159
207
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAA;AAInB,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;CAgBb,CAAA;AAoBD,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,EAAE;QACR,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,GAAG;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,KAAK;KACb,CAAA;IACD,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QACzB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;QAC7C,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAA;QACpB,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,UAAU;gBACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,EA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S,WAAW,OAAO,aAAa,YAAY,SAAS,KAAK,KAAK,iBAAiB,cAAc,aAAa,mCAAmC,mBAAmB,WAAW,qBAAqB,YAAY,CACpR,CAAA;IACH,CAAC;AACH,CAAC"}
package/dist/db.d.ts CHANGED
@@ -2,21 +2,22 @@ import { GbwtRecord } from './gbwt/record.ts';
2
2
  import { SqliteDatabase } from './sqlite/database.ts';
3
3
  import type { ByteSource } from './filehandle.ts';
4
4
  import type { Pos } from './gbwt/record.ts';
5
+ import type { GraphName } from './graphName.ts';
6
+ import type { PathName, PathRef } from './pathName.ts';
7
+ import type { QueryOptions } from './query.ts';
5
8
  import type { PagerOptions } from './sqlite/pager.ts';
6
- export interface PathName {
7
- sample: string;
8
- contig: string;
9
- haplotype: number;
10
- fragment: number;
11
- }
12
- export declare const GENERIC_SAMPLE = "_gbwt_ref";
9
+ import type { HaplotypeAlignment, Subgraph } from './subgraph.ts';
13
10
  export declare const SCHEMA_VERSION = "GBZ-base version 4";
11
+ export interface PathFragment {
12
+ path: GbzPath;
13
+ start: number;
14
+ end: number;
15
+ }
14
16
  export declare class SchemaVersionError extends Error {
15
17
  name: string;
16
18
  readonly found: string | undefined;
17
19
  constructor(found: string | undefined);
18
20
  }
19
- export declare function formatPathName(name: PathName, end: number): string;
20
21
  export interface HaplotypeSample {
21
22
  node: number;
22
23
  offset: number;
@@ -46,12 +47,17 @@ export declare class GbzRecord {
46
47
  successors(): number[];
47
48
  gbwt(): GbwtRecord;
48
49
  }
50
+ export interface OpenOptions extends PagerOptions {
51
+ haplotypeIndex?: ByteSource;
52
+ }
49
53
  export declare class GBZBase {
50
54
  private tagCache;
51
55
  private pathCache;
56
+ private indexTags;
52
57
  readonly sqlite: SqliteDatabase;
58
+ readonly index: SqliteDatabase;
53
59
  private constructor();
54
- static open(source: ByteSource, opts?: PagerOptions): Promise<GBZBase>;
60
+ static open(source: ByteSource, opts?: OpenOptions): Promise<GBZBase>;
55
61
  tags(): Promise<Map<string, string>>;
56
62
  tag(key: string): Promise<string | undefined>;
57
63
  getRecord(handle: number): Promise<GbzRecord | undefined>;
@@ -59,6 +65,17 @@ export declare class GBZBase {
59
65
  getPath(handle: number): Promise<GbzPath | undefined>;
60
66
  findPath(name: PathName): Promise<GbzPath | undefined>;
61
67
  pathsForSample(sample: string): Promise<GbzPath[]>;
68
+ private pathsNamed;
69
+ hasPath(ref: PathRef): Promise<boolean>;
70
+ private pathLengths;
71
+ pathLength(handle: number): Promise<number>;
72
+ private walkPathLength;
73
+ pathFragmentsForRange(ref: PathRef, start: number, end: number): Promise<PathFragment[]>;
74
+ private subgraphForFragment;
75
+ getSubgraphForRange(ref: PathRef, start: number, end: number, opts?: QueryOptions): Promise<Subgraph | undefined>;
76
+ getAlignmentsForRange(ref: PathRef, start: number, end: number, opts?: QueryOptions): Promise<HaplotypeAlignment[]>;
77
+ graphName(): Promise<GraphName>;
78
+ hasChainLinks(): Promise<boolean>;
62
79
  get hasHaplotypeIndex(): boolean;
63
80
  haplotypeSampleInterval(): Promise<number | undefined>;
64
81
  private sampleFromRow;