@kent-tokyo/chematic 1.0.16 → 1.0.18
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/chematic_wasm.d.ts +43 -1
- package/chematic_wasm.js +121 -1
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/chematic_wasm.d.ts
CHANGED
|
@@ -507,6 +507,40 @@ export class RdkitSearchIndex {
|
|
|
507
507
|
search_json_threshold_precise(query_smiles: string, threshold: number, k: number): string;
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Stateful, bounded adapter for an unknown-length SMILES source.
|
|
512
|
+
*
|
|
513
|
+
* Callers distinguish observation from processing: this lets a Worker report
|
|
514
|
+
* rows already read but not yet processed when it is cancelled. `finish_json`
|
|
515
|
+
* is the only normal EOF path; `stop_json` reports an unknown unread suffix
|
|
516
|
+
* and never fabricates skipped or successful rows.
|
|
517
|
+
*/
|
|
518
|
+
export class SmilesBatchStreamHandle {
|
|
519
|
+
free(): void;
|
|
520
|
+
[Symbol.dispose](): void;
|
|
521
|
+
/**
|
|
522
|
+
* Mark EOF and process every observed pending row into a complete manifest.
|
|
523
|
+
*/
|
|
524
|
+
finish_json(): string;
|
|
525
|
+
/**
|
|
526
|
+
* Start an unknown-length batch. A handle is terminal after `finish_json`
|
|
527
|
+
* or `stop_json` and cannot be reused for a second source.
|
|
528
|
+
*/
|
|
529
|
+
constructor();
|
|
530
|
+
/**
|
|
531
|
+
* Register one row observed from the source without processing it yet.
|
|
532
|
+
*/
|
|
533
|
+
observe(smiles: string): number;
|
|
534
|
+
/**
|
|
535
|
+
* Process one previously observed row, returning `null` when none remain.
|
|
536
|
+
*/
|
|
537
|
+
process_next_json(): string;
|
|
538
|
+
/**
|
|
539
|
+
* Stop before EOF with a typed reason and an explicitly unknown unread suffix.
|
|
540
|
+
*/
|
|
541
|
+
stop_json(terminal_reason: string): string;
|
|
542
|
+
}
|
|
543
|
+
|
|
510
544
|
/**
|
|
511
545
|
* Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
|
|
512
546
|
*/
|
|
@@ -634,7 +668,9 @@ export function canonical_tautomer_with_blocked_atoms_json(mol: MolHandle, block
|
|
|
634
668
|
*
|
|
635
669
|
* Each result retains its input index and original text. Invalid records are
|
|
636
670
|
* returned inline with `status: "rejected"`; later records are still
|
|
637
|
-
* processed in deterministic input order.
|
|
671
|
+
* processed in deterministic input order. The manifest includes explicit
|
|
672
|
+
* outcome accounting so callers do not infer full success from a zero error
|
|
673
|
+
* list while inputs were skipped elsewhere.
|
|
638
674
|
*/
|
|
639
675
|
export function canonicalize_smiles_batch_json(smiles_batch: string, delimiter: string): string;
|
|
640
676
|
|
|
@@ -2928,6 +2964,7 @@ export interface InitOutput {
|
|
|
2928
2964
|
readonly __wbg_mhfplshhandle_free: (a: number, b: number) => void;
|
|
2929
2965
|
readonly __wbg_molhandle_free: (a: number, b: number) => void;
|
|
2930
2966
|
readonly __wbg_rdkitsearchindex_free: (a: number, b: number) => void;
|
|
2967
|
+
readonly __wbg_smilesbatchstreamhandle_free: (a: number, b: number) => void;
|
|
2931
2968
|
readonly add_hydrogens: (a: number) => number;
|
|
2932
2969
|
readonly admet_profile_json: (a: number, b: number) => [number, number];
|
|
2933
2970
|
readonly atom_pair_bitvec: (a: number) => [number, number];
|
|
@@ -3253,6 +3290,11 @@ export interface InitOutput {
|
|
|
3253
3290
|
readonly smiles_to_mol2: (a: number, b: number) => [number, number];
|
|
3254
3291
|
readonly smiles_to_pdbqt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
3255
3292
|
readonly smiles_to_svg_highlighted: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
3293
|
+
readonly smilesbatchstreamhandle_finish_json: (a: number) => [number, number, number, number];
|
|
3294
|
+
readonly smilesbatchstreamhandle_new: () => number;
|
|
3295
|
+
readonly smilesbatchstreamhandle_observe: (a: number, b: number, c: number) => [number, number, number];
|
|
3296
|
+
readonly smilesbatchstreamhandle_process_next_json: (a: number) => [number, number, number, number];
|
|
3297
|
+
readonly smilesbatchstreamhandle_stop_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
3256
3298
|
readonly smr_vsa_json: (a: number) => [number, number];
|
|
3257
3299
|
readonly sssr_rings_json: (a: number) => [number, number];
|
|
3258
3300
|
readonly standardize_smiles: (a: number, b: number) => [number, number];
|
package/chematic_wasm.js
CHANGED
|
@@ -1207,6 +1207,121 @@ export class RdkitSearchIndex {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
if (Symbol.dispose) RdkitSearchIndex.prototype[Symbol.dispose] = RdkitSearchIndex.prototype.free;
|
|
1209
1209
|
|
|
1210
|
+
/**
|
|
1211
|
+
* Stateful, bounded adapter for an unknown-length SMILES source.
|
|
1212
|
+
*
|
|
1213
|
+
* Callers distinguish observation from processing: this lets a Worker report
|
|
1214
|
+
* rows already read but not yet processed when it is cancelled. `finish_json`
|
|
1215
|
+
* is the only normal EOF path; `stop_json` reports an unknown unread suffix
|
|
1216
|
+
* and never fabricates skipped or successful rows.
|
|
1217
|
+
*/
|
|
1218
|
+
export class SmilesBatchStreamHandle {
|
|
1219
|
+
__destroy_into_raw() {
|
|
1220
|
+
const ptr = this.__wbg_ptr;
|
|
1221
|
+
this.__wbg_ptr = 0;
|
|
1222
|
+
SmilesBatchStreamHandleFinalization.unregister(this);
|
|
1223
|
+
return ptr;
|
|
1224
|
+
}
|
|
1225
|
+
free() {
|
|
1226
|
+
const ptr = this.__destroy_into_raw();
|
|
1227
|
+
wasm.__wbg_smilesbatchstreamhandle_free(ptr, 0);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Mark EOF and process every observed pending row into a complete manifest.
|
|
1231
|
+
* @returns {string}
|
|
1232
|
+
*/
|
|
1233
|
+
finish_json() {
|
|
1234
|
+
let deferred2_0;
|
|
1235
|
+
let deferred2_1;
|
|
1236
|
+
try {
|
|
1237
|
+
const ret = wasm.smilesbatchstreamhandle_finish_json(this.__wbg_ptr);
|
|
1238
|
+
var ptr1 = ret[0];
|
|
1239
|
+
var len1 = ret[1];
|
|
1240
|
+
if (ret[3]) {
|
|
1241
|
+
ptr1 = 0; len1 = 0;
|
|
1242
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1243
|
+
}
|
|
1244
|
+
deferred2_0 = ptr1;
|
|
1245
|
+
deferred2_1 = len1;
|
|
1246
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1247
|
+
} finally {
|
|
1248
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Start an unknown-length batch. A handle is terminal after `finish_json`
|
|
1253
|
+
* or `stop_json` and cannot be reused for a second source.
|
|
1254
|
+
*/
|
|
1255
|
+
constructor() {
|
|
1256
|
+
const ret = wasm.smilesbatchstreamhandle_new();
|
|
1257
|
+
this.__wbg_ptr = ret;
|
|
1258
|
+
SmilesBatchStreamHandleFinalization.register(this, this.__wbg_ptr, this);
|
|
1259
|
+
return this;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Register one row observed from the source without processing it yet.
|
|
1263
|
+
* @param {string} smiles
|
|
1264
|
+
* @returns {number}
|
|
1265
|
+
*/
|
|
1266
|
+
observe(smiles) {
|
|
1267
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1268
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1269
|
+
const ret = wasm.smilesbatchstreamhandle_observe(this.__wbg_ptr, ptr0, len0);
|
|
1270
|
+
if (ret[2]) {
|
|
1271
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1272
|
+
}
|
|
1273
|
+
return ret[0] >>> 0;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Process one previously observed row, returning `null` when none remain.
|
|
1277
|
+
* @returns {string}
|
|
1278
|
+
*/
|
|
1279
|
+
process_next_json() {
|
|
1280
|
+
let deferred2_0;
|
|
1281
|
+
let deferred2_1;
|
|
1282
|
+
try {
|
|
1283
|
+
const ret = wasm.smilesbatchstreamhandle_process_next_json(this.__wbg_ptr);
|
|
1284
|
+
var ptr1 = ret[0];
|
|
1285
|
+
var len1 = ret[1];
|
|
1286
|
+
if (ret[3]) {
|
|
1287
|
+
ptr1 = 0; len1 = 0;
|
|
1288
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1289
|
+
}
|
|
1290
|
+
deferred2_0 = ptr1;
|
|
1291
|
+
deferred2_1 = len1;
|
|
1292
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1293
|
+
} finally {
|
|
1294
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Stop before EOF with a typed reason and an explicitly unknown unread suffix.
|
|
1299
|
+
* @param {string} terminal_reason
|
|
1300
|
+
* @returns {string}
|
|
1301
|
+
*/
|
|
1302
|
+
stop_json(terminal_reason) {
|
|
1303
|
+
let deferred3_0;
|
|
1304
|
+
let deferred3_1;
|
|
1305
|
+
try {
|
|
1306
|
+
const ptr0 = passStringToWasm0(terminal_reason, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1307
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1308
|
+
const ret = wasm.smilesbatchstreamhandle_stop_json(this.__wbg_ptr, ptr0, len0);
|
|
1309
|
+
var ptr2 = ret[0];
|
|
1310
|
+
var len2 = ret[1];
|
|
1311
|
+
if (ret[3]) {
|
|
1312
|
+
ptr2 = 0; len2 = 0;
|
|
1313
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1314
|
+
}
|
|
1315
|
+
deferred3_0 = ptr2;
|
|
1316
|
+
deferred3_1 = len2;
|
|
1317
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1318
|
+
} finally {
|
|
1319
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
if (Symbol.dispose) SmilesBatchStreamHandle.prototype[Symbol.dispose] = SmilesBatchStreamHandle.prototype.free;
|
|
1324
|
+
|
|
1210
1325
|
/**
|
|
1211
1326
|
* Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
|
|
1212
1327
|
* @param {MolHandle} mol
|
|
@@ -1501,7 +1616,9 @@ export function canonical_tautomer_with_blocked_atoms_json(mol, blocked_atom_ind
|
|
|
1501
1616
|
*
|
|
1502
1617
|
* Each result retains its input index and original text. Invalid records are
|
|
1503
1618
|
* returned inline with `status: "rejected"`; later records are still
|
|
1504
|
-
* processed in deterministic input order.
|
|
1619
|
+
* processed in deterministic input order. The manifest includes explicit
|
|
1620
|
+
* outcome accounting so callers do not infer full success from a zero error
|
|
1621
|
+
* list while inputs were skipped elsewhere.
|
|
1505
1622
|
* @param {string} smiles_batch
|
|
1506
1623
|
* @param {string} delimiter
|
|
1507
1624
|
* @returns {string}
|
|
@@ -7907,6 +8024,9 @@ const MolHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
7907
8024
|
const RdkitSearchIndexFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7908
8025
|
? { register: () => {}, unregister: () => {} }
|
|
7909
8026
|
: new FinalizationRegistry(ptr => wasm.__wbg_rdkitsearchindex_free(ptr, 1));
|
|
8027
|
+
const SmilesBatchStreamHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
8028
|
+
? { register: () => {}, unregister: () => {} }
|
|
8029
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_smilesbatchstreamhandle_free(ptr, 1));
|
|
7910
8030
|
|
|
7911
8031
|
function addToExternrefTable0(obj) {
|
|
7912
8032
|
const idx = wasm.__externref_table_alloc();
|
package/chematic_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"Kentaro Tanabe (kent-tokyo) <kent-tokyo@users.noreply.github.com>"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.18",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|