@kent-tokyo/chematic 0.21.0 → 0.23.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.
@@ -823,6 +823,20 @@ export function ecfp6_bitvec_with_chirality(mol: MolHandle, use_chirality: boole
823
823
  */
824
824
  export function ecfp_bitvec_custom(mol: MolHandle, radius: number, nbits: number, use_chirality: boolean): Uint8Array;
825
825
 
826
+ /**
827
+ * Run `embed_ensemble_v2` on `mol`'s own atom order (never canonicalizes/
828
+ * reparses, same convention as `embed_pipeline_v2_json`). See the module doc
829
+ * for the config JSON shape and the success/failure envelope shape.
830
+ *
831
+ * Never throws. Always returns a JSON string tagged `schemaVersion: 1` and
832
+ * `ok: true`/`false`. `ok: false` covers both a WASM-level rejection
833
+ * (oversized input, too many atoms, malformed/incomplete config JSON) and a
834
+ * config `embed_ensemble_v2` itself rejects (currently only an invalid
835
+ * `rmsdThreshold`) -- distinguished by `error.stage` /
836
+ * `error.cause.kind`, same as `embed_pipeline_v2_json`.
837
+ */
838
+ export function embed_ensemble_v2_json(mol: MolHandle, config_json: string): string;
839
+
826
840
  /**
827
841
  * Run the opt-in v2 embedding pipeline, applied directly to `mol`'s own atom
828
842
  * order (never canonicalizes/reparses -- see the module doc).
@@ -1307,6 +1321,25 @@ export function maxmin_picks_ecfp4_json(smiles_json: string, n: number): string;
1307
1321
  */
1308
1322
  export function mcs_smiles_json(smiles_json: string): string;
1309
1323
 
1324
+ /**
1325
+ * Full `McsConfig` + `McsOutcome`-aware MCS search.
1326
+ *
1327
+ * `smiles_json` — JSON array of at least 2 SMILES strings.
1328
+ * `config_json` — a JSON object with any subset of `McsConfig`'s fields
1329
+ * (camelCase keys, all optional, defaulting to `McsConfig::default()`):
1330
+ * `matchBonds`, `minAtoms`, `timeoutMs`, `ringMatchesRingOnly`,
1331
+ * `completeRingsOnly`, `atomCompare` (`"elements"` | `"any_heavy_atom"` |
1332
+ * `"any"`), `bondCompare` (`"order_or_aromatic"` | `"any"`),
1333
+ * `matchChiralTag`, `matchCharge`, `matchIsotope`, `maximizeBonds`.
1334
+ *
1335
+ * Returns a JSON object `{"smiles": string|null, "wasTimedOut": bool}` --
1336
+ * `smiles` is `null` when there is no common substructure; `wasTimedOut` is
1337
+ * `true` if `timeoutMs` was reached before the search finished exhaustively
1338
+ * (the returned `smiles`, if any, is then the best result found so far, not
1339
+ * proven optimal).
1340
+ */
1341
+ export function mcs_smiles_json_with_config(smiles_json: string, config_json: string): string;
1342
+
1310
1343
  /**
1311
1344
  * MCS with ring-awareness constraints.
1312
1345
  *
@@ -2566,6 +2599,7 @@ export interface InitOutput {
2566
2599
  readonly ecfp6_bitvec: (a: number) => [number, number];
2567
2600
  readonly ecfp6_bitvec_with_chirality: (a: number, b: number) => [number, number];
2568
2601
  readonly ecfp_bitvec_custom: (a: number, b: number, c: number, d: number) => [number, number];
2602
+ readonly embed_ensemble_v2_json: (a: number, b: number, c: number) => [number, number];
2569
2603
  readonly embed_pipeline_v2_json: (a: number, b: number, c: number) => [number, number];
2570
2604
  readonly enumerate_library_2way: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
2571
2605
  readonly enumerate_stereo_isomers_json: (a: number) => [number, number, number, number];
@@ -2612,6 +2646,7 @@ export interface InitOutput {
2612
2646
  readonly match_smarts_smiles: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2613
2647
  readonly maxmin_picks_ecfp4_json: (a: number, b: number, c: number) => [number, number, number, number];
2614
2648
  readonly mcs_smiles_json: (a: number, b: number) => [number, number, number, number];
2649
+ readonly mcs_smiles_json_with_config: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2615
2650
  readonly mcs_smiles_json_with_ring_config: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2616
2651
  readonly mhfp_hashes_json: (a: number) => [number, number];
2617
2652
  readonly mhfplshhandle_add_smiles: (a: number, b: number, c: number) => [number, number, number];
package/chematic_wasm.js CHANGED
@@ -1972,6 +1972,37 @@ export function ecfp_bitvec_custom(mol, radius, nbits, use_chirality) {
1972
1972
  return v1;
1973
1973
  }
1974
1974
 
1975
+ /**
1976
+ * Run `embed_ensemble_v2` on `mol`'s own atom order (never canonicalizes/
1977
+ * reparses, same convention as `embed_pipeline_v2_json`). See the module doc
1978
+ * for the config JSON shape and the success/failure envelope shape.
1979
+ *
1980
+ * Never throws. Always returns a JSON string tagged `schemaVersion: 1` and
1981
+ * `ok: true`/`false`. `ok: false` covers both a WASM-level rejection
1982
+ * (oversized input, too many atoms, malformed/incomplete config JSON) and a
1983
+ * config `embed_ensemble_v2` itself rejects (currently only an invalid
1984
+ * `rmsdThreshold`) -- distinguished by `error.stage` /
1985
+ * `error.cause.kind`, same as `embed_pipeline_v2_json`.
1986
+ * @param {MolHandle} mol
1987
+ * @param {string} config_json
1988
+ * @returns {string}
1989
+ */
1990
+ export function embed_ensemble_v2_json(mol, config_json) {
1991
+ let deferred2_0;
1992
+ let deferred2_1;
1993
+ try {
1994
+ _assertClass(mol, MolHandle);
1995
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1996
+ const len0 = WASM_VECTOR_LEN;
1997
+ const ret = wasm.embed_ensemble_v2_json(mol.__wbg_ptr, ptr0, len0);
1998
+ deferred2_0 = ret[0];
1999
+ deferred2_1 = ret[1];
2000
+ return getStringFromWasm0(ret[0], ret[1]);
2001
+ } finally {
2002
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2003
+ }
2004
+ }
2005
+
1975
2006
  /**
1976
2007
  * Run the opt-in v2 embedding pipeline, applied directly to `mol`'s own atom
1977
2008
  * order (never canonicalizes/reparses -- see the module doc).
@@ -3148,6 +3179,49 @@ export function mcs_smiles_json(smiles_json) {
3148
3179
  }
3149
3180
  }
3150
3181
 
3182
+ /**
3183
+ * Full `McsConfig` + `McsOutcome`-aware MCS search.
3184
+ *
3185
+ * `smiles_json` — JSON array of at least 2 SMILES strings.
3186
+ * `config_json` — a JSON object with any subset of `McsConfig`'s fields
3187
+ * (camelCase keys, all optional, defaulting to `McsConfig::default()`):
3188
+ * `matchBonds`, `minAtoms`, `timeoutMs`, `ringMatchesRingOnly`,
3189
+ * `completeRingsOnly`, `atomCompare` (`"elements"` | `"any_heavy_atom"` |
3190
+ * `"any"`), `bondCompare` (`"order_or_aromatic"` | `"any"`),
3191
+ * `matchChiralTag`, `matchCharge`, `matchIsotope`, `maximizeBonds`.
3192
+ *
3193
+ * Returns a JSON object `{"smiles": string|null, "wasTimedOut": bool}` --
3194
+ * `smiles` is `null` when there is no common substructure; `wasTimedOut` is
3195
+ * `true` if `timeoutMs` was reached before the search finished exhaustively
3196
+ * (the returned `smiles`, if any, is then the best result found so far, not
3197
+ * proven optimal).
3198
+ * @param {string} smiles_json
3199
+ * @param {string} config_json
3200
+ * @returns {string}
3201
+ */
3202
+ export function mcs_smiles_json_with_config(smiles_json, config_json) {
3203
+ let deferred4_0;
3204
+ let deferred4_1;
3205
+ try {
3206
+ const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3207
+ const len0 = WASM_VECTOR_LEN;
3208
+ const ptr1 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3209
+ const len1 = WASM_VECTOR_LEN;
3210
+ const ret = wasm.mcs_smiles_json_with_config(ptr0, len0, ptr1, len1);
3211
+ var ptr3 = ret[0];
3212
+ var len3 = ret[1];
3213
+ if (ret[3]) {
3214
+ ptr3 = 0; len3 = 0;
3215
+ throw takeFromExternrefTable0(ret[2]);
3216
+ }
3217
+ deferred4_0 = ptr3;
3218
+ deferred4_1 = len3;
3219
+ return getStringFromWasm0(ptr3, len3);
3220
+ } finally {
3221
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3222
+ }
3223
+ }
3224
+
3151
3225
  /**
3152
3226
  * MCS with ring-awareness constraints.
3153
3227
  *
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "kent-tokyo <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
8
- "version": "0.21.0",
8
+ "version": "0.23.0",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",