@databio/gtars 0.5.3 → 0.6.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/gtars_js.d.ts +206 -1
- package/gtars_js.js +332 -1
- package/gtars_js_bg.wasm +0 -0
- package/package.json +1 -1
package/gtars_js.d.ts
CHANGED
|
@@ -80,12 +80,218 @@ export class Tokenizer {
|
|
|
80
80
|
readonly vocabSize: number;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Canonicalize a JSON string according to RFC-8785.
|
|
85
|
+
*
|
|
86
|
+
* This is useful for computing digests of JSON objects in a deterministic way.
|
|
87
|
+
*
|
|
88
|
+
* # Arguments
|
|
89
|
+
* * `json_str` - A JSON string
|
|
90
|
+
*
|
|
91
|
+
* # Returns
|
|
92
|
+
* The canonicalized JSON string
|
|
93
|
+
*/
|
|
94
|
+
export function canonicalizeJsonString(json_str: string): string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Compute the MD5 digest of a string.
|
|
98
|
+
*
|
|
99
|
+
* Low-level function that does NOT uppercase the input.
|
|
100
|
+
*
|
|
101
|
+
* # Arguments
|
|
102
|
+
* * `input` - The input string
|
|
103
|
+
*
|
|
104
|
+
* # Returns
|
|
105
|
+
* The MD5 digest as a hex string
|
|
106
|
+
*/
|
|
107
|
+
export function computeMd5(input: string): string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Compute the sha512t24u digest of a string.
|
|
111
|
+
*
|
|
112
|
+
* This is a low-level function that computes the GA4GH standard digest
|
|
113
|
+
* of arbitrary input. Unlike `sequence_digest`, this does NOT uppercase
|
|
114
|
+
* the input.
|
|
115
|
+
*
|
|
116
|
+
* # Arguments
|
|
117
|
+
* * `input` - The input string
|
|
118
|
+
*
|
|
119
|
+
* # Returns
|
|
120
|
+
* The sha512t24u digest string (base64url encoded)
|
|
121
|
+
*/
|
|
122
|
+
export function computeSha512t24u(input: string): string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Compute a seqcol (sequence collection) digest from FASTA content.
|
|
126
|
+
*
|
|
127
|
+
* This function takes FASTA file content as bytes and returns a JSON object
|
|
128
|
+
* containing the sequence collection digest and metadata. Automatically handles
|
|
129
|
+
* gzip-compressed FASTA files.
|
|
130
|
+
*
|
|
131
|
+
* # Arguments
|
|
132
|
+
* * `fasta_content` - The FASTA file content as a Uint8Array (supports gzip)
|
|
133
|
+
*
|
|
134
|
+
* # Returns
|
|
135
|
+
* A JavaScript object containing:
|
|
136
|
+
* - `digest`: The top-level seqcol digest
|
|
137
|
+
* - `names_digest`: Level 1 digest of sequence names
|
|
138
|
+
* - `sequences_digest`: Level 1 digest of sequence digests
|
|
139
|
+
* - `lengths_digest`: Level 1 digest of sequence lengths
|
|
140
|
+
* - `n_sequences`: Number of sequences
|
|
141
|
+
* - `sequences`: Array of sequence metadata objects
|
|
142
|
+
*
|
|
143
|
+
* # Example (JavaScript)
|
|
144
|
+
* ```javascript
|
|
145
|
+
* const fastaContent = new TextEncoder().encode(">chr1\nACGT\n");
|
|
146
|
+
* const result = digestSeqcol(fastaContent);
|
|
147
|
+
* console.log(result.digest); // Top-level seqcol digest
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export function digestSeqcol(fasta_content: Uint8Array): any;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Finalize the hasher and return the results.
|
|
154
|
+
*
|
|
155
|
+
* This consumes the hasher and frees its resources.
|
|
156
|
+
* After calling this, the handle is no longer valid.
|
|
157
|
+
*
|
|
158
|
+
* # Arguments
|
|
159
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
160
|
+
*
|
|
161
|
+
* # Returns
|
|
162
|
+
* A JavaScript object with the sequence collection result,
|
|
163
|
+
* or an error if the handle is invalid.
|
|
164
|
+
*
|
|
165
|
+
* # Example (JavaScript)
|
|
166
|
+
* ```javascript
|
|
167
|
+
* const handle = fastaHasherNew();
|
|
168
|
+
* fastaHasherUpdate(handle, fastaData);
|
|
169
|
+
* const result = fastaHasherFinish(handle);
|
|
170
|
+
* console.log(result.digest);
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export function fastaHasherFinish(handle: number): any;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Free a hasher without getting results.
|
|
177
|
+
*
|
|
178
|
+
* Use this if you need to cancel processing early.
|
|
179
|
+
* After calling this, the handle is no longer valid.
|
|
180
|
+
*
|
|
181
|
+
* # Arguments
|
|
182
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
183
|
+
*
|
|
184
|
+
* # Returns
|
|
185
|
+
* `true` if the handle was valid and freed, `false` otherwise.
|
|
186
|
+
*/
|
|
187
|
+
export function fastaHasherFree(handle: number): boolean;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Create a new streaming FASTA hasher.
|
|
191
|
+
*
|
|
192
|
+
* Returns a handle (u32) that must be used in subsequent calls.
|
|
193
|
+
* The handle must be freed with `fastaHasherFinish()` or `fastaHasherFree()`.
|
|
194
|
+
*
|
|
195
|
+
* # Returns
|
|
196
|
+
* A handle ID (always > 0).
|
|
197
|
+
*
|
|
198
|
+
* # Example (JavaScript)
|
|
199
|
+
* ```javascript
|
|
200
|
+
* const handle = fastaHasherNew();
|
|
201
|
+
* // ... use handle with fastaHasherUpdate ...
|
|
202
|
+
* const result = fastaHasherFinish(handle);
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export function fastaHasherNew(): number;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get the current progress of a streaming hasher.
|
|
209
|
+
*
|
|
210
|
+
* # Arguments
|
|
211
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
212
|
+
*
|
|
213
|
+
* # Returns
|
|
214
|
+
* A JavaScript object with progress information, or null if handle is invalid.
|
|
215
|
+
* The object contains:
|
|
216
|
+
* - `completed_sequences`: Number of fully processed sequences
|
|
217
|
+
* - `current_sequence_name`: Name of sequence being processed (if any)
|
|
218
|
+
* - `current_sequence_length`: Length of sequence being processed
|
|
219
|
+
*/
|
|
220
|
+
export function fastaHasherProgress(handle: number): any;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Process a chunk of FASTA data.
|
|
224
|
+
*
|
|
225
|
+
* This can be called multiple times with successive chunks.
|
|
226
|
+
* Handles both plain text and gzip-compressed FASTA.
|
|
227
|
+
*
|
|
228
|
+
* # Arguments
|
|
229
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
230
|
+
* * `chunk` - A chunk of FASTA data as Uint8Array
|
|
231
|
+
*
|
|
232
|
+
* # Returns
|
|
233
|
+
* Ok on success, or an error with details about what went wrong.
|
|
234
|
+
*
|
|
235
|
+
* # Example (JavaScript)
|
|
236
|
+
* ```javascript
|
|
237
|
+
* const handle = fastaHasherNew();
|
|
238
|
+
* fastaHasherUpdate(handle, new TextEncoder().encode(">chr1\nACGT"));
|
|
239
|
+
* fastaHasherUpdate(handle, new TextEncoder().encode("\n>chr2\nTGCA\n"));
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export function fastaHasherUpdate(handle: number, chunk: Uint8Array): void;
|
|
243
|
+
|
|
83
244
|
export function greet(name: string): void;
|
|
84
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Compute a sequence digest (sha512t24u) from raw sequence data.
|
|
248
|
+
*
|
|
249
|
+
* This is the GA4GH standard digest for sequences. The sequence is uppercased
|
|
250
|
+
* before computing the digest.
|
|
251
|
+
*
|
|
252
|
+
* # Arguments
|
|
253
|
+
* * `sequence` - The sequence string (A, C, G, T, etc.)
|
|
254
|
+
*
|
|
255
|
+
* # Returns
|
|
256
|
+
* The sha512t24u digest string (base64url encoded)
|
|
257
|
+
*
|
|
258
|
+
* # Example (JavaScript)
|
|
259
|
+
* ```javascript
|
|
260
|
+
* const digest = sequenceDigest("ACGT");
|
|
261
|
+
* console.log(digest); // "aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2"
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
export function sequenceDigest(sequence: string): string;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Compute an MD5 digest from raw sequence data.
|
|
268
|
+
*
|
|
269
|
+
* The sequence is uppercased before computing the digest.
|
|
270
|
+
*
|
|
271
|
+
* # Arguments
|
|
272
|
+
* * `sequence` - The sequence string
|
|
273
|
+
*
|
|
274
|
+
* # Returns
|
|
275
|
+
* The MD5 digest as a hex string
|
|
276
|
+
*/
|
|
277
|
+
export function sequenceMd5(sequence: string): string;
|
|
278
|
+
|
|
85
279
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
86
280
|
|
|
87
281
|
export interface InitOutput {
|
|
88
282
|
readonly memory: WebAssembly.Memory;
|
|
283
|
+
readonly greet: (a: number, b: number) => void;
|
|
284
|
+
readonly canonicalizeJsonString: (a: number, b: number) => [number, number, number, number];
|
|
285
|
+
readonly computeMd5: (a: number, b: number) => [number, number];
|
|
286
|
+
readonly computeSha512t24u: (a: number, b: number) => [number, number];
|
|
287
|
+
readonly digestSeqcol: (a: number, b: number) => [number, number, number];
|
|
288
|
+
readonly fastaHasherFinish: (a: number) => [number, number, number];
|
|
289
|
+
readonly fastaHasherFree: (a: number) => number;
|
|
290
|
+
readonly fastaHasherNew: () => number;
|
|
291
|
+
readonly fastaHasherProgress: (a: number) => [number, number, number];
|
|
292
|
+
readonly fastaHasherUpdate: (a: number, b: number, c: number) => [number, number];
|
|
293
|
+
readonly sequenceDigest: (a: number, b: number) => [number, number];
|
|
294
|
+
readonly sequenceMd5: (a: number, b: number) => [number, number];
|
|
89
295
|
readonly __wbg_bedclassificationoutput_free: (a: number, b: number) => void;
|
|
90
296
|
readonly __wbg_chromosomestatistics_free: (a: number, b: number) => void;
|
|
91
297
|
readonly __wbg_regiondistribution_free: (a: number, b: number) => void;
|
|
@@ -138,7 +344,6 @@ export interface InitOutput {
|
|
|
138
344
|
readonly overlapper_find: (a: number, b: any) => [number, number, number];
|
|
139
345
|
readonly overlapper_get_backend: (a: number) => [number, number];
|
|
140
346
|
readonly overlapper_new: (a: any, b: number, c: number) => [number, number, number];
|
|
141
|
-
readonly greet: (a: number, b: number) => void;
|
|
142
347
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
143
348
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
144
349
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/gtars_js.js
CHANGED
|
@@ -567,6 +567,262 @@ export class Tokenizer {
|
|
|
567
567
|
}
|
|
568
568
|
if (Symbol.dispose) Tokenizer.prototype[Symbol.dispose] = Tokenizer.prototype.free;
|
|
569
569
|
|
|
570
|
+
/**
|
|
571
|
+
* Canonicalize a JSON string according to RFC-8785.
|
|
572
|
+
*
|
|
573
|
+
* This is useful for computing digests of JSON objects in a deterministic way.
|
|
574
|
+
*
|
|
575
|
+
* # Arguments
|
|
576
|
+
* * `json_str` - A JSON string
|
|
577
|
+
*
|
|
578
|
+
* # Returns
|
|
579
|
+
* The canonicalized JSON string
|
|
580
|
+
* @param {string} json_str
|
|
581
|
+
* @returns {string}
|
|
582
|
+
*/
|
|
583
|
+
export function canonicalizeJsonString(json_str) {
|
|
584
|
+
let deferred3_0;
|
|
585
|
+
let deferred3_1;
|
|
586
|
+
try {
|
|
587
|
+
const ptr0 = passStringToWasm0(json_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
588
|
+
const len0 = WASM_VECTOR_LEN;
|
|
589
|
+
const ret = wasm.canonicalizeJsonString(ptr0, len0);
|
|
590
|
+
var ptr2 = ret[0];
|
|
591
|
+
var len2 = ret[1];
|
|
592
|
+
if (ret[3]) {
|
|
593
|
+
ptr2 = 0; len2 = 0;
|
|
594
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
595
|
+
}
|
|
596
|
+
deferred3_0 = ptr2;
|
|
597
|
+
deferred3_1 = len2;
|
|
598
|
+
return getStringFromWasm0(ptr2, len2);
|
|
599
|
+
} finally {
|
|
600
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Compute the MD5 digest of a string.
|
|
606
|
+
*
|
|
607
|
+
* Low-level function that does NOT uppercase the input.
|
|
608
|
+
*
|
|
609
|
+
* # Arguments
|
|
610
|
+
* * `input` - The input string
|
|
611
|
+
*
|
|
612
|
+
* # Returns
|
|
613
|
+
* The MD5 digest as a hex string
|
|
614
|
+
* @param {string} input
|
|
615
|
+
* @returns {string}
|
|
616
|
+
*/
|
|
617
|
+
export function computeMd5(input) {
|
|
618
|
+
let deferred2_0;
|
|
619
|
+
let deferred2_1;
|
|
620
|
+
try {
|
|
621
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
622
|
+
const len0 = WASM_VECTOR_LEN;
|
|
623
|
+
const ret = wasm.computeMd5(ptr0, len0);
|
|
624
|
+
deferred2_0 = ret[0];
|
|
625
|
+
deferred2_1 = ret[1];
|
|
626
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
627
|
+
} finally {
|
|
628
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Compute the sha512t24u digest of a string.
|
|
634
|
+
*
|
|
635
|
+
* This is a low-level function that computes the GA4GH standard digest
|
|
636
|
+
* of arbitrary input. Unlike `sequence_digest`, this does NOT uppercase
|
|
637
|
+
* the input.
|
|
638
|
+
*
|
|
639
|
+
* # Arguments
|
|
640
|
+
* * `input` - The input string
|
|
641
|
+
*
|
|
642
|
+
* # Returns
|
|
643
|
+
* The sha512t24u digest string (base64url encoded)
|
|
644
|
+
* @param {string} input
|
|
645
|
+
* @returns {string}
|
|
646
|
+
*/
|
|
647
|
+
export function computeSha512t24u(input) {
|
|
648
|
+
let deferred2_0;
|
|
649
|
+
let deferred2_1;
|
|
650
|
+
try {
|
|
651
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
652
|
+
const len0 = WASM_VECTOR_LEN;
|
|
653
|
+
const ret = wasm.computeSha512t24u(ptr0, len0);
|
|
654
|
+
deferred2_0 = ret[0];
|
|
655
|
+
deferred2_1 = ret[1];
|
|
656
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
657
|
+
} finally {
|
|
658
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Compute a seqcol (sequence collection) digest from FASTA content.
|
|
664
|
+
*
|
|
665
|
+
* This function takes FASTA file content as bytes and returns a JSON object
|
|
666
|
+
* containing the sequence collection digest and metadata. Automatically handles
|
|
667
|
+
* gzip-compressed FASTA files.
|
|
668
|
+
*
|
|
669
|
+
* # Arguments
|
|
670
|
+
* * `fasta_content` - The FASTA file content as a Uint8Array (supports gzip)
|
|
671
|
+
*
|
|
672
|
+
* # Returns
|
|
673
|
+
* A JavaScript object containing:
|
|
674
|
+
* - `digest`: The top-level seqcol digest
|
|
675
|
+
* - `names_digest`: Level 1 digest of sequence names
|
|
676
|
+
* - `sequences_digest`: Level 1 digest of sequence digests
|
|
677
|
+
* - `lengths_digest`: Level 1 digest of sequence lengths
|
|
678
|
+
* - `n_sequences`: Number of sequences
|
|
679
|
+
* - `sequences`: Array of sequence metadata objects
|
|
680
|
+
*
|
|
681
|
+
* # Example (JavaScript)
|
|
682
|
+
* ```javascript
|
|
683
|
+
* const fastaContent = new TextEncoder().encode(">chr1\nACGT\n");
|
|
684
|
+
* const result = digestSeqcol(fastaContent);
|
|
685
|
+
* console.log(result.digest); // Top-level seqcol digest
|
|
686
|
+
* ```
|
|
687
|
+
* @param {Uint8Array} fasta_content
|
|
688
|
+
* @returns {any}
|
|
689
|
+
*/
|
|
690
|
+
export function digestSeqcol(fasta_content) {
|
|
691
|
+
const ptr0 = passArray8ToWasm0(fasta_content, wasm.__wbindgen_malloc);
|
|
692
|
+
const len0 = WASM_VECTOR_LEN;
|
|
693
|
+
const ret = wasm.digestSeqcol(ptr0, len0);
|
|
694
|
+
if (ret[2]) {
|
|
695
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
696
|
+
}
|
|
697
|
+
return takeFromExternrefTable0(ret[0]);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Finalize the hasher and return the results.
|
|
702
|
+
*
|
|
703
|
+
* This consumes the hasher and frees its resources.
|
|
704
|
+
* After calling this, the handle is no longer valid.
|
|
705
|
+
*
|
|
706
|
+
* # Arguments
|
|
707
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
708
|
+
*
|
|
709
|
+
* # Returns
|
|
710
|
+
* A JavaScript object with the sequence collection result,
|
|
711
|
+
* or an error if the handle is invalid.
|
|
712
|
+
*
|
|
713
|
+
* # Example (JavaScript)
|
|
714
|
+
* ```javascript
|
|
715
|
+
* const handle = fastaHasherNew();
|
|
716
|
+
* fastaHasherUpdate(handle, fastaData);
|
|
717
|
+
* const result = fastaHasherFinish(handle);
|
|
718
|
+
* console.log(result.digest);
|
|
719
|
+
* ```
|
|
720
|
+
* @param {number} handle
|
|
721
|
+
* @returns {any}
|
|
722
|
+
*/
|
|
723
|
+
export function fastaHasherFinish(handle) {
|
|
724
|
+
const ret = wasm.fastaHasherFinish(handle);
|
|
725
|
+
if (ret[2]) {
|
|
726
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
727
|
+
}
|
|
728
|
+
return takeFromExternrefTable0(ret[0]);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Free a hasher without getting results.
|
|
733
|
+
*
|
|
734
|
+
* Use this if you need to cancel processing early.
|
|
735
|
+
* After calling this, the handle is no longer valid.
|
|
736
|
+
*
|
|
737
|
+
* # Arguments
|
|
738
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
739
|
+
*
|
|
740
|
+
* # Returns
|
|
741
|
+
* `true` if the handle was valid and freed, `false` otherwise.
|
|
742
|
+
* @param {number} handle
|
|
743
|
+
* @returns {boolean}
|
|
744
|
+
*/
|
|
745
|
+
export function fastaHasherFree(handle) {
|
|
746
|
+
const ret = wasm.fastaHasherFree(handle);
|
|
747
|
+
return ret !== 0;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Create a new streaming FASTA hasher.
|
|
752
|
+
*
|
|
753
|
+
* Returns a handle (u32) that must be used in subsequent calls.
|
|
754
|
+
* The handle must be freed with `fastaHasherFinish()` or `fastaHasherFree()`.
|
|
755
|
+
*
|
|
756
|
+
* # Returns
|
|
757
|
+
* A handle ID (always > 0).
|
|
758
|
+
*
|
|
759
|
+
* # Example (JavaScript)
|
|
760
|
+
* ```javascript
|
|
761
|
+
* const handle = fastaHasherNew();
|
|
762
|
+
* // ... use handle with fastaHasherUpdate ...
|
|
763
|
+
* const result = fastaHasherFinish(handle);
|
|
764
|
+
* ```
|
|
765
|
+
* @returns {number}
|
|
766
|
+
*/
|
|
767
|
+
export function fastaHasherNew() {
|
|
768
|
+
const ret = wasm.fastaHasherNew();
|
|
769
|
+
return ret >>> 0;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Get the current progress of a streaming hasher.
|
|
774
|
+
*
|
|
775
|
+
* # Arguments
|
|
776
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
777
|
+
*
|
|
778
|
+
* # Returns
|
|
779
|
+
* A JavaScript object with progress information, or null if handle is invalid.
|
|
780
|
+
* The object contains:
|
|
781
|
+
* - `completed_sequences`: Number of fully processed sequences
|
|
782
|
+
* - `current_sequence_name`: Name of sequence being processed (if any)
|
|
783
|
+
* - `current_sequence_length`: Length of sequence being processed
|
|
784
|
+
* @param {number} handle
|
|
785
|
+
* @returns {any}
|
|
786
|
+
*/
|
|
787
|
+
export function fastaHasherProgress(handle) {
|
|
788
|
+
const ret = wasm.fastaHasherProgress(handle);
|
|
789
|
+
if (ret[2]) {
|
|
790
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
791
|
+
}
|
|
792
|
+
return takeFromExternrefTable0(ret[0]);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Process a chunk of FASTA data.
|
|
797
|
+
*
|
|
798
|
+
* This can be called multiple times with successive chunks.
|
|
799
|
+
* Handles both plain text and gzip-compressed FASTA.
|
|
800
|
+
*
|
|
801
|
+
* # Arguments
|
|
802
|
+
* * `handle` - The hasher handle from `fastaHasherNew()`
|
|
803
|
+
* * `chunk` - A chunk of FASTA data as Uint8Array
|
|
804
|
+
*
|
|
805
|
+
* # Returns
|
|
806
|
+
* Ok on success, or an error with details about what went wrong.
|
|
807
|
+
*
|
|
808
|
+
* # Example (JavaScript)
|
|
809
|
+
* ```javascript
|
|
810
|
+
* const handle = fastaHasherNew();
|
|
811
|
+
* fastaHasherUpdate(handle, new TextEncoder().encode(">chr1\nACGT"));
|
|
812
|
+
* fastaHasherUpdate(handle, new TextEncoder().encode("\n>chr2\nTGCA\n"));
|
|
813
|
+
* ```
|
|
814
|
+
* @param {number} handle
|
|
815
|
+
* @param {Uint8Array} chunk
|
|
816
|
+
*/
|
|
817
|
+
export function fastaHasherUpdate(handle, chunk) {
|
|
818
|
+
const ptr0 = passArray8ToWasm0(chunk, wasm.__wbindgen_malloc);
|
|
819
|
+
const len0 = WASM_VECTOR_LEN;
|
|
820
|
+
const ret = wasm.fastaHasherUpdate(handle, ptr0, len0);
|
|
821
|
+
if (ret[1]) {
|
|
822
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
570
826
|
/**
|
|
571
827
|
* @param {string} name
|
|
572
828
|
*/
|
|
@@ -576,6 +832,69 @@ export function greet(name) {
|
|
|
576
832
|
wasm.greet(ptr0, len0);
|
|
577
833
|
}
|
|
578
834
|
|
|
835
|
+
/**
|
|
836
|
+
* Compute a sequence digest (sha512t24u) from raw sequence data.
|
|
837
|
+
*
|
|
838
|
+
* This is the GA4GH standard digest for sequences. The sequence is uppercased
|
|
839
|
+
* before computing the digest.
|
|
840
|
+
*
|
|
841
|
+
* # Arguments
|
|
842
|
+
* * `sequence` - The sequence string (A, C, G, T, etc.)
|
|
843
|
+
*
|
|
844
|
+
* # Returns
|
|
845
|
+
* The sha512t24u digest string (base64url encoded)
|
|
846
|
+
*
|
|
847
|
+
* # Example (JavaScript)
|
|
848
|
+
* ```javascript
|
|
849
|
+
* const digest = sequenceDigest("ACGT");
|
|
850
|
+
* console.log(digest); // "aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2"
|
|
851
|
+
* ```
|
|
852
|
+
* @param {string} sequence
|
|
853
|
+
* @returns {string}
|
|
854
|
+
*/
|
|
855
|
+
export function sequenceDigest(sequence) {
|
|
856
|
+
let deferred2_0;
|
|
857
|
+
let deferred2_1;
|
|
858
|
+
try {
|
|
859
|
+
const ptr0 = passStringToWasm0(sequence, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
860
|
+
const len0 = WASM_VECTOR_LEN;
|
|
861
|
+
const ret = wasm.sequenceDigest(ptr0, len0);
|
|
862
|
+
deferred2_0 = ret[0];
|
|
863
|
+
deferred2_1 = ret[1];
|
|
864
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
865
|
+
} finally {
|
|
866
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Compute an MD5 digest from raw sequence data.
|
|
872
|
+
*
|
|
873
|
+
* The sequence is uppercased before computing the digest.
|
|
874
|
+
*
|
|
875
|
+
* # Arguments
|
|
876
|
+
* * `sequence` - The sequence string
|
|
877
|
+
*
|
|
878
|
+
* # Returns
|
|
879
|
+
* The MD5 digest as a hex string
|
|
880
|
+
* @param {string} sequence
|
|
881
|
+
* @returns {string}
|
|
882
|
+
*/
|
|
883
|
+
export function sequenceMd5(sequence) {
|
|
884
|
+
let deferred2_0;
|
|
885
|
+
let deferred2_1;
|
|
886
|
+
try {
|
|
887
|
+
const ptr0 = passStringToWasm0(sequence, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
888
|
+
const len0 = WASM_VECTOR_LEN;
|
|
889
|
+
const ret = wasm.sequenceMd5(ptr0, len0);
|
|
890
|
+
deferred2_0 = ret[0];
|
|
891
|
+
deferred2_1 = ret[1];
|
|
892
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
893
|
+
} finally {
|
|
894
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
579
898
|
function __wbg_get_imports() {
|
|
580
899
|
const import0 = {
|
|
581
900
|
__proto__: null,
|
|
@@ -636,7 +955,7 @@ function __wbg_get_imports() {
|
|
|
636
955
|
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
637
956
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
638
957
|
},
|
|
639
|
-
|
|
958
|
+
__wbg_alert_b04a0b1c35e31e39: function(arg0, arg1) {
|
|
640
959
|
alert(getStringFromWasm0(arg0, arg1));
|
|
641
960
|
},
|
|
642
961
|
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
@@ -746,6 +1065,11 @@ function __wbg_get_imports() {
|
|
|
746
1065
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
747
1066
|
return ret;
|
|
748
1067
|
},
|
|
1068
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
1069
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1070
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1071
|
+
return ret;
|
|
1072
|
+
},
|
|
749
1073
|
__wbindgen_init_externref_table: function() {
|
|
750
1074
|
const table = wasm.__wbindgen_externrefs;
|
|
751
1075
|
const offset = table.grow(4);
|
|
@@ -891,6 +1215,13 @@ function isLikeNone(x) {
|
|
|
891
1215
|
return x === undefined || x === null;
|
|
892
1216
|
}
|
|
893
1217
|
|
|
1218
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1219
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1220
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1221
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1222
|
+
return ptr;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
894
1225
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
895
1226
|
if (realloc === undefined) {
|
|
896
1227
|
const buf = cachedTextEncoder.encode(arg);
|
package/gtars_js_bg.wasm
CHANGED
|
Binary file
|