@kent-tokyo/chematic 1.0.11 → 1.0.12

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.
@@ -2237,6 +2237,17 @@ export function rgroup_decompose_json(smiles_json: string, core_smarts: string):
2237
2237
  */
2238
2238
  export function ring_families_json(mol: MolHandle): string;
2239
2239
 
2240
+ /**
2241
+ * Parse and serialize a V3000 block while preserving opaque V3000 metadata.
2242
+ *
2243
+ * Unlike the topology-only [`mol_from_v3000_block`] + [`to_mol_v3000_block`]
2244
+ * pair, this explicit round-trip API retains `SGROUP` logical lines and
2245
+ * `COLLECTION` stereo groups. SGROUP semantics remain opaque until the core
2246
+ * molecule model grows a typed representation; the API therefore preserves
2247
+ * bytes at the logical-line level without claiming polymer/query semantics.
2248
+ */
2249
+ export function roundtrip_mol_v3000_block(block: string): string;
2250
+
2240
2251
  /**
2241
2252
  * Apply a SMIRKS reaction template and return product SMILES as a JSON string.
2242
2253
  *
@@ -2345,6 +2356,11 @@ export function semantic_apply_json_command(model_json: string, command_json: st
2345
2356
  */
2346
2357
  export function semantic_expand_json(base_smiles: string, model_json: string): string;
2347
2358
 
2359
+ /**
2360
+ * Expand a validated semantic model with explicit finite atom/repeat budgets.
2361
+ */
2362
+ export function semantic_expand_json_with_limits(base_smiles: string, model_json: string, max_atoms: number, max_repeat_count: number): string;
2363
+
2348
2364
  /**
2349
2365
  * Validate and normalize a typed Markush/polymer semantic model JSON.
2350
2366
  */
@@ -2472,6 +2488,14 @@ export function start(): void;
2472
2488
  */
2473
2489
  export function stereo_parent_json(mol: MolHandle): string;
2474
2490
 
2491
+ /**
2492
+ * Analyze a rich reaction document's explicit atom/isotope inventory and
2493
+ * formal charges. The returned JSON includes evidence scope, per-step
2494
+ * diagnostics, and a status that does not imply chemical completeness.
2495
+ * Returns `error:<msg>` when the document or a component is invalid.
2496
+ */
2497
+ export function stoichiometry_report_json(document_json: string): string;
2498
+
2475
2499
  /**
2476
2500
  * Compute the composed Super Parent with explicit resource limits.
2477
2501
  */
@@ -2936,7 +2960,6 @@ export interface InitOutput {
2936
2960
  readonly molecule_report_json: (a: number, b: number) => [number, number, number, number];
2937
2961
  readonly molhandle_aromatic_ring_count: (a: number) => number;
2938
2962
  readonly molhandle_assign_cip_json: (a: number) => [number, number];
2939
- readonly molhandle_atom_count: (a: number) => number;
2940
2963
  readonly molhandle_bbb_passes: (a: number) => number;
2941
2964
  readonly molhandle_bbb_score: (a: number) => number;
2942
2965
  readonly molhandle_bertz_ct: (a: number) => number;
@@ -3054,6 +3077,7 @@ export interface InitOutput {
3054
3077
  readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3055
3078
  readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3056
3079
  readonly ring_families_json: (a: number) => [number, number, number, number];
3080
+ readonly roundtrip_mol_v3000_block: (a: number, b: number) => [number, number, number, number];
3057
3081
  readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3058
3082
  readonly rxn_document_from_rxn: (a: number, b: number) => [number, number, number, number];
3059
3083
  readonly rxn_document_to_rxn: (a: number, b: number) => [number, number, number, number];
@@ -3065,6 +3089,7 @@ export interface InitOutput {
3065
3089
  readonly sdf_to_smiles_json: (a: number, b: number) => [number, number];
3066
3090
  readonly semantic_apply_json_command: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3067
3091
  readonly semantic_expand_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3092
+ readonly semantic_expand_json_with_limits: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
3068
3093
  readonly semantic_model_json: (a: number, b: number) => [number, number, number, number];
3069
3094
  readonly set_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
3070
3095
  readonly shape_descriptors_json: (a: number) => [number, number];
@@ -3079,8 +3104,8 @@ export interface InitOutput {
3079
3104
  readonly sssr_rings_json: (a: number) => [number, number];
3080
3105
  readonly standardize_smiles: (a: number, b: number) => [number, number];
3081
3106
  readonly standardize_smiles_report_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
3082
- readonly start: () => void;
3083
3107
  readonly stereo_parent_json: (a: number) => [number, number];
3108
+ readonly stoichiometry_report_json: (a: number, b: number) => [number, number];
3084
3109
  readonly super_parent_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
3085
3110
  readonly super_parent_report_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
3086
3111
  readonly tanimoto_atom_pair: (a: number, b: number) => number;
@@ -3121,6 +3146,8 @@ export interface InitOutput {
3121
3146
  readonly xlogp3_json: (a: number) => [number, number];
3122
3147
  readonly xlogp3_per_atom_json: (a: number) => [number, number];
3123
3148
  readonly xyz_frames_batch_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3149
+ readonly molhandle_atom_count: (a: number) => number;
3150
+ readonly start: () => void;
3124
3151
  readonly __wbindgen_malloc: (a: number, b: number) => number;
3125
3152
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
3126
3153
  readonly __externref_table_alloc: () => number;
package/chematic_wasm.js CHANGED
@@ -104,7 +104,7 @@ export class ConformerHandle {
104
104
  const ret = wasm.conformerhandle_get_conformer_pdb(this.__wbg_ptr, idx);
105
105
  let v1;
106
106
  if (ret[0] !== 0) {
107
- v1 = getStringFromWasm0(ret[0], ret[1]);
107
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
108
108
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
109
109
  }
110
110
  return v1;
@@ -5055,7 +5055,7 @@ export function pqr_infer_element(group_pdb, res_name, atom_name) {
5055
5055
  const ret = wasm.pqr_infer_element(ptr0, len0, ptr1, len1, ptr2, len2);
5056
5056
  let v4;
5057
5057
  if (ret[0] !== 0) {
5058
- v4 = getStringFromWasm0(ret[0], ret[1]);
5058
+ v4 = getStringFromWasm0(ret[0], ret[1]).slice();
5059
5059
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
5060
5060
  }
5061
5061
  return v4;
@@ -5635,6 +5635,38 @@ export function ring_families_json(mol) {
5635
5635
  }
5636
5636
  }
5637
5637
 
5638
+ /**
5639
+ * Parse and serialize a V3000 block while preserving opaque V3000 metadata.
5640
+ *
5641
+ * Unlike the topology-only [`mol_from_v3000_block`] + [`to_mol_v3000_block`]
5642
+ * pair, this explicit round-trip API retains `SGROUP` logical lines and
5643
+ * `COLLECTION` stereo groups. SGROUP semantics remain opaque until the core
5644
+ * molecule model grows a typed representation; the API therefore preserves
5645
+ * bytes at the logical-line level without claiming polymer/query semantics.
5646
+ * @param {string} block
5647
+ * @returns {string}
5648
+ */
5649
+ export function roundtrip_mol_v3000_block(block) {
5650
+ let deferred3_0;
5651
+ let deferred3_1;
5652
+ try {
5653
+ const ptr0 = passStringToWasm0(block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5654
+ const len0 = WASM_VECTOR_LEN;
5655
+ const ret = wasm.roundtrip_mol_v3000_block(ptr0, len0);
5656
+ var ptr2 = ret[0];
5657
+ var len2 = ret[1];
5658
+ if (ret[3]) {
5659
+ ptr2 = 0; len2 = 0;
5660
+ throw takeFromExternrefTable0(ret[2]);
5661
+ }
5662
+ deferred3_0 = ptr2;
5663
+ deferred3_1 = len2;
5664
+ return getStringFromWasm0(ptr2, len2);
5665
+ } finally {
5666
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
5667
+ }
5668
+ }
5669
+
5638
5670
  /**
5639
5671
  * Apply a SMIRKS reaction template and return product SMILES as a JSON string.
5640
5672
  *
@@ -5961,6 +5993,37 @@ export function semantic_expand_json(base_smiles, model_json) {
5961
5993
  }
5962
5994
  }
5963
5995
 
5996
+ /**
5997
+ * Expand a validated semantic model with explicit finite atom/repeat budgets.
5998
+ * @param {string} base_smiles
5999
+ * @param {string} model_json
6000
+ * @param {number} max_atoms
6001
+ * @param {number} max_repeat_count
6002
+ * @returns {string}
6003
+ */
6004
+ export function semantic_expand_json_with_limits(base_smiles, model_json, max_atoms, max_repeat_count) {
6005
+ let deferred4_0;
6006
+ let deferred4_1;
6007
+ try {
6008
+ const ptr0 = passStringToWasm0(base_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6009
+ const len0 = WASM_VECTOR_LEN;
6010
+ const ptr1 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6011
+ const len1 = WASM_VECTOR_LEN;
6012
+ const ret = wasm.semantic_expand_json_with_limits(ptr0, len0, ptr1, len1, max_atoms, max_repeat_count);
6013
+ var ptr3 = ret[0];
6014
+ var len3 = ret[1];
6015
+ if (ret[3]) {
6016
+ ptr3 = 0; len3 = 0;
6017
+ throw takeFromExternrefTable0(ret[2]);
6018
+ }
6019
+ deferred4_0 = ptr3;
6020
+ deferred4_1 = len3;
6021
+ return getStringFromWasm0(ptr3, len3);
6022
+ } finally {
6023
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
6024
+ }
6025
+ }
6026
+
5964
6027
  /**
5965
6028
  * Validate and normalize a typed Markush/polymer semantic model JSON.
5966
6029
  * @param {string} model_json
@@ -6378,6 +6441,29 @@ export function stereo_parent_json(mol) {
6378
6441
  }
6379
6442
  }
6380
6443
 
6444
+ /**
6445
+ * Analyze a rich reaction document's explicit atom/isotope inventory and
6446
+ * formal charges. The returned JSON includes evidence scope, per-step
6447
+ * diagnostics, and a status that does not imply chemical completeness.
6448
+ * Returns `error:<msg>` when the document or a component is invalid.
6449
+ * @param {string} document_json
6450
+ * @returns {string}
6451
+ */
6452
+ export function stoichiometry_report_json(document_json) {
6453
+ let deferred2_0;
6454
+ let deferred2_1;
6455
+ try {
6456
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6457
+ const len0 = WASM_VECTOR_LEN;
6458
+ const ret = wasm.stoichiometry_report_json(ptr0, len0);
6459
+ deferred2_0 = ret[0];
6460
+ deferred2_1 = ret[1];
6461
+ return getStringFromWasm0(ret[0], ret[1]);
6462
+ } finally {
6463
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
6464
+ }
6465
+ }
6466
+
6381
6467
  /**
6382
6468
  * Compute the composed Super Parent with explicit resource limits.
6383
6469
  * @param {MolHandle} mol
@@ -7289,11 +7375,11 @@ export function xyz_frames_batch_json(text, offset, batch_size) {
7289
7375
  function __wbg_get_imports() {
7290
7376
  const import0 = {
7291
7377
  __proto__: null,
7292
- __wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
7378
+ __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
7293
7379
  const ret = arg0 === undefined;
7294
7380
  return ret;
7295
7381
  },
7296
- __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
7382
+ __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
7297
7383
  const obj = arg1;
7298
7384
  const ret = typeof(obj) === 'string' ? obj : undefined;
7299
7385
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -7301,17 +7387,17 @@ function __wbg_get_imports() {
7301
7387
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
7302
7388
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
7303
7389
  },
7304
- __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
7390
+ __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
7305
7391
  throw new Error(getStringFromWasm0(arg0, arg1));
7306
7392
  },
7307
- __wbg_error_756c5934221e6fee: function(arg0) {
7393
+ __wbg_error_f085d7e62279b703: function(arg0) {
7308
7394
  console.error(arg0);
7309
7395
  },
7310
- __wbg_new_from_slice_3b4c7f1456059f80: function(arg0, arg1) {
7396
+ __wbg_new_from_slice_02962bf7778cf945: function(arg0, arg1) {
7311
7397
  const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
7312
7398
  return ret;
7313
7399
  },
7314
- __wbg_new_from_slice_a500ec81601be48f: function(arg0, arg1) {
7400
+ __wbg_new_from_slice_f92bf65e9a895613: function(arg0, arg1) {
7315
7401
  const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
7316
7402
  return ret;
7317
7403
  },
@@ -7323,28 +7409,28 @@ function __wbg_get_imports() {
7323
7409
  const ret = arg0.performance;
7324
7410
  return ret;
7325
7411
  },
7326
- __wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
7327
- const ret = typeof global === 'undefined' ? null : global;
7412
+ __wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
7413
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
7328
7414
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
7329
7415
  },
7330
- __wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
7331
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
7416
+ __wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
7417
+ const ret = typeof global === 'undefined' ? null : global;
7332
7418
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
7333
7419
  },
7334
- __wbg_static_accessor_SELF_d8b50611246a6d92: function() {
7420
+ __wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
7335
7421
  const ret = typeof self === 'undefined' ? null : self;
7336
7422
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
7337
7423
  },
7338
- __wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
7424
+ __wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
7339
7425
  const ret = typeof window === 'undefined' ? null : window;
7340
7426
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
7341
7427
  },
7342
- __wbindgen_generic_0000000000000001: function(arg0) {
7428
+ __wbindgen_cast_0000000000000001: function(arg0) {
7343
7429
  // Cast intrinsic for `F64 -> Externref`.
7344
7430
  const ret = arg0;
7345
7431
  return ret;
7346
7432
  },
7347
- __wbindgen_generic_0000000000000002: function(arg0, arg1) {
7433
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
7348
7434
  // Cast intrinsic for `Ref(String) -> Externref`.
7349
7435
  const ret = getStringFromWasm0(arg0, arg1);
7350
7436
  return ret;
@@ -7539,15 +7625,11 @@ function __wbg_finalize_init(instance, module) {
7539
7625
 
7540
7626
  async function __wbg_load(module, imports) {
7541
7627
  if (typeof Response === 'function' && module instanceof Response) {
7542
- if (!module.ok) {
7543
- throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
7544
- }
7545
-
7546
7628
  if (typeof WebAssembly.instantiateStreaming === 'function') {
7547
7629
  try {
7548
7630
  return await WebAssembly.instantiateStreaming(module, imports);
7549
7631
  } catch (e) {
7550
- const validResponse = expectedResponseType(module.type);
7632
+ const validResponse = module.ok && expectedResponseType(module.type);
7551
7633
 
7552
7634
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
7553
7635
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
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.11",
8
+ "version": "1.0.12",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",