@kent-tokyo/chematic 0.1.20 → 0.1.22

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.
@@ -380,6 +380,17 @@ export function butina_cluster_ecfp4_json(smiles_json: string, cutoff: number):
380
380
  */
381
381
  export function canonical_tautomer(mol: MolHandle): MolHandle;
382
382
 
383
+ /**
384
+ * Parse all molecular fragments from a CDXML string.
385
+ *
386
+ * Returns a JSON array of SMILES strings, one per fragment:
387
+ * `["CC","c1ccccc1"]`
388
+ *
389
+ * Stereochemistry (wedge/dash bonds) is read from the `Display` attribute
390
+ * of bond elements.
391
+ */
392
+ export function cdxml_to_smiles_json(cdxml: string): string;
393
+
383
394
  /**
384
395
  * CIP stereo assignments as a JSON array of `{atomIdx, cipCode}` objects.
385
396
  *
@@ -418,6 +429,15 @@ export function cpk_color(element_symbol: string): string;
418
429
  */
419
430
  export function depict_data_json(mol: MolHandle): string;
420
431
 
432
+ /**
433
+ * Compute structured depiction data using caller-supplied 2D coordinates.
434
+ *
435
+ * `coords_json` — JSON array of `[x, y]` pairs, one per atom in order.
436
+ *
437
+ * Returns the same JSON format as `depict_data_json`.
438
+ */
439
+ export function depict_data_with_coords_json(mol: MolHandle, coords_json: string): string;
440
+
421
441
  /**
422
442
  * Render a reaction SMILES string (e.g. `"CC(=O)O.CCO>>CC(=O)OCC.O"`) as a
423
443
  * single SVG showing reactants → products with `+` separators.
@@ -694,6 +714,14 @@ export function mcs_smiles_json(smiles_json: string): string;
694
714
  */
695
715
  export function mmp_pairs_json(smiles_json: string): string;
696
716
 
717
+ /**
718
+ * Parse a MOL V2000 string and return 2D coordinates as a JSON array.
719
+ *
720
+ * Returns `[[x0,y0],[x1,y1],...]` in atom-insertion order.
721
+ * Coordinates are in Ångström as stored in the MOL file.
722
+ */
723
+ export function mol_block_coords_json(mol_block: string): string;
724
+
697
725
  /**
698
726
  * Serialize a SMILES string directly to a MOL V2000 block with 2D coordinates.
699
727
  *
@@ -758,6 +786,21 @@ export function mol_next_atom_idx(mol: MolHandle): number;
758
786
  */
759
787
  export function mol_with_atom_added(mol: MolHandle, element_symbol: string): MolHandle;
760
788
 
789
+ /**
790
+ * Return a new `MolHandle` with the formal charge of atom `idx` changed.
791
+ *
792
+ * Returns a JS error if `idx` is out of range.
793
+ */
794
+ export function mol_with_atom_charge(mol: MolHandle, idx: number, charge: number): MolHandle;
795
+
796
+ /**
797
+ * Return a new `MolHandle` with the element of atom `idx` changed.
798
+ *
799
+ * `element_symbol` — periodic-table symbol, e.g. `"N"`, `"O"`, `"Cl"`.
800
+ * Returns a JS error if `idx` is out of range or the symbol is unknown.
801
+ */
802
+ export function mol_with_atom_element(mol: MolHandle, idx: number, element_symbol: string): MolHandle;
803
+
761
804
  /**
762
805
  * Return a new `MolHandle` with atom `idx` and all its bonds removed.
763
806
  *
@@ -1067,6 +1110,7 @@ export interface InitOutput {
1067
1110
  readonly brics_fragments_json: (a: number) => [number, number];
1068
1111
  readonly butina_cluster_ecfp4_json: (a: number, b: number, c: number) => [number, number, number, number];
1069
1112
  readonly canonical_tautomer: (a: number) => number;
1113
+ readonly cdxml_to_smiles_json: (a: number, b: number) => [number, number, number, number];
1070
1114
  readonly cip_assignments_json: (a: number) => [number, number];
1071
1115
  readonly conformerhandle_add_generated_conformer: (a: number) => number;
1072
1116
  readonly conformerhandle_add_minimized_conformer: (a: number) => number;
@@ -1079,6 +1123,7 @@ export interface InitOutput {
1079
1123
  readonly conformerhandle_remove_conformer: (a: number, b: number) => number;
1080
1124
  readonly cpk_color: (a: number, b: number) => [number, number];
1081
1125
  readonly depict_data_json: (a: number) => [number, number];
1126
+ readonly depict_data_with_coords_json: (a: number, b: number, c: number) => [number, number];
1082
1127
  readonly depict_reaction_svg: (a: number, b: number) => [number, number, number, number];
1083
1128
  readonly depict_svg_grid: (a: number, b: number, c: number) => [number, number];
1084
1129
  readonly depict_svg_grid_highlighted: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -1125,6 +1170,7 @@ export interface InitOutput {
1125
1170
  readonly maxmin_picks_ecfp4_json: (a: number, b: number, c: number) => [number, number, number, number];
1126
1171
  readonly mcs_smiles_json: (a: number, b: number) => [number, number, number, number];
1127
1172
  readonly mmp_pairs_json: (a: number, b: number) => [number, number, number, number];
1173
+ readonly mol_block_coords_json: (a: number, b: number) => [number, number, number, number];
1128
1174
  readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
1129
1175
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
1130
1176
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
@@ -1134,6 +1180,8 @@ export interface InitOutput {
1134
1180
  readonly mol_from_xyz: (a: number, b: number) => [number, number, number];
1135
1181
  readonly mol_next_atom_idx: (a: number) => number;
1136
1182
  readonly mol_with_atom_added: (a: number, b: number, c: number) => [number, number, number];
1183
+ readonly mol_with_atom_charge: (a: number, b: number, c: number) => [number, number, number];
1184
+ readonly mol_with_atom_element: (a: number, b: number, c: number, d: number) => [number, number, number];
1137
1185
  readonly mol_with_atom_removed: (a: number, b: number) => [number, number, number];
1138
1186
  readonly mol_with_bond_added: (a: number, b: number, c: number, d: number) => [number, number, number];
1139
1187
  readonly mol_with_bond_removed: (a: number, b: number) => [number, number, number];
package/chematic_wasm.js CHANGED
@@ -868,6 +868,38 @@ export function canonical_tautomer(mol) {
868
868
  return MolHandle.__wrap(ret);
869
869
  }
870
870
 
871
+ /**
872
+ * Parse all molecular fragments from a CDXML string.
873
+ *
874
+ * Returns a JSON array of SMILES strings, one per fragment:
875
+ * `["CC","c1ccccc1"]`
876
+ *
877
+ * Stereochemistry (wedge/dash bonds) is read from the `Display` attribute
878
+ * of bond elements.
879
+ * @param {string} cdxml
880
+ * @returns {string}
881
+ */
882
+ export function cdxml_to_smiles_json(cdxml) {
883
+ let deferred3_0;
884
+ let deferred3_1;
885
+ try {
886
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
887
+ const len0 = WASM_VECTOR_LEN;
888
+ const ret = wasm.cdxml_to_smiles_json(ptr0, len0);
889
+ var ptr2 = ret[0];
890
+ var len2 = ret[1];
891
+ if (ret[3]) {
892
+ ptr2 = 0; len2 = 0;
893
+ throw takeFromExternrefTable0(ret[2]);
894
+ }
895
+ deferred3_0 = ptr2;
896
+ deferred3_1 = len2;
897
+ return getStringFromWasm0(ptr2, len2);
898
+ } finally {
899
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
900
+ }
901
+ }
902
+
871
903
  /**
872
904
  * CIP stereo assignments as a JSON array of `{atomIdx, cipCode}` objects.
873
905
  *
@@ -949,6 +981,32 @@ export function depict_data_json(mol) {
949
981
  }
950
982
  }
951
983
 
984
+ /**
985
+ * Compute structured depiction data using caller-supplied 2D coordinates.
986
+ *
987
+ * `coords_json` — JSON array of `[x, y]` pairs, one per atom in order.
988
+ *
989
+ * Returns the same JSON format as `depict_data_json`.
990
+ * @param {MolHandle} mol
991
+ * @param {string} coords_json
992
+ * @returns {string}
993
+ */
994
+ export function depict_data_with_coords_json(mol, coords_json) {
995
+ let deferred2_0;
996
+ let deferred2_1;
997
+ try {
998
+ _assertClass(mol, MolHandle);
999
+ const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1000
+ const len0 = WASM_VECTOR_LEN;
1001
+ const ret = wasm.depict_data_with_coords_json(mol.__wbg_ptr, ptr0, len0);
1002
+ deferred2_0 = ret[0];
1003
+ deferred2_1 = ret[1];
1004
+ return getStringFromWasm0(ret[0], ret[1]);
1005
+ } finally {
1006
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1007
+ }
1008
+ }
1009
+
952
1010
  /**
953
1011
  * Render a reaction SMILES string (e.g. `"CC(=O)O.CCO>>CC(=O)OCC.O"`) as a
954
1012
  * single SVG showing reactants → products with `+` separators.
@@ -1668,6 +1726,35 @@ export function mmp_pairs_json(smiles_json) {
1668
1726
  }
1669
1727
  }
1670
1728
 
1729
+ /**
1730
+ * Parse a MOL V2000 string and return 2D coordinates as a JSON array.
1731
+ *
1732
+ * Returns `[[x0,y0],[x1,y1],...]` in atom-insertion order.
1733
+ * Coordinates are in Ångström as stored in the MOL file.
1734
+ * @param {string} mol_block
1735
+ * @returns {string}
1736
+ */
1737
+ export function mol_block_coords_json(mol_block) {
1738
+ let deferred3_0;
1739
+ let deferred3_1;
1740
+ try {
1741
+ const ptr0 = passStringToWasm0(mol_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1742
+ const len0 = WASM_VECTOR_LEN;
1743
+ const ret = wasm.mol_block_coords_json(ptr0, len0);
1744
+ var ptr2 = ret[0];
1745
+ var len2 = ret[1];
1746
+ if (ret[3]) {
1747
+ ptr2 = 0; len2 = 0;
1748
+ throw takeFromExternrefTable0(ret[2]);
1749
+ }
1750
+ deferred3_0 = ptr2;
1751
+ deferred3_1 = len2;
1752
+ return getStringFromWasm0(ptr2, len2);
1753
+ } finally {
1754
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1755
+ }
1756
+ }
1757
+
1671
1758
  /**
1672
1759
  * Serialize a SMILES string directly to a MOL V2000 block with 2D coordinates.
1673
1760
  *
@@ -1828,6 +1915,45 @@ export function mol_with_atom_added(mol, element_symbol) {
1828
1915
  return MolHandle.__wrap(ret[0]);
1829
1916
  }
1830
1917
 
1918
+ /**
1919
+ * Return a new `MolHandle` with the formal charge of atom `idx` changed.
1920
+ *
1921
+ * Returns a JS error if `idx` is out of range.
1922
+ * @param {MolHandle} mol
1923
+ * @param {number} idx
1924
+ * @param {number} charge
1925
+ * @returns {MolHandle}
1926
+ */
1927
+ export function mol_with_atom_charge(mol, idx, charge) {
1928
+ _assertClass(mol, MolHandle);
1929
+ const ret = wasm.mol_with_atom_charge(mol.__wbg_ptr, idx, charge);
1930
+ if (ret[2]) {
1931
+ throw takeFromExternrefTable0(ret[1]);
1932
+ }
1933
+ return MolHandle.__wrap(ret[0]);
1934
+ }
1935
+
1936
+ /**
1937
+ * Return a new `MolHandle` with the element of atom `idx` changed.
1938
+ *
1939
+ * `element_symbol` — periodic-table symbol, e.g. `"N"`, `"O"`, `"Cl"`.
1940
+ * Returns a JS error if `idx` is out of range or the symbol is unknown.
1941
+ * @param {MolHandle} mol
1942
+ * @param {number} idx
1943
+ * @param {string} element_symbol
1944
+ * @returns {MolHandle}
1945
+ */
1946
+ export function mol_with_atom_element(mol, idx, element_symbol) {
1947
+ _assertClass(mol, MolHandle);
1948
+ const ptr0 = passStringToWasm0(element_symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1949
+ const len0 = WASM_VECTOR_LEN;
1950
+ const ret = wasm.mol_with_atom_element(mol.__wbg_ptr, idx, ptr0, len0);
1951
+ if (ret[2]) {
1952
+ throw takeFromExternrefTable0(ret[1]);
1953
+ }
1954
+ return MolHandle.__wrap(ret[0]);
1955
+ }
1956
+
1831
1957
  /**
1832
1958
  * Return a new `MolHandle` with atom `idx` and all its bonds removed.
1833
1959
  *
Binary file
package/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  "collaborators": [
5
5
  "kent-tokyo <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
- "description": "WebAssembly bindings for chematic use chematic from JavaScript/TypeScript",
8
- "version": "0.1.20",
7
+ "description": "WebAssembly bindings for chematic \u2014 use chematic from JavaScript/TypeScript",
8
+ "version": "0.1.22",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",