@databio/gtars 0.7.0 → 0.7.1

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/gtars_js.d.ts CHANGED
@@ -25,6 +25,38 @@ export class ChromosomeStatistics {
25
25
  readonly start_nucleotide_position: number;
26
26
  }
27
27
 
28
+ /**
29
+ * Builder for computing consensus regions from multiple RegionSet objects.
30
+ *
31
+ * Usage from JS:
32
+ * ```js
33
+ * const cb = new ConsensusBuilder();
34
+ * cb.add(rs1);
35
+ * cb.add(rs2);
36
+ * cb.add(rs3);
37
+ * const result = cb.compute(); // [{chr, start, end, count}, ...]
38
+ * ```
39
+ */
40
+ export class ConsensusBuilder {
41
+ free(): void;
42
+ [Symbol.dispose](): void;
43
+ add(set: RegionSet): void;
44
+ compute(): any;
45
+ constructor();
46
+ }
47
+
48
+ export class GeneModel {
49
+ free(): void;
50
+ [Symbol.dispose](): void;
51
+ /**
52
+ * Construct a GeneModel from JS arrays of region tuples.
53
+ *
54
+ * Each array contains `[chr, start, end]` or `[chr, start, end, strand]` tuples.
55
+ * `threeUtr` and `fiveUtr` are optional (pass `null`/`undefined`).
56
+ */
57
+ constructor(genes: any, exons: any, three_utr: any, five_utr: any);
58
+ }
59
+
28
60
  export class Overlapper {
29
61
  free(): void;
30
62
  [Symbol.dispose](): void;
@@ -33,6 +65,19 @@ export class Overlapper {
33
65
  constructor(universe: any, backend: string);
34
66
  }
35
67
 
68
+ export class PartitionList {
69
+ private constructor();
70
+ free(): void;
71
+ [Symbol.dispose](): void;
72
+ /**
73
+ * Build a PartitionList from a GeneModel.
74
+ *
75
+ * `chromSizes` is an optional JS object `{"chr1": 249250621, ...}` for
76
+ * trimming promoters at chromosome boundaries.
77
+ */
78
+ static fromGeneModel(model: GeneModel, core_prom_size: number, prox_prom_size: number, chrom_sizes: any): PartitionList;
79
+ }
80
+
36
81
  export class RegionDistribution {
37
82
  private constructor();
38
83
  free(): void;
@@ -42,9 +87,20 @@ export class RegionDistribution {
42
87
  export class RegionSet {
43
88
  free(): void;
44
89
  [Symbol.dispose](): void;
90
+ calcNearestNeighbors(): any;
91
+ calcNeighborDistances(): any;
92
+ calcWidths(): Uint32Array;
45
93
  chromosomeStatistics(): any;
94
+ concat(other: RegionSet): RegionSet;
95
+ jaccard(other: RegionSet): number;
46
96
  constructor(regions: any);
97
+ pintersect(other: RegionSet): RegionSet;
98
+ promoters(upstream: number, downstream: number): RegionSet;
99
+ reduce(): RegionSet;
47
100
  regionDistribution(n_bins: number): any;
101
+ setdiff(other: RegionSet): RegionSet;
102
+ trim(chrom_sizes: any): RegionSet;
103
+ union(other: RegionSet): RegionSet;
48
104
  readonly classify: BedClassificationOutput;
49
105
  readonly firstRegion: string;
50
106
  readonly identifier: string;
@@ -53,6 +109,21 @@ export class RegionSet {
53
109
  readonly numberOfRegions: number;
54
110
  }
55
111
 
112
+ export class SignalMatrix {
113
+ free(): void;
114
+ [Symbol.dispose](): void;
115
+ /**
116
+ * Construct a SignalMatrix from JS data.
117
+ *
118
+ * - `regionIds`: array of strings in `"chr_start_end"` format
119
+ * - `conditionNames`: array of condition/cell-type names
120
+ * - `values`: flat row-major array of signal values
121
+ * - `nRegions`: number of rows (regions)
122
+ * - `nConditions`: number of columns (conditions)
123
+ */
124
+ constructor(region_ids: any, condition_names: any, values: Float64Array, n_regions: number, n_conditions: number);
125
+ }
126
+
56
127
  export class Tokenizer {
57
128
  free(): void;
58
129
  [Symbol.dispose](): void;
@@ -80,6 +151,48 @@ export class Tokenizer {
80
151
  readonly vocabSize: number;
81
152
  }
82
153
 
154
+ export class TssIndex {
155
+ free(): void;
156
+ [Symbol.dispose](): void;
157
+ /**
158
+ * Calculate signed distance from each query region to its nearest feature.
159
+ *
160
+ * Positive = feature is downstream, negative = feature is upstream.
161
+ * Returns an array where `null` indicates no features on that chromosome
162
+ * (sentinel `i64::MAX` in Rust → `null` in JS).
163
+ */
164
+ calcFeatureDistances(query: RegionSet): any;
165
+ /**
166
+ * Calculate unsigned distance from each query region to its nearest feature midpoint.
167
+ *
168
+ * Returns an array where `null` indicates no features on that chromosome
169
+ * (sentinel `u32::MAX` in Rust → `null` in JS).
170
+ */
171
+ calcTssDistances(query: RegionSet): any;
172
+ /**
173
+ * Build a TssIndex from a RegionSet of features (e.g. TSS sites).
174
+ *
175
+ * Clones the inner RegionSet and computes sorted midpoints per chromosome.
176
+ */
177
+ constructor(features: RegionSet);
178
+ }
179
+
180
+ /**
181
+ * Compute observed vs expected partition enrichment.
182
+ */
183
+ export function calcExpectedPartitions(region_set: RegionSet, partition_list: PartitionList, chrom_sizes: any, bp_proportion: boolean): any;
184
+
185
+ /**
186
+ * Classify query regions into partitions.
187
+ */
188
+ export function calcPartitions(region_set: RegionSet, partition_list: PartitionList, bp_proportion: boolean): any;
189
+
190
+ /**
191
+ * Compute summary signal: overlap query regions with a signal matrix,
192
+ * take MAX per condition, and compute boxplot statistics.
193
+ */
194
+ export function calcSummarySignal(region_set: RegionSet, signal_matrix: SignalMatrix): any;
195
+
83
196
  /**
84
197
  * Canonicalize a JSON string according to RFC-8785.
85
198
  *
@@ -280,9 +393,9 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
280
393
 
281
394
  export interface InitOutput {
282
395
  readonly memory: WebAssembly.Memory;
283
- readonly greet: (a: number, b: number) => void;
284
396
  readonly __wbg_bedclassificationoutput_free: (a: number, b: number) => void;
285
397
  readonly __wbg_chromosomestatistics_free: (a: number, b: number) => void;
398
+ readonly __wbg_consensusbuilder_free: (a: number, b: number) => void;
286
399
  readonly __wbg_regiondistribution_free: (a: number, b: number) => void;
287
400
  readonly __wbg_regionset_free: (a: number, b: number) => void;
288
401
  readonly bedclassificationoutput_bed_compliance: (a: number) => [number, number];
@@ -296,21 +409,60 @@ export interface InitOutput {
296
409
  readonly chromosomestatistics_median_region_length: (a: number) => number;
297
410
  readonly chromosomestatistics_number_of_regions: (a: number) => number;
298
411
  readonly chromosomestatistics_start_nucleotide_position: (a: number) => number;
412
+ readonly consensusbuilder_add: (a: number, b: number) => void;
413
+ readonly consensusbuilder_compute: (a: number) => [number, number, number];
414
+ readonly consensusbuilder_new: () => number;
415
+ readonly regionset_calcNearestNeighbors: (a: number) => [number, number, number];
416
+ readonly regionset_calcNeighborDistances: (a: number) => [number, number, number];
417
+ readonly regionset_calcWidths: (a: number) => [number, number];
299
418
  readonly regionset_chromosomeStatistics: (a: number) => [number, number, number];
300
419
  readonly regionset_classify: (a: number) => number;
420
+ readonly regionset_concat: (a: number, b: number) => number;
301
421
  readonly regionset_firstRegion: (a: number) => [number, number];
302
422
  readonly regionset_identifier: (a: number) => [number, number];
423
+ readonly regionset_jaccard: (a: number, b: number) => number;
303
424
  readonly regionset_meanRegionWidth: (a: number) => number;
304
425
  readonly regionset_new: (a: any) => [number, number, number];
305
426
  readonly regionset_nucleotidesLength: (a: number) => number;
306
427
  readonly regionset_numberOfRegions: (a: number) => number;
428
+ readonly regionset_pintersect: (a: number, b: number) => number;
429
+ readonly regionset_promoters: (a: number, b: number, c: number) => number;
430
+ readonly regionset_reduce: (a: number) => number;
307
431
  readonly regionset_regionDistribution: (a: number, b: number) => [number, number, number];
432
+ readonly regionset_setdiff: (a: number, b: number) => number;
433
+ readonly regionset_trim: (a: number, b: any) => [number, number, number];
434
+ readonly regionset_union: (a: number, b: number) => number;
308
435
  readonly chromosomestatistics_minimum_region_length: (a: number) => number;
436
+ readonly __wbg_signalmatrix_free: (a: number, b: number) => void;
437
+ readonly calcSummarySignal: (a: number, b: number) => [number, number, number];
438
+ readonly signalmatrix_new: (a: any, b: any, c: number, d: number, e: number, f: number) => [number, number, number];
439
+ readonly canonicalizeJsonString: (a: number, b: number) => [number, number, number, number];
440
+ readonly computeMd5: (a: number, b: number) => [number, number];
441
+ readonly computeSha512t24u: (a: number, b: number) => [number, number];
442
+ readonly digestSeqcol: (a: number, b: number) => [number, number, number];
443
+ readonly fastaHasherFinish: (a: number) => [number, number, number];
444
+ readonly fastaHasherFree: (a: number) => number;
445
+ readonly fastaHasherNew: () => number;
446
+ readonly fastaHasherProgress: (a: number) => [number, number, number];
447
+ readonly fastaHasherUpdate: (a: number, b: number, c: number) => [number, number];
448
+ readonly sequenceDigest: (a: number, b: number) => [number, number];
449
+ readonly sequenceMd5: (a: number, b: number) => [number, number];
309
450
  readonly __wbg_overlapper_free: (a: number, b: number) => void;
310
451
  readonly overlapper_find: (a: number, b: any) => [number, number, number];
311
452
  readonly overlapper_get_backend: (a: number) => [number, number];
312
453
  readonly overlapper_new: (a: any, b: number, c: number) => [number, number, number];
454
+ readonly __wbg_genemodel_free: (a: number, b: number) => void;
455
+ readonly __wbg_partitionlist_free: (a: number, b: number) => void;
456
+ readonly __wbg_tssindex_free: (a: number, b: number) => void;
457
+ readonly calcExpectedPartitions: (a: number, b: number, c: any, d: number) => [number, number, number];
458
+ readonly calcPartitions: (a: number, b: number, c: number) => [number, number, number];
459
+ readonly genemodel_new: (a: any, b: any, c: any, d: any) => [number, number, number];
460
+ readonly partitionlist_fromGeneModel: (a: number, b: number, c: number, d: any) => [number, number, number];
461
+ readonly tssindex_calcFeatureDistances: (a: number, b: number) => [number, number, number];
462
+ readonly tssindex_calcTssDistances: (a: number, b: number) => [number, number, number];
463
+ readonly tssindex_new: (a: number) => [number, number, number];
313
464
  readonly __wbg_tokenizer_free: (a: number, b: number) => void;
465
+ readonly greet: (a: number, b: number) => void;
314
466
  readonly tokenizer_bosToken: (a: number) => [number, number];
315
467
  readonly tokenizer_bosTokenId: (a: number) => number;
316
468
  readonly tokenizer_clsToken: (a: number) => [number, number];
@@ -333,17 +485,6 @@ export interface InitOutput {
333
485
  readonly tokenizer_unkToken: (a: number) => [number, number];
334
486
  readonly tokenizer_unkTokenId: (a: number) => number;
335
487
  readonly tokenizer_vocabSize: (a: number) => number;
336
- readonly canonicalizeJsonString: (a: number, b: number) => [number, number, number, number];
337
- readonly computeMd5: (a: number, b: number) => [number, number];
338
- readonly computeSha512t24u: (a: number, b: number) => [number, number];
339
- readonly digestSeqcol: (a: number, b: number) => [number, number, number];
340
- readonly fastaHasherFinish: (a: number) => [number, number, number];
341
- readonly fastaHasherFree: (a: number) => number;
342
- readonly fastaHasherNew: () => number;
343
- readonly fastaHasherProgress: (a: number) => [number, number, number];
344
- readonly fastaHasherUpdate: (a: number, b: number, c: number) => [number, number];
345
- readonly sequenceDigest: (a: number, b: number) => [number, number];
346
- readonly sequenceMd5: (a: number, b: number) => [number, number];
347
488
  readonly __wbindgen_malloc: (a: number, b: number) => number;
348
489
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
349
490
  readonly __wbindgen_exn_store: (a: number) => void;
package/gtars_js.js CHANGED
@@ -143,6 +143,88 @@ export class ChromosomeStatistics {
143
143
  }
144
144
  if (Symbol.dispose) ChromosomeStatistics.prototype[Symbol.dispose] = ChromosomeStatistics.prototype.free;
145
145
 
146
+ /**
147
+ * Builder for computing consensus regions from multiple RegionSet objects.
148
+ *
149
+ * Usage from JS:
150
+ * ```js
151
+ * const cb = new ConsensusBuilder();
152
+ * cb.add(rs1);
153
+ * cb.add(rs2);
154
+ * cb.add(rs3);
155
+ * const result = cb.compute(); // [{chr, start, end, count}, ...]
156
+ * ```
157
+ */
158
+ export class ConsensusBuilder {
159
+ __destroy_into_raw() {
160
+ const ptr = this.__wbg_ptr;
161
+ this.__wbg_ptr = 0;
162
+ ConsensusBuilderFinalization.unregister(this);
163
+ return ptr;
164
+ }
165
+ free() {
166
+ const ptr = this.__destroy_into_raw();
167
+ wasm.__wbg_consensusbuilder_free(ptr, 0);
168
+ }
169
+ /**
170
+ * @param {RegionSet} set
171
+ */
172
+ add(set) {
173
+ _assertClass(set, RegionSet);
174
+ wasm.consensusbuilder_add(this.__wbg_ptr, set.__wbg_ptr);
175
+ }
176
+ /**
177
+ * @returns {any}
178
+ */
179
+ compute() {
180
+ const ret = wasm.consensusbuilder_compute(this.__wbg_ptr);
181
+ if (ret[2]) {
182
+ throw takeFromExternrefTable0(ret[1]);
183
+ }
184
+ return takeFromExternrefTable0(ret[0]);
185
+ }
186
+ constructor() {
187
+ const ret = wasm.consensusbuilder_new();
188
+ this.__wbg_ptr = ret >>> 0;
189
+ ConsensusBuilderFinalization.register(this, this.__wbg_ptr, this);
190
+ return this;
191
+ }
192
+ }
193
+ if (Symbol.dispose) ConsensusBuilder.prototype[Symbol.dispose] = ConsensusBuilder.prototype.free;
194
+
195
+ export class GeneModel {
196
+ __destroy_into_raw() {
197
+ const ptr = this.__wbg_ptr;
198
+ this.__wbg_ptr = 0;
199
+ GeneModelFinalization.unregister(this);
200
+ return ptr;
201
+ }
202
+ free() {
203
+ const ptr = this.__destroy_into_raw();
204
+ wasm.__wbg_genemodel_free(ptr, 0);
205
+ }
206
+ /**
207
+ * Construct a GeneModel from JS arrays of region tuples.
208
+ *
209
+ * Each array contains `[chr, start, end]` or `[chr, start, end, strand]` tuples.
210
+ * `threeUtr` and `fiveUtr` are optional (pass `null`/`undefined`).
211
+ * @param {any} genes
212
+ * @param {any} exons
213
+ * @param {any} three_utr
214
+ * @param {any} five_utr
215
+ */
216
+ constructor(genes, exons, three_utr, five_utr) {
217
+ const ret = wasm.genemodel_new(genes, exons, three_utr, five_utr);
218
+ if (ret[2]) {
219
+ throw takeFromExternrefTable0(ret[1]);
220
+ }
221
+ this.__wbg_ptr = ret[0] >>> 0;
222
+ GeneModelFinalization.register(this, this.__wbg_ptr, this);
223
+ return this;
224
+ }
225
+ }
226
+ if (Symbol.dispose) GeneModel.prototype[Symbol.dispose] = GeneModel.prototype.free;
227
+
146
228
  export class Overlapper {
147
229
  __destroy_into_raw() {
148
230
  const ptr = this.__wbg_ptr;
@@ -198,6 +280,46 @@ export class Overlapper {
198
280
  }
199
281
  if (Symbol.dispose) Overlapper.prototype[Symbol.dispose] = Overlapper.prototype.free;
200
282
 
283
+ export class PartitionList {
284
+ static __wrap(ptr) {
285
+ ptr = ptr >>> 0;
286
+ const obj = Object.create(PartitionList.prototype);
287
+ obj.__wbg_ptr = ptr;
288
+ PartitionListFinalization.register(obj, obj.__wbg_ptr, obj);
289
+ return obj;
290
+ }
291
+ __destroy_into_raw() {
292
+ const ptr = this.__wbg_ptr;
293
+ this.__wbg_ptr = 0;
294
+ PartitionListFinalization.unregister(this);
295
+ return ptr;
296
+ }
297
+ free() {
298
+ const ptr = this.__destroy_into_raw();
299
+ wasm.__wbg_partitionlist_free(ptr, 0);
300
+ }
301
+ /**
302
+ * Build a PartitionList from a GeneModel.
303
+ *
304
+ * `chromSizes` is an optional JS object `{"chr1": 249250621, ...}` for
305
+ * trimming promoters at chromosome boundaries.
306
+ * @param {GeneModel} model
307
+ * @param {number} core_prom_size
308
+ * @param {number} prox_prom_size
309
+ * @param {any} chrom_sizes
310
+ * @returns {PartitionList}
311
+ */
312
+ static fromGeneModel(model, core_prom_size, prox_prom_size, chrom_sizes) {
313
+ _assertClass(model, GeneModel);
314
+ const ret = wasm.partitionlist_fromGeneModel(model.__wbg_ptr, core_prom_size, prox_prom_size, chrom_sizes);
315
+ if (ret[2]) {
316
+ throw takeFromExternrefTable0(ret[1]);
317
+ }
318
+ return PartitionList.__wrap(ret[0]);
319
+ }
320
+ }
321
+ if (Symbol.dispose) PartitionList.prototype[Symbol.dispose] = PartitionList.prototype.free;
322
+
201
323
  export class RegionDistribution {
202
324
  __destroy_into_raw() {
203
325
  const ptr = this.__wbg_ptr;
@@ -213,6 +335,13 @@ export class RegionDistribution {
213
335
  if (Symbol.dispose) RegionDistribution.prototype[Symbol.dispose] = RegionDistribution.prototype.free;
214
336
 
215
337
  export class RegionSet {
338
+ static __wrap(ptr) {
339
+ ptr = ptr >>> 0;
340
+ const obj = Object.create(RegionSet.prototype);
341
+ obj.__wbg_ptr = ptr;
342
+ RegionSetFinalization.register(obj, obj.__wbg_ptr, obj);
343
+ return obj;
344
+ }
216
345
  __destroy_into_raw() {
217
346
  const ptr = this.__wbg_ptr;
218
347
  this.__wbg_ptr = 0;
@@ -223,6 +352,35 @@ export class RegionSet {
223
352
  const ptr = this.__destroy_into_raw();
224
353
  wasm.__wbg_regionset_free(ptr, 0);
225
354
  }
355
+ /**
356
+ * @returns {any}
357
+ */
358
+ calcNearestNeighbors() {
359
+ const ret = wasm.regionset_calcNearestNeighbors(this.__wbg_ptr);
360
+ if (ret[2]) {
361
+ throw takeFromExternrefTable0(ret[1]);
362
+ }
363
+ return takeFromExternrefTable0(ret[0]);
364
+ }
365
+ /**
366
+ * @returns {any}
367
+ */
368
+ calcNeighborDistances() {
369
+ const ret = wasm.regionset_calcNeighborDistances(this.__wbg_ptr);
370
+ if (ret[2]) {
371
+ throw takeFromExternrefTable0(ret[1]);
372
+ }
373
+ return takeFromExternrefTable0(ret[0]);
374
+ }
375
+ /**
376
+ * @returns {Uint32Array}
377
+ */
378
+ calcWidths() {
379
+ const ret = wasm.regionset_calcWidths(this.__wbg_ptr);
380
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
381
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
382
+ return v1;
383
+ }
226
384
  /**
227
385
  * @returns {any}
228
386
  */
@@ -240,6 +398,15 @@ export class RegionSet {
240
398
  const ret = wasm.regionset_classify(this.__wbg_ptr);
241
399
  return BedClassificationOutput.__wrap(ret);
242
400
  }
401
+ /**
402
+ * @param {RegionSet} other
403
+ * @returns {RegionSet}
404
+ */
405
+ concat(other) {
406
+ _assertClass(other, RegionSet);
407
+ const ret = wasm.regionset_concat(this.__wbg_ptr, other.__wbg_ptr);
408
+ return RegionSet.__wrap(ret);
409
+ }
243
410
  /**
244
411
  * @returns {string}
245
412
  */
@@ -270,6 +437,15 @@ export class RegionSet {
270
437
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
271
438
  }
272
439
  }
440
+ /**
441
+ * @param {RegionSet} other
442
+ * @returns {number}
443
+ */
444
+ jaccard(other) {
445
+ _assertClass(other, RegionSet);
446
+ const ret = wasm.regionset_jaccard(this.__wbg_ptr, other.__wbg_ptr);
447
+ return ret;
448
+ }
273
449
  /**
274
450
  * @returns {number}
275
451
  */
@@ -303,6 +479,31 @@ export class RegionSet {
303
479
  const ret = wasm.regionset_numberOfRegions(this.__wbg_ptr);
304
480
  return ret;
305
481
  }
482
+ /**
483
+ * @param {RegionSet} other
484
+ * @returns {RegionSet}
485
+ */
486
+ pintersect(other) {
487
+ _assertClass(other, RegionSet);
488
+ const ret = wasm.regionset_pintersect(this.__wbg_ptr, other.__wbg_ptr);
489
+ return RegionSet.__wrap(ret);
490
+ }
491
+ /**
492
+ * @param {number} upstream
493
+ * @param {number} downstream
494
+ * @returns {RegionSet}
495
+ */
496
+ promoters(upstream, downstream) {
497
+ const ret = wasm.regionset_promoters(this.__wbg_ptr, upstream, downstream);
498
+ return RegionSet.__wrap(ret);
499
+ }
500
+ /**
501
+ * @returns {RegionSet}
502
+ */
503
+ reduce() {
504
+ const ret = wasm.regionset_reduce(this.__wbg_ptr);
505
+ return RegionSet.__wrap(ret);
506
+ }
306
507
  /**
307
508
  * @param {number} n_bins
308
509
  * @returns {any}
@@ -314,9 +515,77 @@ export class RegionSet {
314
515
  }
315
516
  return takeFromExternrefTable0(ret[0]);
316
517
  }
518
+ /**
519
+ * @param {RegionSet} other
520
+ * @returns {RegionSet}
521
+ */
522
+ setdiff(other) {
523
+ _assertClass(other, RegionSet);
524
+ const ret = wasm.regionset_setdiff(this.__wbg_ptr, other.__wbg_ptr);
525
+ return RegionSet.__wrap(ret);
526
+ }
527
+ /**
528
+ * @param {any} chrom_sizes
529
+ * @returns {RegionSet}
530
+ */
531
+ trim(chrom_sizes) {
532
+ const ret = wasm.regionset_trim(this.__wbg_ptr, chrom_sizes);
533
+ if (ret[2]) {
534
+ throw takeFromExternrefTable0(ret[1]);
535
+ }
536
+ return RegionSet.__wrap(ret[0]);
537
+ }
538
+ /**
539
+ * @param {RegionSet} other
540
+ * @returns {RegionSet}
541
+ */
542
+ union(other) {
543
+ _assertClass(other, RegionSet);
544
+ const ret = wasm.regionset_union(this.__wbg_ptr, other.__wbg_ptr);
545
+ return RegionSet.__wrap(ret);
546
+ }
317
547
  }
318
548
  if (Symbol.dispose) RegionSet.prototype[Symbol.dispose] = RegionSet.prototype.free;
319
549
 
550
+ export class SignalMatrix {
551
+ __destroy_into_raw() {
552
+ const ptr = this.__wbg_ptr;
553
+ this.__wbg_ptr = 0;
554
+ SignalMatrixFinalization.unregister(this);
555
+ return ptr;
556
+ }
557
+ free() {
558
+ const ptr = this.__destroy_into_raw();
559
+ wasm.__wbg_signalmatrix_free(ptr, 0);
560
+ }
561
+ /**
562
+ * Construct a SignalMatrix from JS data.
563
+ *
564
+ * - `regionIds`: array of strings in `"chr_start_end"` format
565
+ * - `conditionNames`: array of condition/cell-type names
566
+ * - `values`: flat row-major array of signal values
567
+ * - `nRegions`: number of rows (regions)
568
+ * - `nConditions`: number of columns (conditions)
569
+ * @param {any} region_ids
570
+ * @param {any} condition_names
571
+ * @param {Float64Array} values
572
+ * @param {number} n_regions
573
+ * @param {number} n_conditions
574
+ */
575
+ constructor(region_ids, condition_names, values, n_regions, n_conditions) {
576
+ const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
577
+ const len0 = WASM_VECTOR_LEN;
578
+ const ret = wasm.signalmatrix_new(region_ids, condition_names, ptr0, len0, n_regions, n_conditions);
579
+ if (ret[2]) {
580
+ throw takeFromExternrefTable0(ret[1]);
581
+ }
582
+ this.__wbg_ptr = ret[0] >>> 0;
583
+ SignalMatrixFinalization.register(this, this.__wbg_ptr, this);
584
+ return this;
585
+ }
586
+ }
587
+ if (Symbol.dispose) SignalMatrix.prototype[Symbol.dispose] = SignalMatrix.prototype.free;
588
+
320
589
  export class Tokenizer {
321
590
  __destroy_into_raw() {
322
591
  const ptr = this.__wbg_ptr;
@@ -567,6 +836,121 @@ export class Tokenizer {
567
836
  }
568
837
  if (Symbol.dispose) Tokenizer.prototype[Symbol.dispose] = Tokenizer.prototype.free;
569
838
 
839
+ export class TssIndex {
840
+ __destroy_into_raw() {
841
+ const ptr = this.__wbg_ptr;
842
+ this.__wbg_ptr = 0;
843
+ TssIndexFinalization.unregister(this);
844
+ return ptr;
845
+ }
846
+ free() {
847
+ const ptr = this.__destroy_into_raw();
848
+ wasm.__wbg_tssindex_free(ptr, 0);
849
+ }
850
+ /**
851
+ * Calculate signed distance from each query region to its nearest feature.
852
+ *
853
+ * Positive = feature is downstream, negative = feature is upstream.
854
+ * Returns an array where `null` indicates no features on that chromosome
855
+ * (sentinel `i64::MAX` in Rust → `null` in JS).
856
+ * @param {RegionSet} query
857
+ * @returns {any}
858
+ */
859
+ calcFeatureDistances(query) {
860
+ _assertClass(query, RegionSet);
861
+ const ret = wasm.tssindex_calcFeatureDistances(this.__wbg_ptr, query.__wbg_ptr);
862
+ if (ret[2]) {
863
+ throw takeFromExternrefTable0(ret[1]);
864
+ }
865
+ return takeFromExternrefTable0(ret[0]);
866
+ }
867
+ /**
868
+ * Calculate unsigned distance from each query region to its nearest feature midpoint.
869
+ *
870
+ * Returns an array where `null` indicates no features on that chromosome
871
+ * (sentinel `u32::MAX` in Rust → `null` in JS).
872
+ * @param {RegionSet} query
873
+ * @returns {any}
874
+ */
875
+ calcTssDistances(query) {
876
+ _assertClass(query, RegionSet);
877
+ const ret = wasm.tssindex_calcTssDistances(this.__wbg_ptr, query.__wbg_ptr);
878
+ if (ret[2]) {
879
+ throw takeFromExternrefTable0(ret[1]);
880
+ }
881
+ return takeFromExternrefTable0(ret[0]);
882
+ }
883
+ /**
884
+ * Build a TssIndex from a RegionSet of features (e.g. TSS sites).
885
+ *
886
+ * Clones the inner RegionSet and computes sorted midpoints per chromosome.
887
+ * @param {RegionSet} features
888
+ */
889
+ constructor(features) {
890
+ _assertClass(features, RegionSet);
891
+ const ret = wasm.tssindex_new(features.__wbg_ptr);
892
+ if (ret[2]) {
893
+ throw takeFromExternrefTable0(ret[1]);
894
+ }
895
+ this.__wbg_ptr = ret[0] >>> 0;
896
+ TssIndexFinalization.register(this, this.__wbg_ptr, this);
897
+ return this;
898
+ }
899
+ }
900
+ if (Symbol.dispose) TssIndex.prototype[Symbol.dispose] = TssIndex.prototype.free;
901
+
902
+ /**
903
+ * Compute observed vs expected partition enrichment.
904
+ * @param {RegionSet} region_set
905
+ * @param {PartitionList} partition_list
906
+ * @param {any} chrom_sizes
907
+ * @param {boolean} bp_proportion
908
+ * @returns {any}
909
+ */
910
+ export function calcExpectedPartitions(region_set, partition_list, chrom_sizes, bp_proportion) {
911
+ _assertClass(region_set, RegionSet);
912
+ _assertClass(partition_list, PartitionList);
913
+ const ret = wasm.calcExpectedPartitions(region_set.__wbg_ptr, partition_list.__wbg_ptr, chrom_sizes, bp_proportion);
914
+ if (ret[2]) {
915
+ throw takeFromExternrefTable0(ret[1]);
916
+ }
917
+ return takeFromExternrefTable0(ret[0]);
918
+ }
919
+
920
+ /**
921
+ * Classify query regions into partitions.
922
+ * @param {RegionSet} region_set
923
+ * @param {PartitionList} partition_list
924
+ * @param {boolean} bp_proportion
925
+ * @returns {any}
926
+ */
927
+ export function calcPartitions(region_set, partition_list, bp_proportion) {
928
+ _assertClass(region_set, RegionSet);
929
+ _assertClass(partition_list, PartitionList);
930
+ const ret = wasm.calcPartitions(region_set.__wbg_ptr, partition_list.__wbg_ptr, bp_proportion);
931
+ if (ret[2]) {
932
+ throw takeFromExternrefTable0(ret[1]);
933
+ }
934
+ return takeFromExternrefTable0(ret[0]);
935
+ }
936
+
937
+ /**
938
+ * Compute summary signal: overlap query regions with a signal matrix,
939
+ * take MAX per condition, and compute boxplot statistics.
940
+ * @param {RegionSet} region_set
941
+ * @param {SignalMatrix} signal_matrix
942
+ * @returns {any}
943
+ */
944
+ export function calcSummarySignal(region_set, signal_matrix) {
945
+ _assertClass(region_set, RegionSet);
946
+ _assertClass(signal_matrix, SignalMatrix);
947
+ const ret = wasm.calcSummarySignal(region_set.__wbg_ptr, signal_matrix.__wbg_ptr);
948
+ if (ret[2]) {
949
+ throw takeFromExternrefTable0(ret[1]);
950
+ }
951
+ return takeFromExternrefTable0(ret[0]);
952
+ }
953
+
570
954
  /**
571
955
  * Canonicalize a JSON string according to RFC-8785.
572
956
  *
@@ -909,6 +1293,12 @@ function __wbg_get_imports() {
909
1293
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
910
1294
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
911
1295
  },
1296
+ __wbg___wbindgen_bigint_get_as_i64_25c638f64ce0e2e0: function(arg0, arg1) {
1297
+ const v = arg1;
1298
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1299
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1300
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1301
+ },
912
1302
  __wbg___wbindgen_boolean_get_7f1c4dd217655ab6: function(arg0) {
913
1303
  const v = arg0;
914
1304
  const ret = typeof(v) === 'boolean' ? v : undefined;
@@ -921,10 +1311,22 @@ function __wbg_get_imports() {
921
1311
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
922
1312
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
923
1313
  },
1314
+ __wbg___wbindgen_in_e32cbbbf71fdc915: function(arg0, arg1) {
1315
+ const ret = arg0 in arg1;
1316
+ return ret;
1317
+ },
1318
+ __wbg___wbindgen_is_bigint_95f22c948ca1bbe1: function(arg0) {
1319
+ const ret = typeof(arg0) === 'bigint';
1320
+ return ret;
1321
+ },
924
1322
  __wbg___wbindgen_is_function_4500d4795b15e70b: function(arg0) {
925
1323
  const ret = typeof(arg0) === 'function';
926
1324
  return ret;
927
1325
  },
1326
+ __wbg___wbindgen_is_null_5467e07e008308e7: function(arg0) {
1327
+ const ret = arg0 === null;
1328
+ return ret;
1329
+ },
928
1330
  __wbg___wbindgen_is_object_f8b6723c60349a13: function(arg0) {
929
1331
  const val = arg0;
930
1332
  const ret = typeof(val) === 'object' && val !== null;
@@ -934,6 +1336,14 @@ function __wbg_get_imports() {
934
1336
  const ret = typeof(arg0) === 'string';
935
1337
  return ret;
936
1338
  },
1339
+ __wbg___wbindgen_is_undefined_1296fcc83c2da07a: function(arg0) {
1340
+ const ret = arg0 === undefined;
1341
+ return ret;
1342
+ },
1343
+ __wbg___wbindgen_jsval_eq_39cab0b49f8188e9: function(arg0, arg1) {
1344
+ const ret = arg0 === arg1;
1345
+ return ret;
1346
+ },
937
1347
  __wbg___wbindgen_jsval_loose_eq_3173dea557396a92: function(arg0, arg1) {
938
1348
  const ret = arg0 == arg1;
939
1349
  return ret;
@@ -955,7 +1365,7 @@ function __wbg_get_imports() {
955
1365
  __wbg___wbindgen_throw_89ca9e2c67795ec1: function(arg0, arg1) {
956
1366
  throw new Error(getStringFromWasm0(arg0, arg1));
957
1367
  },
958
- __wbg_alert_3ede886592780cb6: function(arg0, arg1) {
1368
+ __wbg_alert_54562c808bfe0277: function(arg0, arg1) {
959
1369
  alert(getStringFromWasm0(arg0, arg1));
960
1370
  },
961
1371
  __wbg_call_eb691bc2f5533064: function() { return handleError(function (arg0, arg1) {
@@ -966,6 +1376,14 @@ function __wbg_get_imports() {
966
1376
  const ret = arg0.done;
967
1377
  return ret;
968
1378
  },
1379
+ __wbg_entries_46c64fadfaa3b525: function(arg0) {
1380
+ const ret = Object.entries(arg0);
1381
+ return ret;
1382
+ },
1383
+ __wbg_get_229657ec2da079cd: function(arg0, arg1) {
1384
+ const ret = arg0[arg1 >>> 0];
1385
+ return ret;
1386
+ },
969
1387
  __wbg_get_ed44f5f876f22351: function() { return handleError(function (arg0, arg1) {
970
1388
  const ret = Reflect.get(arg0, arg1);
971
1389
  return ret;
@@ -1060,12 +1478,17 @@ function __wbg_get_imports() {
1060
1478
  const ret = arg0;
1061
1479
  return ret;
1062
1480
  },
1063
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1481
+ __wbindgen_cast_0000000000000002: function(arg0) {
1482
+ // Cast intrinsic for `I64 -> Externref`.
1483
+ const ret = arg0;
1484
+ return ret;
1485
+ },
1486
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1064
1487
  // Cast intrinsic for `Ref(String) -> Externref`.
1065
1488
  const ret = getStringFromWasm0(arg0, arg1);
1066
1489
  return ret;
1067
1490
  },
1068
- __wbindgen_cast_0000000000000003: function(arg0) {
1491
+ __wbindgen_cast_0000000000000004: function(arg0) {
1069
1492
  // Cast intrinsic for `U64 -> Externref`.
1070
1493
  const ret = BigInt.asUintN(64, arg0);
1071
1494
  return ret;
@@ -1092,18 +1515,33 @@ const BedClassificationOutputFinalization = (typeof FinalizationRegistry === 'un
1092
1515
  const ChromosomeStatisticsFinalization = (typeof FinalizationRegistry === 'undefined')
1093
1516
  ? { register: () => {}, unregister: () => {} }
1094
1517
  : new FinalizationRegistry(ptr => wasm.__wbg_chromosomestatistics_free(ptr >>> 0, 1));
1518
+ const ConsensusBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1519
+ ? { register: () => {}, unregister: () => {} }
1520
+ : new FinalizationRegistry(ptr => wasm.__wbg_consensusbuilder_free(ptr >>> 0, 1));
1521
+ const GeneModelFinalization = (typeof FinalizationRegistry === 'undefined')
1522
+ ? { register: () => {}, unregister: () => {} }
1523
+ : new FinalizationRegistry(ptr => wasm.__wbg_genemodel_free(ptr >>> 0, 1));
1095
1524
  const OverlapperFinalization = (typeof FinalizationRegistry === 'undefined')
1096
1525
  ? { register: () => {}, unregister: () => {} }
1097
1526
  : new FinalizationRegistry(ptr => wasm.__wbg_overlapper_free(ptr >>> 0, 1));
1527
+ const PartitionListFinalization = (typeof FinalizationRegistry === 'undefined')
1528
+ ? { register: () => {}, unregister: () => {} }
1529
+ : new FinalizationRegistry(ptr => wasm.__wbg_partitionlist_free(ptr >>> 0, 1));
1098
1530
  const RegionDistributionFinalization = (typeof FinalizationRegistry === 'undefined')
1099
1531
  ? { register: () => {}, unregister: () => {} }
1100
1532
  : new FinalizationRegistry(ptr => wasm.__wbg_regiondistribution_free(ptr >>> 0, 1));
1101
1533
  const RegionSetFinalization = (typeof FinalizationRegistry === 'undefined')
1102
1534
  ? { register: () => {}, unregister: () => {} }
1103
1535
  : new FinalizationRegistry(ptr => wasm.__wbg_regionset_free(ptr >>> 0, 1));
1536
+ const SignalMatrixFinalization = (typeof FinalizationRegistry === 'undefined')
1537
+ ? { register: () => {}, unregister: () => {} }
1538
+ : new FinalizationRegistry(ptr => wasm.__wbg_signalmatrix_free(ptr >>> 0, 1));
1104
1539
  const TokenizerFinalization = (typeof FinalizationRegistry === 'undefined')
1105
1540
  ? { register: () => {}, unregister: () => {} }
1106
1541
  : new FinalizationRegistry(ptr => wasm.__wbg_tokenizer_free(ptr >>> 0, 1));
1542
+ const TssIndexFinalization = (typeof FinalizationRegistry === 'undefined')
1543
+ ? { register: () => {}, unregister: () => {} }
1544
+ : new FinalizationRegistry(ptr => wasm.__wbg_tssindex_free(ptr >>> 0, 1));
1107
1545
 
1108
1546
  function addToExternrefTable0(obj) {
1109
1547
  const idx = wasm.__externref_table_alloc();
@@ -1111,6 +1549,12 @@ function addToExternrefTable0(obj) {
1111
1549
  return idx;
1112
1550
  }
1113
1551
 
1552
+ function _assertClass(instance, klass) {
1553
+ if (!(instance instanceof klass)) {
1554
+ throw new Error(`expected instance of ${klass.name}`);
1555
+ }
1556
+ }
1557
+
1114
1558
  function debugString(val) {
1115
1559
  // primitive types
1116
1560
  const type = typeof val;
@@ -1176,6 +1620,11 @@ function debugString(val) {
1176
1620
  return className;
1177
1621
  }
1178
1622
 
1623
+ function getArrayU32FromWasm0(ptr, len) {
1624
+ ptr = ptr >>> 0;
1625
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1626
+ }
1627
+
1179
1628
  function getArrayU8FromWasm0(ptr, len) {
1180
1629
  ptr = ptr >>> 0;
1181
1630
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -1189,11 +1638,27 @@ function getDataViewMemory0() {
1189
1638
  return cachedDataViewMemory0;
1190
1639
  }
1191
1640
 
1641
+ let cachedFloat64ArrayMemory0 = null;
1642
+ function getFloat64ArrayMemory0() {
1643
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1644
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1645
+ }
1646
+ return cachedFloat64ArrayMemory0;
1647
+ }
1648
+
1192
1649
  function getStringFromWasm0(ptr, len) {
1193
1650
  ptr = ptr >>> 0;
1194
1651
  return decodeText(ptr, len);
1195
1652
  }
1196
1653
 
1654
+ let cachedUint32ArrayMemory0 = null;
1655
+ function getUint32ArrayMemory0() {
1656
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1657
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1658
+ }
1659
+ return cachedUint32ArrayMemory0;
1660
+ }
1661
+
1197
1662
  let cachedUint8ArrayMemory0 = null;
1198
1663
  function getUint8ArrayMemory0() {
1199
1664
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -1222,6 +1687,13 @@ function passArray8ToWasm0(arg, malloc) {
1222
1687
  return ptr;
1223
1688
  }
1224
1689
 
1690
+ function passArrayF64ToWasm0(arg, malloc) {
1691
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
1692
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
1693
+ WASM_VECTOR_LEN = arg.length;
1694
+ return ptr;
1695
+ }
1696
+
1225
1697
  function passStringToWasm0(arg, malloc, realloc) {
1226
1698
  if (realloc === undefined) {
1227
1699
  const buf = cachedTextEncoder.encode(arg);
@@ -1299,6 +1771,8 @@ function __wbg_finalize_init(instance, module) {
1299
1771
  wasm = instance.exports;
1300
1772
  wasmModule = module;
1301
1773
  cachedDataViewMemory0 = null;
1774
+ cachedFloat64ArrayMemory0 = null;
1775
+ cachedUint32ArrayMemory0 = null;
1302
1776
  cachedUint8ArrayMemory0 = null;
1303
1777
  wasm.__wbindgen_start();
1304
1778
  return wasm;
package/gtars_js_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Nathan LeRoy <NLeRoy917@gmail.com>"
6
6
  ],
7
- "version": "0.7.0",
7
+ "version": "0.7.1",
8
8
  "files": [
9
9
  "gtars_js_bg.wasm",
10
10
  "gtars_js.js",