@kent-tokyo/chematic 1.1.5 → 1.1.6

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 CHANGED
@@ -4,7 +4,7 @@ WebAssembly bindings for [chematic](https://github.com/kent-tokyo/chematic), a p
4
4
 
5
5
  Published to npm as [`@kent-tokyo/chematic`](https://www.npmjs.com/package/@kent-tokyo/chematic).
6
6
 
7
- The current workspace line is 1.1.5. The binding keeps bounded parsing,
7
+ The current workspace line is 1.1.6. The binding keeps bounded parsing,
8
8
  typed failures, and opt-in `embed_pipeline_v2_json`; 3D/MMFF94 behavior remains
9
9
  Experimental and is not a claim of full RDKit parity.
10
10
 
@@ -566,6 +566,11 @@ export class MolHandle {
566
566
  * Number of rotatable bonds.
567
567
  */
568
568
  rotatable_bond_count(): number;
569
+ /**
570
+ * Checked rooted SMILES as {smiles, atom_order}; order maps parsed to original indices.
571
+ * Limited to 256 atoms and verified ordinary tetrahedral frames; see the Rust API.
572
+ */
573
+ smiles_rooted_checked_json(rooted_at_atom: number): string;
569
574
  /**
570
575
  * Sum of EState indices over all heavy atoms.
571
576
  */
@@ -712,6 +717,24 @@ export class SmilesBatchStreamHandle {
712
717
  stop_json(terminal_reason: string): string;
713
718
  }
714
719
 
720
+ /**
721
+ * One proof result. The witness maps original atoms to a copy with only the
722
+ * selected tetrahedral declaration inverted; it fixes that selected atom.
723
+ */
724
+ export class TetrahedralCleanupResult {
725
+ private constructor();
726
+ free(): void;
727
+ [Symbol.dispose](): void;
728
+ report_json(): string;
729
+ readonly atom_index: number;
730
+ /**
731
+ * Independent molecule; all source labels and other configurations remain.
732
+ */
733
+ readonly molecule: MolHandle;
734
+ readonly removed: boolean;
735
+ readonly search_visits: number;
736
+ }
737
+
715
738
  /**
716
739
  * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
717
740
  */
@@ -907,6 +930,12 @@ export function cdxml_document_projection_json_v1(cdxml: string): string;
907
930
  */
908
931
  export function cdxml_to_smiles_json(cdxml: string): string;
909
932
 
933
+ /**
934
+ * Read all CDXML fragments with optional Bold/Hash/Dash stereo inference.
935
+ * Retains the existing input/atom/fragment limits and JSON result shape.
936
+ */
937
+ export function cdxml_to_smiles_json_with_options(cdxml: string, infer_nondirectional_stereo: boolean): string;
938
+
910
939
  /**
911
940
  * Compute the charge Parent and return a status-shaped JSON result.
912
941
  */
@@ -921,6 +950,12 @@ export function charge_parent_json(mol: MolHandle): string;
921
950
  */
922
951
  export function chematic_version(): string;
923
952
 
953
+ /**
954
+ * Exact source bytes, projected XML, fragment coordinates and CDX omission tags.
955
+ * CDXML uses the existing graph projection; omissions lists CDX tags only.
956
+ */
957
+ export function chemdraw_block_report_json(data: Uint8Array, format: string, allow_metadata_loss: boolean): string;
958
+
924
959
  /**
925
960
  * CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
926
961
  * array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
@@ -1439,7 +1474,9 @@ export function generic_murcko_scaffold(mol: MolHandle): MolHandle;
1439
1474
  *
1440
1475
  * Fields: `element` (symbol), `hybridization` ("sp"/"sp2"/"sp3"),
1441
1476
  * `charge` (formal charge integer), `isAromatic` (bool),
1442
- * `totalHydrogens` (explicit + implicit H count, integer).
1477
+ * `totalHydrogens` (attached H: bracket/inferred plus explicit H neighbors).
1478
+ * This excludes the atom itself when it is H; use `num_hydrogens` for the
1479
+ * molecule's total. Isotopic H neighbors count as hydrogen.
1443
1480
  * sp3d/sp3d2 (hypervalent P/S) are not distinguished from sp3/sp2.
1444
1481
  */
1445
1482
  export function get_atom_info(mol: MolHandle, idx: number): string;
@@ -1601,6 +1638,12 @@ export function is_valid_smiles(s: string): boolean;
1601
1638
  */
1602
1639
  export function isotope_parent_json(mol: MolHandle): string;
1603
1640
 
1641
+ /**
1642
+ * Replace only ar bond tokens in a bounded neutral aromatic MOL2 record.
1643
+ * Retains atom types and every other source byte; errors throw, no partial text.
1644
+ */
1645
+ export function kekulize_mol2_record(text: string): string;
1646
+
1604
1647
  /**
1605
1648
  * Per-atom Labute approximate surface area contributions as a JSON array of f64.
1606
1649
  *
@@ -2010,6 +2053,13 @@ export function mol_from_ccd(text: string, allow_stereo_loss: boolean): MolHandl
2010
2053
  */
2011
2054
  export function mol_from_cdxml(cdxml: string): MolHandle;
2012
2055
 
2056
+ /**
2057
+ * Read the first CDXML fragment, optionally inferring Bold/Hash/Dash stereo.
2058
+ * Non-directional displays are heuristic: ambiguous or degenerate drawings
2059
+ * remain unassigned. `false` has the same behavior as `mol_from_cdxml`.
2060
+ */
2061
+ export function mol_from_cdxml_with_options(cdxml: string, infer_nondirectional_stereo: boolean): MolHandle;
2062
+
2013
2063
  /**
2014
2064
  * Parse a ChemicalJSON (CJSON) string into a `MolHandle`.
2015
2065
  *
@@ -2095,6 +2145,12 @@ export function mol_from_orca_input(text: string): MolHandle;
2095
2145
  */
2096
2146
  export function mol_from_pdb(pdb: string): MolHandle;
2097
2147
 
2148
+ /**
2149
+ * Explicit CONECT graph, without distance-based bonding. Only unmodelled,
2150
+ * single-location atoms with explicit element fields are accepted.
2151
+ */
2152
+ export function mol_from_pdb_conect(input: string, allow_extended_targets: boolean): MolHandle;
2153
+
2098
2154
  /**
2099
2155
  * Strict PDB parser. Unlike [`mol_from_pdb`], malformed ATOM/HETATM fields
2100
2156
  * return an error instead of producing a partially recovered molecule.
@@ -2225,6 +2281,11 @@ export function mol_with_bond_removed(mol: MolHandle, idx: number): MolHandle;
2225
2281
  */
2226
2282
  export function molecule_report_json(smiles: string): string;
2227
2283
 
2284
+ /**
2285
+ * Concrete CDX/CDXML fragment handles, in source fragment order.
2286
+ */
2287
+ export function mols_from_chemdraw_block(data: Uint8Array, format: string, allow_metadata_loss: boolean): MolHandle[];
2288
+
2228
2289
  /**
2229
2290
  * MQN descriptor (42 integer values: Molecular Quantum Numbers).
2230
2291
  */
@@ -2286,6 +2347,12 @@ export function nucleic_acid_apply_json_command(document_json: string, command_j
2286
2347
  */
2287
2348
  export function nucleic_acid_validate_json(document_json: string): string;
2288
2349
 
2350
+ /**
2351
+ * Total hydrogen nuclei: explicit nodes plus attached bracket/inferred H.
2352
+ * Isotopic, charged, bridging and disconnected H nodes each count once.
2353
+ */
2354
+ export function num_hydrogens(mol: MolHandle): number;
2355
+
2289
2356
  /**
2290
2357
  * Parse an OpenDX (APBS scalar-field subset) file and return its full
2291
2358
  * [`chematic_mol::VolumetricGrid`] as JSON (same shape as
@@ -2390,6 +2457,12 @@ export function parse_mol2_record_json(text: string): string;
2390
2457
  */
2391
2458
  export function parse_smiles(s: string): MolHandle;
2392
2459
 
2460
+ /**
2461
+ * Indexed atoms/charges, bonds, coordinates and source serials for the same
2462
+ * explicit CONECT projection. Molecular identity and coordinate order agree.
2463
+ */
2464
+ export function pdb_conect_frame_json(input: string, allow_extended_targets: boolean): string;
2465
+
2393
2466
  /**
2394
2467
  * Extract the atomic coordinates from a PDB block, in the SAME atom order
2395
2468
  * `mol_from_pdb` returns topology for (both read the identical underlying
@@ -2721,6 +2794,13 @@ export function reaction_smarts_match(smarts: string, reaction_smiles: string):
2721
2794
  */
2722
2795
  export function remove_hydrogens(mol: MolHandle): MolHandle;
2723
2796
 
2797
+ /**
2798
+ * Opt-in exact tetrahedral cleanup. Both index and budget must be JS numbers
2799
+ * containing integers (bool/string/null are rejected). The kernel caps inputs
2800
+ * at 64 atoms/128 bonds and max_visits at 10000000. Errors throw without a result.
2801
+ */
2802
+ export function remove_redundant_tetrahedral_stereo(mol: MolHandle, atom_index: any, max_visits: any): TetrahedralCleanupResult;
2803
+
2724
2804
  /**
2725
2805
  * Single-step retrosynthetic disconnection (issue #91).
2726
2806
  *
@@ -3038,9 +3118,11 @@ export function smiles_array_to_sdf(smiles_json: string): string;
3038
3118
  /**
3039
3119
  * Convert a SMILES to a minimal Tripos MOL2 string (no 3D coordinates).
3040
3120
  *
3041
- * Returns `"error:<msg>"` on parse failure.
3121
+ * Optional `atom_bond_adjacent=true` emits ATOM → BOND → UNITY. Some
3122
+ * readers (including Open Babel 3.2.1) ignore UNITY charges in this order.
3123
+ * Omit it to retain existing bytes. Returns `"error:<msg>"` on parse failure.
3042
3124
  */
3043
- export function smiles_to_mol2(smiles: string): string;
3125
+ export function smiles_to_mol2(smiles: string, atom_bond_adjacent?: boolean | null): string;
3044
3126
 
3045
3127
  /**
3046
3128
  * Write a molecule to AutoDock PDBQT format.
@@ -3053,6 +3135,15 @@ export function smiles_to_mol2(smiles: string): string;
3053
3135
  */
3054
3136
  export function smiles_to_pdbqt(smiles: string, coords_json: string, charges_json: string, name: string): string;
3055
3137
 
3138
+ /**
3139
+ * Write rigid PDBQT or throw for malformed/unrepresentable input. Coordinates
3140
+ * are JSON [x,y,z] arrays in Å; charges are JSON numbers in e. Both arrays must
3141
+ * contain exactly one value per graph atom, including explicit H. No defaults,
3142
+ * charge calculation, atom removal or ligand torsion preparation are applied.
3143
+ * AutoDock types retain the legacy heuristic, with unknown `X` types rejected.
3144
+ */
3145
+ export function smiles_to_pdbqt_checked(smiles: string, coords_json: string, charges_json: string, name: string): string;
3146
+
3056
3147
  /**
3057
3148
  * Render a highlighted SVG from a SMILES string in one call.
3058
3149
  *
@@ -3441,6 +3532,7 @@ export interface InitOutput {
3441
3532
  readonly __wbg_rdkitreadresult_free: (a: number, b: number) => void;
3442
3533
  readonly __wbg_rdkitsearchindex_free: (a: number, b: number) => void;
3443
3534
  readonly __wbg_smilesbatchstreamhandle_free: (a: number, b: number) => void;
3535
+ readonly __wbg_tetrahedralcleanupresult_free: (a: number, b: number) => void;
3444
3536
  readonly add_hydrogens: (a: number) => number;
3445
3537
  readonly admet_profile_json: (a: number, b: number) => [number, number];
3446
3538
  readonly atom_pair_bitvec: (a: number) => [number, number];
@@ -3463,8 +3555,10 @@ export interface InitOutput {
3463
3555
  readonly cdxml_document_json_v1: (a: number, b: number) => [number, number, number, number];
3464
3556
  readonly cdxml_document_projection_json_v1: (a: number, b: number) => [number, number, number, number];
3465
3557
  readonly cdxml_to_smiles_json: (a: number, b: number) => [number, number, number, number];
3558
+ readonly cdxml_to_smiles_json_with_options: (a: number, b: number, c: number) => [number, number, number, number];
3466
3559
  readonly charge_parent_json: (a: number) => [number, number];
3467
3560
  readonly chematic_version: () => [number, number];
3561
+ readonly chemdraw_block_report_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3468
3562
  readonly cip_assignments_accurate_json: (a: number) => [number, number];
3469
3563
  readonly cip_assignments_json: (a: number) => [number, number];
3470
3564
  readonly cip_unresolved_json: (a: number) => [number, number];
@@ -3562,6 +3656,7 @@ export interface InitOutput {
3562
3656
  readonly invert_stereocenter_at: (a: number, b: number) => [number, number, number];
3563
3657
  readonly is_valid_smiles: (a: number, b: number) => number;
3564
3658
  readonly isotope_parent_json: (a: number) => [number, number];
3659
+ readonly kekulize_mol2_record: (a: number, b: number) => [number, number, number, number];
3565
3660
  readonly labute_asa_per_atom_json: (a: number) => [number, number];
3566
3661
  readonly lammps_data_to_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3567
3662
  readonly lammps_dump_cartesian_positions_f64: (a: number, b: number) => [number, number, number];
@@ -3604,6 +3699,7 @@ export interface InitOutput {
3604
3699
  readonly mol_block_stereo_loss_json: (a: number) => [number, number];
3605
3700
  readonly mol_from_ccd: (a: number, b: number, c: number) => [number, number, number];
3606
3701
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
3702
+ readonly mol_from_cdxml_with_options: (a: number, b: number, c: number) => [number, number, number];
3607
3703
  readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
3608
3704
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
3609
3705
  readonly mol_from_cml_strict: (a: number, b: number) => [number, number, number];
@@ -3613,6 +3709,7 @@ export interface InitOutput {
3613
3709
  readonly mol_from_moljson: (a: number, b: number) => [number, number, number];
3614
3710
  readonly mol_from_orca_input: (a: number, b: number) => [number, number, number];
3615
3711
  readonly mol_from_pdb: (a: number, b: number) => number;
3712
+ readonly mol_from_pdb_conect: (a: number, b: number, c: number) => [number, number, number];
3616
3713
  readonly mol_from_pdb_strict: (a: number, b: number) => [number, number, number];
3617
3714
  readonly mol_from_pdbqt: (a: number, b: number) => [number, number, number];
3618
3715
  readonly mol_from_pqr: (a: number, b: number) => [number, number, number];
@@ -3722,6 +3819,7 @@ export interface InitOutput {
3722
3819
  readonly molhandle_reos_passes: (a: number) => number;
3723
3820
  readonly molhandle_ring_count: (a: number) => number;
3724
3821
  readonly molhandle_rotatable_bond_count: (a: number) => number;
3822
+ readonly molhandle_smiles_rooted_checked_json: (a: number, b: number) => [number, number, number, number];
3725
3823
  readonly molhandle_sum_estate: (a: number) => number;
3726
3824
  readonly molhandle_to_inchi: (a: number) => [number, number];
3727
3825
  readonly molhandle_to_inchikey: (a: number) => [number, number];
@@ -3729,6 +3827,7 @@ export interface InitOutput {
3729
3827
  readonly molhandle_veber_passes: (a: number) => number;
3730
3828
  readonly molhandle_wiener_index: (a: number) => number;
3731
3829
  readonly molhandle_zagreb_index_m1: (a: number) => number;
3830
+ readonly mols_from_chemdraw_block: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3732
3831
  readonly mqn_json: (a: number) => [number, number];
3733
3832
  readonly mr_per_atom_json: (a: number) => [number, number];
3734
3833
  readonly murcko_scaffold: (a: number) => number;
@@ -3738,6 +3837,7 @@ export interface InitOutput {
3738
3837
  readonly normalize_reaction_smiles: (a: number, b: number) => [number, number, number, number];
3739
3838
  readonly nucleic_acid_apply_json_command: (a: number, b: number, c: number, d: number) => [number, number];
3740
3839
  readonly nucleic_acid_validate_json: (a: number, b: number) => [number, number];
3840
+ readonly num_hydrogens: (a: number) => number;
3741
3841
  readonly opendx_grid_json: (a: number, b: number) => [number, number, number, number];
3742
3842
  readonly opendx_shape_u32: (a: number, b: number) => [number, number, number];
3743
3843
  readonly opendx_values_f64: (a: number, b: number) => [number, number, number];
@@ -3752,6 +3852,7 @@ export interface InitOutput {
3752
3852
  readonly parse_hin_record_json: (a: number, b: number) => [number, number, number, number];
3753
3853
  readonly parse_mol2_record_json: (a: number, b: number) => [number, number, number, number];
3754
3854
  readonly parse_smiles: (a: number, b: number) => [number, number, number];
3855
+ readonly pdb_conect_frame_json: (a: number, b: number, c: number) => [number, number, number, number];
3755
3856
  readonly pdb_coords_json: (a: number, b: number) => [number, number];
3756
3857
  readonly peoe_vsa_json: (a: number) => [number, number];
3757
3858
  readonly periodic_structure_fingerprint_json: (a: number, b: number, c: number, d: number) => [number, number];
@@ -3801,6 +3902,7 @@ export interface InitOutput {
3801
3902
  readonly reaction_document_to_rxn_v1: (a: number, b: number) => [number, number, number, number];
3802
3903
  readonly reaction_smarts_match: (a: number, b: number, c: number, d: number) => [number, number, number];
3803
3904
  readonly remove_hydrogens: (a: number) => number;
3905
+ readonly remove_redundant_tetrahedral_stereo: (a: number, b: any, c: any) => [number, number, number];
3804
3906
  readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3805
3907
  readonly rgroup_decompose_columns_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3806
3908
  readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
@@ -3832,8 +3934,9 @@ export interface InitOutput {
3832
3934
  readonly smarts_match_atoms: (a: number, b: number, c: number) => [number, number, number, number];
3833
3935
  readonly smarts_match_atoms_with_chirality: (a: number, b: number, c: number, d: number) => [number, number, number, number];
3834
3936
  readonly smiles_array_to_sdf: (a: number, b: number) => [number, number, number, number];
3835
- readonly smiles_to_mol2: (a: number, b: number) => [number, number];
3937
+ readonly smiles_to_mol2: (a: number, b: number, c: number) => [number, number];
3836
3938
  readonly smiles_to_pdbqt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
3939
+ readonly smiles_to_pdbqt_checked: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
3837
3940
  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];
3838
3941
  readonly smilesbatchstreamhandle_finish_json: (a: number) => [number, number, number, number];
3839
3942
  readonly smilesbatchstreamhandle_new: () => number;
@@ -3861,6 +3964,11 @@ export interface InitOutput {
3861
3964
  readonly tanimoto_topo_path: (a: number, b: number) => number;
3862
3965
  readonly tanimoto_torsion: (a: number, b: number) => number;
3863
3966
  readonly tautomer_parent_json: (a: number, b: number, c: number, d: number, e: bigint) => [number, number];
3967
+ readonly tetrahedralcleanupresult_atom_index: (a: number) => number;
3968
+ readonly tetrahedralcleanupresult_molecule: (a: number) => number;
3969
+ readonly tetrahedralcleanupresult_removed: (a: number) => number;
3970
+ readonly tetrahedralcleanupresult_report_json: (a: number) => [number, number];
3971
+ readonly tetrahedralcleanupresult_search_visits: (a: number) => number;
3864
3972
  readonly to_cml: (a: number) => [number, number];
3865
3973
  readonly to_extxyz_json: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
3866
3974
  readonly to_mol_block: (a: number) => [number, number];
@@ -3897,6 +4005,7 @@ export interface InitOutput {
3897
4005
  readonly __wbindgen_externrefs: WebAssembly.Table;
3898
4006
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
3899
4007
  readonly __externref_table_dealloc: (a: number) => void;
4008
+ readonly __externref_drop_slice: (a: number, b: number) => void;
3900
4009
  readonly __wbindgen_start: () => void;
3901
4010
  }
3902
4011
 
package/chematic_wasm.js CHANGED
@@ -1642,6 +1642,30 @@ export class MolHandle {
1642
1642
  const ret = wasm.molhandle_rotatable_bond_count(this.__wbg_ptr);
1643
1643
  return ret >>> 0;
1644
1644
  }
1645
+ /**
1646
+ * Checked rooted SMILES as {smiles, atom_order}; order maps parsed to original indices.
1647
+ * Limited to 256 atoms and verified ordinary tetrahedral frames; see the Rust API.
1648
+ * @param {number} rooted_at_atom
1649
+ * @returns {string}
1650
+ */
1651
+ smiles_rooted_checked_json(rooted_at_atom) {
1652
+ let deferred2_0;
1653
+ let deferred2_1;
1654
+ try {
1655
+ const ret = wasm.molhandle_smiles_rooted_checked_json(this.__wbg_ptr, rooted_at_atom);
1656
+ var ptr1 = ret[0];
1657
+ var len1 = ret[1];
1658
+ if (ret[3]) {
1659
+ ptr1 = 0; len1 = 0;
1660
+ throw takeFromExternrefTable0(ret[2]);
1661
+ }
1662
+ deferred2_0 = ptr1;
1663
+ deferred2_1 = len1;
1664
+ return getStringFromWasm0(ptr1, len1);
1665
+ } finally {
1666
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1667
+ }
1668
+ }
1645
1669
  /**
1646
1670
  * Sum of EState indices over all heavy atoms.
1647
1671
  * @returns {number}
@@ -2059,6 +2083,74 @@ export class SmilesBatchStreamHandle {
2059
2083
  }
2060
2084
  if (Symbol.dispose) SmilesBatchStreamHandle.prototype[Symbol.dispose] = SmilesBatchStreamHandle.prototype.free;
2061
2085
 
2086
+ /**
2087
+ * One proof result. The witness maps original atoms to a copy with only the
2088
+ * selected tetrahedral declaration inverted; it fixes that selected atom.
2089
+ */
2090
+ export class TetrahedralCleanupResult {
2091
+ static __wrap(ptr) {
2092
+ const obj = Object.create(TetrahedralCleanupResult.prototype);
2093
+ obj.__wbg_ptr = ptr;
2094
+ TetrahedralCleanupResultFinalization.register(obj, obj.__wbg_ptr, obj);
2095
+ return obj;
2096
+ }
2097
+ __destroy_into_raw() {
2098
+ const ptr = this.__wbg_ptr;
2099
+ this.__wbg_ptr = 0;
2100
+ TetrahedralCleanupResultFinalization.unregister(this);
2101
+ return ptr;
2102
+ }
2103
+ free() {
2104
+ const ptr = this.__destroy_into_raw();
2105
+ wasm.__wbg_tetrahedralcleanupresult_free(ptr, 0);
2106
+ }
2107
+ /**
2108
+ * @returns {number}
2109
+ */
2110
+ get atom_index() {
2111
+ const ret = wasm.tetrahedralcleanupresult_atom_index(this.__wbg_ptr);
2112
+ return ret >>> 0;
2113
+ }
2114
+ /**
2115
+ * Independent molecule; all source labels and other configurations remain.
2116
+ * @returns {MolHandle}
2117
+ */
2118
+ get molecule() {
2119
+ const ret = wasm.tetrahedralcleanupresult_molecule(this.__wbg_ptr);
2120
+ return MolHandle.__wrap(ret);
2121
+ }
2122
+ /**
2123
+ * @returns {boolean}
2124
+ */
2125
+ get removed() {
2126
+ const ret = wasm.tetrahedralcleanupresult_removed(this.__wbg_ptr);
2127
+ return ret !== 0;
2128
+ }
2129
+ /**
2130
+ * @returns {string}
2131
+ */
2132
+ report_json() {
2133
+ let deferred1_0;
2134
+ let deferred1_1;
2135
+ try {
2136
+ const ret = wasm.tetrahedralcleanupresult_report_json(this.__wbg_ptr);
2137
+ deferred1_0 = ret[0];
2138
+ deferred1_1 = ret[1];
2139
+ return getStringFromWasm0(ret[0], ret[1]);
2140
+ } finally {
2141
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2142
+ }
2143
+ }
2144
+ /**
2145
+ * @returns {number}
2146
+ */
2147
+ get search_visits() {
2148
+ const ret = wasm.tetrahedralcleanupresult_search_visits(this.__wbg_ptr);
2149
+ return ret >>> 0;
2150
+ }
2151
+ }
2152
+ if (Symbol.dispose) TetrahedralCleanupResult.prototype[Symbol.dispose] = TetrahedralCleanupResult.prototype.free;
2153
+
2062
2154
  /**
2063
2155
  * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
2064
2156
  * @param {MolHandle} mol
@@ -2613,6 +2705,34 @@ export function cdxml_to_smiles_json(cdxml) {
2613
2705
  }
2614
2706
  }
2615
2707
 
2708
+ /**
2709
+ * Read all CDXML fragments with optional Bold/Hash/Dash stereo inference.
2710
+ * Retains the existing input/atom/fragment limits and JSON result shape.
2711
+ * @param {string} cdxml
2712
+ * @param {boolean} infer_nondirectional_stereo
2713
+ * @returns {string}
2714
+ */
2715
+ export function cdxml_to_smiles_json_with_options(cdxml, infer_nondirectional_stereo) {
2716
+ let deferred3_0;
2717
+ let deferred3_1;
2718
+ try {
2719
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2720
+ const len0 = WASM_VECTOR_LEN;
2721
+ const ret = wasm.cdxml_to_smiles_json_with_options(ptr0, len0, infer_nondirectional_stereo);
2722
+ var ptr2 = ret[0];
2723
+ var len2 = ret[1];
2724
+ if (ret[3]) {
2725
+ ptr2 = 0; len2 = 0;
2726
+ throw takeFromExternrefTable0(ret[2]);
2727
+ }
2728
+ deferred3_0 = ptr2;
2729
+ deferred3_1 = len2;
2730
+ return getStringFromWasm0(ptr2, len2);
2731
+ } finally {
2732
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2733
+ }
2734
+ }
2735
+
2616
2736
  /**
2617
2737
  * Compute the charge Parent and return a status-shaped JSON result.
2618
2738
  * @param {MolHandle} mol
@@ -2653,6 +2773,37 @@ export function chematic_version() {
2653
2773
  }
2654
2774
  }
2655
2775
 
2776
+ /**
2777
+ * Exact source bytes, projected XML, fragment coordinates and CDX omission tags.
2778
+ * CDXML uses the existing graph projection; omissions lists CDX tags only.
2779
+ * @param {Uint8Array} data
2780
+ * @param {string} format
2781
+ * @param {boolean} allow_metadata_loss
2782
+ * @returns {string}
2783
+ */
2784
+ export function chemdraw_block_report_json(data, format, allow_metadata_loss) {
2785
+ let deferred4_0;
2786
+ let deferred4_1;
2787
+ try {
2788
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
2789
+ const len0 = WASM_VECTOR_LEN;
2790
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2791
+ const len1 = WASM_VECTOR_LEN;
2792
+ const ret = wasm.chemdraw_block_report_json(ptr0, len0, ptr1, len1, allow_metadata_loss);
2793
+ var ptr3 = ret[0];
2794
+ var len3 = ret[1];
2795
+ if (ret[3]) {
2796
+ ptr3 = 0; len3 = 0;
2797
+ throw takeFromExternrefTable0(ret[2]);
2798
+ }
2799
+ deferred4_0 = ptr3;
2800
+ deferred4_1 = len3;
2801
+ return getStringFromWasm0(ptr3, len3);
2802
+ } finally {
2803
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2804
+ }
2805
+ }
2806
+
2656
2807
  /**
2657
2808
  * CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
2658
2809
  * array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
@@ -4070,7 +4221,9 @@ export function generic_murcko_scaffold(mol) {
4070
4221
  *
4071
4222
  * Fields: `element` (symbol), `hybridization` ("sp"/"sp2"/"sp3"),
4072
4223
  * `charge` (formal charge integer), `isAromatic` (bool),
4073
- * `totalHydrogens` (explicit + implicit H count, integer).
4224
+ * `totalHydrogens` (attached H: bracket/inferred plus explicit H neighbors).
4225
+ * This excludes the atom itself when it is H; use `num_hydrogens` for the
4226
+ * molecule's total. Isotopic H neighbors count as hydrogen.
4074
4227
  * sp3d/sp3d2 (hypervalent P/S) are not distinguished from sp3/sp2.
4075
4228
  * @param {MolHandle} mol
4076
4229
  * @param {number} idx
@@ -4477,6 +4630,33 @@ export function isotope_parent_json(mol) {
4477
4630
  }
4478
4631
  }
4479
4632
 
4633
+ /**
4634
+ * Replace only ar bond tokens in a bounded neutral aromatic MOL2 record.
4635
+ * Retains atom types and every other source byte; errors throw, no partial text.
4636
+ * @param {string} text
4637
+ * @returns {string}
4638
+ */
4639
+ export function kekulize_mol2_record(text) {
4640
+ let deferred3_0;
4641
+ let deferred3_1;
4642
+ try {
4643
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4644
+ const len0 = WASM_VECTOR_LEN;
4645
+ const ret = wasm.kekulize_mol2_record(ptr0, len0);
4646
+ var ptr2 = ret[0];
4647
+ var len2 = ret[1];
4648
+ if (ret[3]) {
4649
+ ptr2 = 0; len2 = 0;
4650
+ throw takeFromExternrefTable0(ret[2]);
4651
+ }
4652
+ deferred3_0 = ptr2;
4653
+ deferred3_1 = len2;
4654
+ return getStringFromWasm0(ptr2, len2);
4655
+ } finally {
4656
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
4657
+ }
4658
+ }
4659
+
4480
4660
  /**
4481
4661
  * Per-atom Labute approximate surface area contributions as a JSON array of f64.
4482
4662
  *
@@ -5507,6 +5687,24 @@ export function mol_from_cdxml(cdxml) {
5507
5687
  return MolHandle.__wrap(ret[0]);
5508
5688
  }
5509
5689
 
5690
+ /**
5691
+ * Read the first CDXML fragment, optionally inferring Bold/Hash/Dash stereo.
5692
+ * Non-directional displays are heuristic: ambiguous or degenerate drawings
5693
+ * remain unassigned. `false` has the same behavior as `mol_from_cdxml`.
5694
+ * @param {string} cdxml
5695
+ * @param {boolean} infer_nondirectional_stereo
5696
+ * @returns {MolHandle}
5697
+ */
5698
+ export function mol_from_cdxml_with_options(cdxml, infer_nondirectional_stereo) {
5699
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5700
+ const len0 = WASM_VECTOR_LEN;
5701
+ const ret = wasm.mol_from_cdxml_with_options(ptr0, len0, infer_nondirectional_stereo);
5702
+ if (ret[2]) {
5703
+ throw takeFromExternrefTable0(ret[1]);
5704
+ }
5705
+ return MolHandle.__wrap(ret[0]);
5706
+ }
5707
+
5510
5708
  /**
5511
5709
  * Parse a ChemicalJSON (CJSON) string into a `MolHandle`.
5512
5710
  *
@@ -5679,6 +5877,23 @@ export function mol_from_pdb(pdb) {
5679
5877
  return MolHandle.__wrap(ret);
5680
5878
  }
5681
5879
 
5880
+ /**
5881
+ * Explicit CONECT graph, without distance-based bonding. Only unmodelled,
5882
+ * single-location atoms with explicit element fields are accepted.
5883
+ * @param {string} input
5884
+ * @param {boolean} allow_extended_targets
5885
+ * @returns {MolHandle}
5886
+ */
5887
+ export function mol_from_pdb_conect(input, allow_extended_targets) {
5888
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5889
+ const len0 = WASM_VECTOR_LEN;
5890
+ const ret = wasm.mol_from_pdb_conect(ptr0, len0, allow_extended_targets);
5891
+ if (ret[2]) {
5892
+ throw takeFromExternrefTable0(ret[1]);
5893
+ }
5894
+ return MolHandle.__wrap(ret[0]);
5895
+ }
5896
+
5682
5897
  /**
5683
5898
  * Strict PDB parser. Unlike [`mol_from_pdb`], malformed ATOM/HETATM fields
5684
5899
  * return an error instead of producing a partially recovered molecule.
@@ -6008,6 +6223,27 @@ export function molecule_report_json(smiles) {
6008
6223
  }
6009
6224
  }
6010
6225
 
6226
+ /**
6227
+ * Concrete CDX/CDXML fragment handles, in source fragment order.
6228
+ * @param {Uint8Array} data
6229
+ * @param {string} format
6230
+ * @param {boolean} allow_metadata_loss
6231
+ * @returns {MolHandle[]}
6232
+ */
6233
+ export function mols_from_chemdraw_block(data, format, allow_metadata_loss) {
6234
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
6235
+ const len0 = WASM_VECTOR_LEN;
6236
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6237
+ const len1 = WASM_VECTOR_LEN;
6238
+ const ret = wasm.mols_from_chemdraw_block(ptr0, len0, ptr1, len1, allow_metadata_loss);
6239
+ if (ret[3]) {
6240
+ throw takeFromExternrefTable0(ret[2]);
6241
+ }
6242
+ var v3 = getArrayJsValueFromWasm0(ret[0], ret[1]);
6243
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
6244
+ return v3;
6245
+ }
6246
+
6011
6247
  /**
6012
6248
  * MQN descriptor (42 integer values: Molecular Quantum Numbers).
6013
6249
  * @param {MolHandle} mol
@@ -6203,6 +6439,18 @@ export function nucleic_acid_validate_json(document_json) {
6203
6439
  }
6204
6440
  }
6205
6441
 
6442
+ /**
6443
+ * Total hydrogen nuclei: explicit nodes plus attached bracket/inferred H.
6444
+ * Isotopic, charged, bridging and disconnected H nodes each count once.
6445
+ * @param {MolHandle} mol
6446
+ * @returns {number}
6447
+ */
6448
+ export function num_hydrogens(mol) {
6449
+ _assertClass(mol, MolHandle);
6450
+ const ret = wasm.num_hydrogens(mol.__wbg_ptr);
6451
+ return ret >>> 0;
6452
+ }
6453
+
6206
6454
  /**
6207
6455
  * Parse an OpenDX (APBS scalar-field subset) file and return its full
6208
6456
  * [`chematic_mol::VolumetricGrid`] as JSON (same shape as
@@ -6561,6 +6809,34 @@ export function parse_smiles(s) {
6561
6809
  return MolHandle.__wrap(ret[0]);
6562
6810
  }
6563
6811
 
6812
+ /**
6813
+ * Indexed atoms/charges, bonds, coordinates and source serials for the same
6814
+ * explicit CONECT projection. Molecular identity and coordinate order agree.
6815
+ * @param {string} input
6816
+ * @param {boolean} allow_extended_targets
6817
+ * @returns {string}
6818
+ */
6819
+ export function pdb_conect_frame_json(input, allow_extended_targets) {
6820
+ let deferred3_0;
6821
+ let deferred3_1;
6822
+ try {
6823
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6824
+ const len0 = WASM_VECTOR_LEN;
6825
+ const ret = wasm.pdb_conect_frame_json(ptr0, len0, allow_extended_targets);
6826
+ var ptr2 = ret[0];
6827
+ var len2 = ret[1];
6828
+ if (ret[3]) {
6829
+ ptr2 = 0; len2 = 0;
6830
+ throw takeFromExternrefTable0(ret[2]);
6831
+ }
6832
+ deferred3_0 = ptr2;
6833
+ deferred3_1 = len2;
6834
+ return getStringFromWasm0(ptr2, len2);
6835
+ } finally {
6836
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
6837
+ }
6838
+ }
6839
+
6564
6840
  /**
6565
6841
  * Extract the atomic coordinates from a PDB block, in the SAME atom order
6566
6842
  * `mol_from_pdb` returns topology for (both read the identical underlying
@@ -7518,6 +7794,24 @@ export function remove_hydrogens(mol) {
7518
7794
  return MolHandle.__wrap(ret);
7519
7795
  }
7520
7796
 
7797
+ /**
7798
+ * Opt-in exact tetrahedral cleanup. Both index and budget must be JS numbers
7799
+ * containing integers (bool/string/null are rejected). The kernel caps inputs
7800
+ * at 64 atoms/128 bonds and max_visits at 10000000. Errors throw without a result.
7801
+ * @param {MolHandle} mol
7802
+ * @param {any} atom_index
7803
+ * @param {any} max_visits
7804
+ * @returns {TetrahedralCleanupResult}
7805
+ */
7806
+ export function remove_redundant_tetrahedral_stereo(mol, atom_index, max_visits) {
7807
+ _assertClass(mol, MolHandle);
7808
+ const ret = wasm.remove_redundant_tetrahedral_stereo(mol.__wbg_ptr, atom_index, max_visits);
7809
+ if (ret[2]) {
7810
+ throw takeFromExternrefTable0(ret[1]);
7811
+ }
7812
+ return TetrahedralCleanupResult.__wrap(ret[0]);
7813
+ }
7814
+
7521
7815
  /**
7522
7816
  * Single-step retrosynthetic disconnection (issue #91).
7523
7817
  *
@@ -8498,17 +8792,20 @@ export function smiles_array_to_sdf(smiles_json) {
8498
8792
  /**
8499
8793
  * Convert a SMILES to a minimal Tripos MOL2 string (no 3D coordinates).
8500
8794
  *
8501
- * Returns `"error:<msg>"` on parse failure.
8795
+ * Optional `atom_bond_adjacent=true` emits ATOM → BOND → UNITY. Some
8796
+ * readers (including Open Babel 3.2.1) ignore UNITY charges in this order.
8797
+ * Omit it to retain existing bytes. Returns `"error:<msg>"` on parse failure.
8502
8798
  * @param {string} smiles
8799
+ * @param {boolean | null} [atom_bond_adjacent]
8503
8800
  * @returns {string}
8504
8801
  */
8505
- export function smiles_to_mol2(smiles) {
8802
+ export function smiles_to_mol2(smiles, atom_bond_adjacent) {
8506
8803
  let deferred2_0;
8507
8804
  let deferred2_1;
8508
8805
  try {
8509
8806
  const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8510
8807
  const len0 = WASM_VECTOR_LEN;
8511
- const ret = wasm.smiles_to_mol2(ptr0, len0);
8808
+ const ret = wasm.smiles_to_mol2(ptr0, len0, isLikeNone(atom_bond_adjacent) ? 0xFFFFFF : atom_bond_adjacent ? 1 : 0);
8512
8809
  deferred2_0 = ret[0];
8513
8810
  deferred2_1 = ret[1];
8514
8811
  return getStringFromWasm0(ret[0], ret[1]);
@@ -8552,6 +8849,45 @@ export function smiles_to_pdbqt(smiles, coords_json, charges_json, name) {
8552
8849
  }
8553
8850
  }
8554
8851
 
8852
+ /**
8853
+ * Write rigid PDBQT or throw for malformed/unrepresentable input. Coordinates
8854
+ * are JSON [x,y,z] arrays in Å; charges are JSON numbers in e. Both arrays must
8855
+ * contain exactly one value per graph atom, including explicit H. No defaults,
8856
+ * charge calculation, atom removal or ligand torsion preparation are applied.
8857
+ * AutoDock types retain the legacy heuristic, with unknown `X` types rejected.
8858
+ * @param {string} smiles
8859
+ * @param {string} coords_json
8860
+ * @param {string} charges_json
8861
+ * @param {string} name
8862
+ * @returns {string}
8863
+ */
8864
+ export function smiles_to_pdbqt_checked(smiles, coords_json, charges_json, name) {
8865
+ let deferred6_0;
8866
+ let deferred6_1;
8867
+ try {
8868
+ const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8869
+ const len0 = WASM_VECTOR_LEN;
8870
+ const ptr1 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8871
+ const len1 = WASM_VECTOR_LEN;
8872
+ const ptr2 = passStringToWasm0(charges_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8873
+ const len2 = WASM_VECTOR_LEN;
8874
+ const ptr3 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
8875
+ const len3 = WASM_VECTOR_LEN;
8876
+ const ret = wasm.smiles_to_pdbqt_checked(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
8877
+ var ptr5 = ret[0];
8878
+ var len5 = ret[1];
8879
+ if (ret[3]) {
8880
+ ptr5 = 0; len5 = 0;
8881
+ throw takeFromExternrefTable0(ret[2]);
8882
+ }
8883
+ deferred6_0 = ptr5;
8884
+ deferred6_1 = len5;
8885
+ return getStringFromWasm0(ptr5, len5);
8886
+ } finally {
8887
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
8888
+ }
8889
+ }
8890
+
8555
8891
  /**
8556
8892
  * Render a highlighted SVG from a SMILES string in one call.
8557
8893
  *
@@ -9744,6 +10080,12 @@ function __wbg_get_imports() {
9744
10080
  const ret = arg0 === undefined;
9745
10081
  return ret;
9746
10082
  },
10083
+ __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
10084
+ const obj = arg1;
10085
+ const ret = typeof(obj) === 'number' ? obj : undefined;
10086
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
10087
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
10088
+ },
9747
10089
  __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
9748
10090
  const obj = arg1;
9749
10091
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -9758,6 +10100,10 @@ function __wbg_get_imports() {
9758
10100
  __wbg_error_c9cf3fc2064683a9: function(arg0) {
9759
10101
  console.error(arg0);
9760
10102
  },
10103
+ __wbg_molhandle_new: function(arg0) {
10104
+ const ret = MolHandle.__wrap(arg0);
10105
+ return ret;
10106
+ },
9761
10107
  __wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
9762
10108
  const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
9763
10109
  return ret;
@@ -9840,6 +10186,9 @@ const RdkitSearchIndexFinalization = (typeof FinalizationRegistry === 'undefined
9840
10186
  const SmilesBatchStreamHandleFinalization = (typeof FinalizationRegistry === 'undefined')
9841
10187
  ? { register: () => {}, unregister: () => {} }
9842
10188
  : new FinalizationRegistry(ptr => wasm.__wbg_smilesbatchstreamhandle_free(ptr, 1));
10189
+ const TetrahedralCleanupResultFinalization = (typeof FinalizationRegistry === 'undefined')
10190
+ ? { register: () => {}, unregister: () => {} }
10191
+ : new FinalizationRegistry(ptr => wasm.__wbg_tetrahedralcleanupresult_free(ptr, 1));
9843
10192
 
9844
10193
  function addToExternrefTable0(obj) {
9845
10194
  const idx = wasm.__externref_table_alloc();
@@ -9858,6 +10207,17 @@ function getArrayF64FromWasm0(ptr, len) {
9858
10207
  return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
9859
10208
  }
9860
10209
 
10210
+ function getArrayJsValueFromWasm0(ptr, len) {
10211
+ ptr = ptr >>> 0;
10212
+ const mem = getDataViewMemory0();
10213
+ const result = [];
10214
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
10215
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
10216
+ }
10217
+ wasm.__externref_drop_slice(ptr, len);
10218
+ return result;
10219
+ }
10220
+
9861
10221
  function getArrayU32FromWasm0(ptr, len) {
9862
10222
  ptr = ptr >>> 0;
9863
10223
  return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
@@ -9915,6 +10275,13 @@ function passArray32ToWasm0(arg, malloc) {
9915
10275
  return ptr;
9916
10276
  }
9917
10277
 
10278
+ function passArray8ToWasm0(arg, malloc) {
10279
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
10280
+ getUint8ArrayMemory0().set(arg, ptr / 1);
10281
+ WASM_VECTOR_LEN = arg.length;
10282
+ return ptr;
10283
+ }
10284
+
9918
10285
  function passStringToWasm0(arg, malloc, realloc) {
9919
10286
  if (realloc === undefined) {
9920
10287
  const buf = cachedTextEncoder.encode(arg);
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.1.5",
8
+ "version": "1.1.6",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",