@kent-tokyo/chematic 1.0.10 → 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.
- package/README.md +4 -2
- package/chematic_wasm.d.ts +67 -2
- package/chematic_wasm.js +180 -21
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ npm install @kent-tokyo/chematic
|
|
|
29
29
|
deterministic input indices and partial/complete status; bounded malformed
|
|
30
30
|
XYZ frames are grouped inline as rejected records when a later count-line
|
|
31
31
|
boundary is recoverable (core file-backed readers remain fail-stop)
|
|
32
|
+
- Bounded topology parsing for CML, ChemicalJSON (`mol_from_cjson`), MolJSON,
|
|
33
|
+
CDXML, MOL2, and PDB/mmCIF
|
|
32
34
|
- PDBx/mmCIF, PQR, QCSchema JSON, ORCA input/output, Gaussian Cube, OpenDX,
|
|
33
35
|
and LAMMPS data/dump I/O (JSON-based bindings; see `format_io.rs`)
|
|
34
36
|
- Topological descriptors: Wiener index, Hall-Kier κ, χ connectivity indices, Bertz CT
|
|
@@ -73,7 +75,7 @@ console.log(mol.qed()); // drug-likeness score [0, 1]
|
|
|
73
75
|
console.log(mol.exact_mass()); // ~180.042
|
|
74
76
|
console.log(mol.hbd_count()); // 1
|
|
75
77
|
console.log(mol.hba_count()); // 4
|
|
76
|
-
console.log(mol.rotatable_bond_count()); //
|
|
78
|
+
console.log(mol.rotatable_bond_count()); // 2 (RDKit Lipinski definition)
|
|
77
79
|
console.log(mol.aromatic_ring_count()); // 1
|
|
78
80
|
console.log(mol.lipinski_passes()); // true
|
|
79
81
|
console.log(mol.canonical_smiles()); // canonical SMILES string
|
|
@@ -167,7 +169,7 @@ and enforced correctly on all of them.
|
|
|
167
169
|
|
|
168
170
|
## Bundle Size
|
|
169
171
|
|
|
170
|
-
The optimized v1.0.
|
|
172
|
+
The optimized v1.0.10 candidate artifact was measured at **3.73 MB raw / 1.36 MB gzip**. Bundle size depends on features and toolchain; see [`benchmarks/2026-09-09-wasm-size-v1.0.10.md`](../../benchmarks/2026-09-09-wasm-size-v1.0.10.md) for exact tools, digest, and reproduction steps.
|
|
171
173
|
|
|
172
174
|
PNG rasterization (`tiny_skia`) is excluded from the WASM build — use SVG output instead. All SVG depiction APIs remain fully available.
|
|
173
175
|
|
package/chematic_wasm.d.ts
CHANGED
|
@@ -1603,6 +1603,15 @@ export function mol_block_stereo_diagnostics_json(mol_block: string): string;
|
|
|
1603
1603
|
*/
|
|
1604
1604
|
export function mol_from_cdxml(cdxml: string): MolHandle;
|
|
1605
1605
|
|
|
1606
|
+
/**
|
|
1607
|
+
* Parse a ChemicalJSON (CJSON) string into a `MolHandle`.
|
|
1608
|
+
*
|
|
1609
|
+
* Coordinates and CJSON-specific metadata are intentionally not retained by
|
|
1610
|
+
* this topology handle; use `convert_common_format` when a serialized CJSON
|
|
1611
|
+
* round trip is required.
|
|
1612
|
+
*/
|
|
1613
|
+
export function mol_from_cjson(json: string): MolHandle;
|
|
1614
|
+
|
|
1606
1615
|
/**
|
|
1607
1616
|
* Parse a CML string into a `MolHandle`.
|
|
1608
1617
|
*
|
|
@@ -1671,6 +1680,21 @@ export function mol_from_orca_input(text: string): MolHandle;
|
|
|
1671
1680
|
*/
|
|
1672
1681
|
export function mol_from_pdb(pdb: string): MolHandle;
|
|
1673
1682
|
|
|
1683
|
+
/**
|
|
1684
|
+
* Strict PDB parser. Unlike [`mol_from_pdb`], malformed ATOM/HETATM fields
|
|
1685
|
+
* return an error instead of producing a partially recovered molecule.
|
|
1686
|
+
*/
|
|
1687
|
+
export function mol_from_pdb_strict(pdb: string): MolHandle;
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Parse an AutoDock PDBQT block into a topology handle.
|
|
1691
|
+
*
|
|
1692
|
+
* Coordinates and partial charges are intentionally discarded, matching the
|
|
1693
|
+
* Python `from_pdbqt` binding; use the Rust parser when those arrays are
|
|
1694
|
+
* needed. Invalid records return a JS error instead of a partial molecule.
|
|
1695
|
+
*/
|
|
1696
|
+
export function mol_from_pdbqt(pdbqt: string): MolHandle;
|
|
1697
|
+
|
|
1674
1698
|
/**
|
|
1675
1699
|
* Parse a PQR file and return a `MolHandle` (topology only -- element
|
|
1676
1700
|
* list inferred per-atom, no bonds; PQR carries no connectivity). Use
|
|
@@ -2143,6 +2167,16 @@ export function rdkit_rdk_bitvec(mol: MolHandle): Uint8Array;
|
|
|
2143
2167
|
*/
|
|
2144
2168
|
export function rdkit_torsion_bitvec(mol: MolHandle): Uint8Array;
|
|
2145
2169
|
|
|
2170
|
+
/**
|
|
2171
|
+
* Check whether a reaction SMILES matches a reaction SMARTS query.
|
|
2172
|
+
*
|
|
2173
|
+
* The middle section of the query supports agent alternatives separated by
|
|
2174
|
+
* `|`. This source-level API remains bounded and returns a typed JS error for
|
|
2175
|
+
* invalid input; the generated Node artifact is updated separately when the
|
|
2176
|
+
* wasm-bindgen toolchain is available.
|
|
2177
|
+
*/
|
|
2178
|
+
export function reaction_smarts_match(smarts: string, reaction_smiles: string): boolean;
|
|
2179
|
+
|
|
2146
2180
|
/**
|
|
2147
2181
|
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
2148
2182
|
*/
|
|
@@ -2203,6 +2237,17 @@ export function rgroup_decompose_json(smiles_json: string, core_smarts: string):
|
|
|
2203
2237
|
*/
|
|
2204
2238
|
export function ring_families_json(mol: MolHandle): string;
|
|
2205
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
|
+
|
|
2206
2251
|
/**
|
|
2207
2252
|
* Apply a SMIRKS reaction template and return product SMILES as a JSON string.
|
|
2208
2253
|
*
|
|
@@ -2311,6 +2356,11 @@ export function semantic_apply_json_command(model_json: string, command_json: st
|
|
|
2311
2356
|
*/
|
|
2312
2357
|
export function semantic_expand_json(base_smiles: string, model_json: string): string;
|
|
2313
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
|
+
|
|
2314
2364
|
/**
|
|
2315
2365
|
* Validate and normalize a typed Markush/polymer semantic model JSON.
|
|
2316
2366
|
*/
|
|
@@ -2438,6 +2488,14 @@ export function start(): void;
|
|
|
2438
2488
|
*/
|
|
2439
2489
|
export function stereo_parent_json(mol: MolHandle): string;
|
|
2440
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
|
+
|
|
2441
2499
|
/**
|
|
2442
2500
|
* Compute the composed Super Parent with explicit resource limits.
|
|
2443
2501
|
*/
|
|
@@ -2876,6 +2934,7 @@ export interface InitOutput {
|
|
|
2876
2934
|
readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
|
|
2877
2935
|
readonly mol_block_stereo_diagnostics_json: (a: number, b: number) => [number, number, number, number];
|
|
2878
2936
|
readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
|
|
2937
|
+
readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
|
|
2879
2938
|
readonly mol_from_cml: (a: number, b: number) => [number, number, number];
|
|
2880
2939
|
readonly mol_from_cube: (a: number, b: number) => [number, number, number];
|
|
2881
2940
|
readonly mol_from_extxyz: (a: number, b: number) => [number, number, number];
|
|
@@ -2883,6 +2942,8 @@ export interface InitOutput {
|
|
|
2883
2942
|
readonly mol_from_moljson: (a: number, b: number) => [number, number, number];
|
|
2884
2943
|
readonly mol_from_orca_input: (a: number, b: number) => [number, number, number];
|
|
2885
2944
|
readonly mol_from_pdb: (a: number, b: number) => number;
|
|
2945
|
+
readonly mol_from_pdb_strict: (a: number, b: number) => [number, number, number];
|
|
2946
|
+
readonly mol_from_pdbqt: (a: number, b: number) => [number, number, number];
|
|
2886
2947
|
readonly mol_from_pqr: (a: number, b: number) => [number, number, number];
|
|
2887
2948
|
readonly mol_from_qcschema_molecule: (a: number, b: number) => [number, number, number];
|
|
2888
2949
|
readonly mol_from_sdf_block: (a: number, b: number) => [number, number, number];
|
|
@@ -2899,7 +2960,6 @@ export interface InitOutput {
|
|
|
2899
2960
|
readonly molecule_report_json: (a: number, b: number) => [number, number, number, number];
|
|
2900
2961
|
readonly molhandle_aromatic_ring_count: (a: number) => number;
|
|
2901
2962
|
readonly molhandle_assign_cip_json: (a: number) => [number, number];
|
|
2902
|
-
readonly molhandle_atom_count: (a: number) => number;
|
|
2903
2963
|
readonly molhandle_bbb_passes: (a: number) => number;
|
|
2904
2964
|
readonly molhandle_bbb_score: (a: number) => number;
|
|
2905
2965
|
readonly molhandle_bertz_ct: (a: number) => number;
|
|
@@ -3012,10 +3072,12 @@ export interface InitOutput {
|
|
|
3012
3072
|
readonly rdkit_path_bitvec: (a: number) => [number, number];
|
|
3013
3073
|
readonly rdkit_rdk_bitvec: (a: number) => [number, number];
|
|
3014
3074
|
readonly rdkit_torsion_bitvec: (a: number) => [number, number];
|
|
3075
|
+
readonly reaction_smarts_match: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
3015
3076
|
readonly remove_hydrogens: (a: number) => number;
|
|
3016
3077
|
readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
3017
3078
|
readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
3018
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];
|
|
3019
3081
|
readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
3020
3082
|
readonly rxn_document_from_rxn: (a: number, b: number) => [number, number, number, number];
|
|
3021
3083
|
readonly rxn_document_to_rxn: (a: number, b: number) => [number, number, number, number];
|
|
@@ -3027,6 +3089,7 @@ export interface InitOutput {
|
|
|
3027
3089
|
readonly sdf_to_smiles_json: (a: number, b: number) => [number, number];
|
|
3028
3090
|
readonly semantic_apply_json_command: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
3029
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];
|
|
3030
3093
|
readonly semantic_model_json: (a: number, b: number) => [number, number, number, number];
|
|
3031
3094
|
readonly set_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
3032
3095
|
readonly shape_descriptors_json: (a: number) => [number, number];
|
|
@@ -3041,8 +3104,8 @@ export interface InitOutput {
|
|
|
3041
3104
|
readonly sssr_rings_json: (a: number) => [number, number];
|
|
3042
3105
|
readonly standardize_smiles: (a: number, b: number) => [number, number];
|
|
3043
3106
|
readonly standardize_smiles_report_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
3044
|
-
readonly start: () => void;
|
|
3045
3107
|
readonly stereo_parent_json: (a: number) => [number, number];
|
|
3108
|
+
readonly stoichiometry_report_json: (a: number, b: number) => [number, number];
|
|
3046
3109
|
readonly super_parent_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
|
|
3047
3110
|
readonly super_parent_report_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
|
|
3048
3111
|
readonly tanimoto_atom_pair: (a: number, b: number) => number;
|
|
@@ -3083,6 +3146,8 @@ export interface InitOutput {
|
|
|
3083
3146
|
readonly xlogp3_json: (a: number) => [number, number];
|
|
3084
3147
|
readonly xlogp3_per_atom_json: (a: number) => [number, number];
|
|
3085
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;
|
|
3086
3151
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
3087
3152
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
3088
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;
|
|
@@ -3970,6 +3970,25 @@ export function mol_from_cdxml(cdxml) {
|
|
|
3970
3970
|
return MolHandle.__wrap(ret[0]);
|
|
3971
3971
|
}
|
|
3972
3972
|
|
|
3973
|
+
/**
|
|
3974
|
+
* Parse a ChemicalJSON (CJSON) string into a `MolHandle`.
|
|
3975
|
+
*
|
|
3976
|
+
* Coordinates and CJSON-specific metadata are intentionally not retained by
|
|
3977
|
+
* this topology handle; use `convert_common_format` when a serialized CJSON
|
|
3978
|
+
* round trip is required.
|
|
3979
|
+
* @param {string} json
|
|
3980
|
+
* @returns {MolHandle}
|
|
3981
|
+
*/
|
|
3982
|
+
export function mol_from_cjson(json) {
|
|
3983
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3984
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3985
|
+
const ret = wasm.mol_from_cjson(ptr0, len0);
|
|
3986
|
+
if (ret[2]) {
|
|
3987
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3988
|
+
}
|
|
3989
|
+
return MolHandle.__wrap(ret[0]);
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3973
3992
|
/**
|
|
3974
3993
|
* Parse a CML string into a `MolHandle`.
|
|
3975
3994
|
*
|
|
@@ -4105,6 +4124,41 @@ export function mol_from_pdb(pdb) {
|
|
|
4105
4124
|
return MolHandle.__wrap(ret);
|
|
4106
4125
|
}
|
|
4107
4126
|
|
|
4127
|
+
/**
|
|
4128
|
+
* Strict PDB parser. Unlike [`mol_from_pdb`], malformed ATOM/HETATM fields
|
|
4129
|
+
* return an error instead of producing a partially recovered molecule.
|
|
4130
|
+
* @param {string} pdb
|
|
4131
|
+
* @returns {MolHandle}
|
|
4132
|
+
*/
|
|
4133
|
+
export function mol_from_pdb_strict(pdb) {
|
|
4134
|
+
const ptr0 = passStringToWasm0(pdb, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4135
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4136
|
+
const ret = wasm.mol_from_pdb_strict(ptr0, len0);
|
|
4137
|
+
if (ret[2]) {
|
|
4138
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4139
|
+
}
|
|
4140
|
+
return MolHandle.__wrap(ret[0]);
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
/**
|
|
4144
|
+
* Parse an AutoDock PDBQT block into a topology handle.
|
|
4145
|
+
*
|
|
4146
|
+
* Coordinates and partial charges are intentionally discarded, matching the
|
|
4147
|
+
* Python `from_pdbqt` binding; use the Rust parser when those arrays are
|
|
4148
|
+
* needed. Invalid records return a JS error instead of a partial molecule.
|
|
4149
|
+
* @param {string} pdbqt
|
|
4150
|
+
* @returns {MolHandle}
|
|
4151
|
+
*/
|
|
4152
|
+
export function mol_from_pdbqt(pdbqt) {
|
|
4153
|
+
const ptr0 = passStringToWasm0(pdbqt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4154
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4155
|
+
const ret = wasm.mol_from_pdbqt(ptr0, len0);
|
|
4156
|
+
if (ret[2]) {
|
|
4157
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4158
|
+
}
|
|
4159
|
+
return MolHandle.__wrap(ret[0]);
|
|
4160
|
+
}
|
|
4161
|
+
|
|
4108
4162
|
/**
|
|
4109
4163
|
* Parse a PQR file and return a `MolHandle` (topology only -- element
|
|
4110
4164
|
* list inferred per-atom, no bonds; PQR carries no connectivity). Use
|
|
@@ -5001,7 +5055,7 @@ export function pqr_infer_element(group_pdb, res_name, atom_name) {
|
|
|
5001
5055
|
const ret = wasm.pqr_infer_element(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
5002
5056
|
let v4;
|
|
5003
5057
|
if (ret[0] !== 0) {
|
|
5004
|
-
v4 = getStringFromWasm0(ret[0], ret[1]);
|
|
5058
|
+
v4 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
5005
5059
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
5006
5060
|
}
|
|
5007
5061
|
return v4;
|
|
@@ -5424,6 +5478,29 @@ export function rdkit_torsion_bitvec(mol) {
|
|
|
5424
5478
|
return v1;
|
|
5425
5479
|
}
|
|
5426
5480
|
|
|
5481
|
+
/**
|
|
5482
|
+
* Check whether a reaction SMILES matches a reaction SMARTS query.
|
|
5483
|
+
*
|
|
5484
|
+
* The middle section of the query supports agent alternatives separated by
|
|
5485
|
+
* `|`. This source-level API remains bounded and returns a typed JS error for
|
|
5486
|
+
* invalid input; the generated Node artifact is updated separately when the
|
|
5487
|
+
* wasm-bindgen toolchain is available.
|
|
5488
|
+
* @param {string} smarts
|
|
5489
|
+
* @param {string} reaction_smiles
|
|
5490
|
+
* @returns {boolean}
|
|
5491
|
+
*/
|
|
5492
|
+
export function reaction_smarts_match(smarts, reaction_smiles) {
|
|
5493
|
+
const ptr0 = passStringToWasm0(smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5494
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5495
|
+
const ptr1 = passStringToWasm0(reaction_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5496
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5497
|
+
const ret = wasm.reaction_smarts_match(ptr0, len0, ptr1, len1);
|
|
5498
|
+
if (ret[2]) {
|
|
5499
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5500
|
+
}
|
|
5501
|
+
return ret[0] !== 0;
|
|
5502
|
+
}
|
|
5503
|
+
|
|
5427
5504
|
/**
|
|
5428
5505
|
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
5429
5506
|
* @param {MolHandle} mol
|
|
@@ -5558,6 +5635,38 @@ export function ring_families_json(mol) {
|
|
|
5558
5635
|
}
|
|
5559
5636
|
}
|
|
5560
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
|
+
|
|
5561
5670
|
/**
|
|
5562
5671
|
* Apply a SMIRKS reaction template and return product SMILES as a JSON string.
|
|
5563
5672
|
*
|
|
@@ -5884,6 +5993,37 @@ export function semantic_expand_json(base_smiles, model_json) {
|
|
|
5884
5993
|
}
|
|
5885
5994
|
}
|
|
5886
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
|
+
|
|
5887
6027
|
/**
|
|
5888
6028
|
* Validate and normalize a typed Markush/polymer semantic model JSON.
|
|
5889
6029
|
* @param {string} model_json
|
|
@@ -6301,6 +6441,29 @@ export function stereo_parent_json(mol) {
|
|
|
6301
6441
|
}
|
|
6302
6442
|
}
|
|
6303
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
|
+
|
|
6304
6467
|
/**
|
|
6305
6468
|
* Compute the composed Super Parent with explicit resource limits.
|
|
6306
6469
|
* @param {MolHandle} mol
|
|
@@ -7212,11 +7375,11 @@ export function xyz_frames_batch_json(text, offset, batch_size) {
|
|
|
7212
7375
|
function __wbg_get_imports() {
|
|
7213
7376
|
const import0 = {
|
|
7214
7377
|
__proto__: null,
|
|
7215
|
-
|
|
7378
|
+
__wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
|
|
7216
7379
|
const ret = arg0 === undefined;
|
|
7217
7380
|
return ret;
|
|
7218
7381
|
},
|
|
7219
|
-
|
|
7382
|
+
__wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
|
|
7220
7383
|
const obj = arg1;
|
|
7221
7384
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
7222
7385
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -7224,17 +7387,17 @@ function __wbg_get_imports() {
|
|
|
7224
7387
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
7225
7388
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
7226
7389
|
},
|
|
7227
|
-
|
|
7390
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
7228
7391
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
7229
7392
|
},
|
|
7230
|
-
|
|
7393
|
+
__wbg_error_f085d7e62279b703: function(arg0) {
|
|
7231
7394
|
console.error(arg0);
|
|
7232
7395
|
},
|
|
7233
|
-
|
|
7396
|
+
__wbg_new_from_slice_02962bf7778cf945: function(arg0, arg1) {
|
|
7234
7397
|
const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
|
|
7235
7398
|
return ret;
|
|
7236
7399
|
},
|
|
7237
|
-
|
|
7400
|
+
__wbg_new_from_slice_f92bf65e9a895613: function(arg0, arg1) {
|
|
7238
7401
|
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
7239
7402
|
return ret;
|
|
7240
7403
|
},
|
|
@@ -7246,28 +7409,28 @@ function __wbg_get_imports() {
|
|
|
7246
7409
|
const ret = arg0.performance;
|
|
7247
7410
|
return ret;
|
|
7248
7411
|
},
|
|
7249
|
-
|
|
7250
|
-
const ret = typeof
|
|
7412
|
+
__wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
|
|
7413
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
7251
7414
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
7252
7415
|
},
|
|
7253
|
-
|
|
7254
|
-
const ret = typeof
|
|
7416
|
+
__wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
|
|
7417
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
7255
7418
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
7256
7419
|
},
|
|
7257
|
-
|
|
7420
|
+
__wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
|
|
7258
7421
|
const ret = typeof self === 'undefined' ? null : self;
|
|
7259
7422
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
7260
7423
|
},
|
|
7261
|
-
|
|
7424
|
+
__wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
|
|
7262
7425
|
const ret = typeof window === 'undefined' ? null : window;
|
|
7263
7426
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
7264
7427
|
},
|
|
7265
|
-
|
|
7428
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
7266
7429
|
// Cast intrinsic for `F64 -> Externref`.
|
|
7267
7430
|
const ret = arg0;
|
|
7268
7431
|
return ret;
|
|
7269
7432
|
},
|
|
7270
|
-
|
|
7433
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
7271
7434
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
7272
7435
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
7273
7436
|
return ret;
|
|
@@ -7462,15 +7625,11 @@ function __wbg_finalize_init(instance, module) {
|
|
|
7462
7625
|
|
|
7463
7626
|
async function __wbg_load(module, imports) {
|
|
7464
7627
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
7465
|
-
if (!module.ok) {
|
|
7466
|
-
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
7467
|
-
}
|
|
7468
|
-
|
|
7469
7628
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
7470
7629
|
try {
|
|
7471
7630
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
7472
7631
|
} catch (e) {
|
|
7473
|
-
const validResponse = expectedResponseType(module.type);
|
|
7632
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
7474
7633
|
|
|
7475
7634
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
7476
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);
|
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.12",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|