@kent-tokyo/chematic 0.8.0 → 0.8.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.
@@ -1612,6 +1612,32 @@ export function rdkit_ecfp_config_detail_json(mol: MolHandle, radius: number, nb
1612
1612
  */
1613
1613
  export function remove_hydrogens(mol: MolHandle): MolHandle;
1614
1614
 
1615
+ /**
1616
+ * Single-step retrosynthetic disconnection (issue #91).
1617
+ *
1618
+ * Thin wrapper around [`chematic_rxn::retro::retro_disconnect`] -- applies
1619
+ * the same built-in 60-template SMIRKS library and returns identical
1620
+ * disconnections (same templates, same precursor sets, same ordering:
1621
+ * fewest precursors first) as the Rust and Python (`Mol.retro_disconnect()`)
1622
+ * APIs. This function changes nothing about the underlying algorithm; it
1623
+ * only serializes the result to JSON.
1624
+ *
1625
+ * `max_results` -- cap on returned disconnections (0 = unlimited).
1626
+ *
1627
+ * `reaction_class` -- filter to a single reaction class, or `""` for all
1628
+ * classes. Valid values: `"AmideBond"`, `"Ester"`, `"Ether"`, `"CNBond"`,
1629
+ * `"CCBond"`, `"CSBond"`, `"Other"`. An unrecognized non-empty value is a
1630
+ * JS error (not silently ignored).
1631
+ *
1632
+ * JSON schema: array of
1633
+ * `{"template":str,"reaction_class":str,"precursors":[str,...],"sa_scores":[number,...],"max_sa_score":number}`
1634
+ * -- same field names as the Python binding's dict output. Returns `[]`
1635
+ * when no template matches the molecule (e.g. it has no disconnectable
1636
+ * bond the template library recognizes) -- a valid, non-error result,
1637
+ * distinct from the `reaction_class` validation error above.
1638
+ */
1639
+ export function retro_disconnect_json(mol: MolHandle, max_results: number, reaction_class: string): string;
1640
+
1615
1641
  /**
1616
1642
  * Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
1617
1643
  *
@@ -2217,6 +2243,7 @@ export interface InitOutput {
2217
2243
  readonly rdkit_ecfp_config_bitvec: (a: number, b: number, c: number) => [number, number, number, number];
2218
2244
  readonly rdkit_ecfp_config_detail_json: (a: number, b: number, c: number) => [number, number, number, number];
2219
2245
  readonly remove_hydrogens: (a: number) => number;
2246
+ readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2220
2247
  readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2221
2248
  readonly ring_families_json: (a: number) => [number, number, number, number];
2222
2249
  readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
package/chematic_wasm.js CHANGED
@@ -4058,6 +4058,56 @@ export function remove_hydrogens(mol) {
4058
4058
  return MolHandle.__wrap(ret);
4059
4059
  }
4060
4060
 
4061
+ /**
4062
+ * Single-step retrosynthetic disconnection (issue #91).
4063
+ *
4064
+ * Thin wrapper around [`chematic_rxn::retro::retro_disconnect`] -- applies
4065
+ * the same built-in 60-template SMIRKS library and returns identical
4066
+ * disconnections (same templates, same precursor sets, same ordering:
4067
+ * fewest precursors first) as the Rust and Python (`Mol.retro_disconnect()`)
4068
+ * APIs. This function changes nothing about the underlying algorithm; it
4069
+ * only serializes the result to JSON.
4070
+ *
4071
+ * `max_results` -- cap on returned disconnections (0 = unlimited).
4072
+ *
4073
+ * `reaction_class` -- filter to a single reaction class, or `""` for all
4074
+ * classes. Valid values: `"AmideBond"`, `"Ester"`, `"Ether"`, `"CNBond"`,
4075
+ * `"CCBond"`, `"CSBond"`, `"Other"`. An unrecognized non-empty value is a
4076
+ * JS error (not silently ignored).
4077
+ *
4078
+ * JSON schema: array of
4079
+ * `{"template":str,"reaction_class":str,"precursors":[str,...],"sa_scores":[number,...],"max_sa_score":number}`
4080
+ * -- same field names as the Python binding's dict output. Returns `[]`
4081
+ * when no template matches the molecule (e.g. it has no disconnectable
4082
+ * bond the template library recognizes) -- a valid, non-error result,
4083
+ * distinct from the `reaction_class` validation error above.
4084
+ * @param {MolHandle} mol
4085
+ * @param {number} max_results
4086
+ * @param {string} reaction_class
4087
+ * @returns {string}
4088
+ */
4089
+ export function retro_disconnect_json(mol, max_results, reaction_class) {
4090
+ let deferred3_0;
4091
+ let deferred3_1;
4092
+ try {
4093
+ _assertClass(mol, MolHandle);
4094
+ const ptr0 = passStringToWasm0(reaction_class, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4095
+ const len0 = WASM_VECTOR_LEN;
4096
+ const ret = wasm.retro_disconnect_json(mol.__wbg_ptr, max_results, ptr0, len0);
4097
+ var ptr2 = ret[0];
4098
+ var len2 = ret[1];
4099
+ if (ret[3]) {
4100
+ ptr2 = 0; len2 = 0;
4101
+ throw takeFromExternrefTable0(ret[2]);
4102
+ }
4103
+ deferred3_0 = ptr2;
4104
+ deferred3_1 = len2;
4105
+ return getStringFromWasm0(ptr2, len2);
4106
+ } finally {
4107
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
4108
+ }
4109
+ }
4110
+
4061
4111
  /**
4062
4112
  * Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
4063
4113
  *
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.8.0",
8
+ "version": "0.8.1",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",