@kent-tokyo/chematic 0.1.36 → 0.1.38
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/chematic_wasm.d.ts +70 -0
- package/chematic_wasm.js +141 -1
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/chematic_wasm.d.ts
CHANGED
|
@@ -730,6 +730,22 @@ export function get_bond_between(mol: MolHandle, atom1: number, atom2: number):
|
|
|
730
730
|
*/
|
|
731
731
|
export function get_bond_info(mol: MolHandle, idx: number): string;
|
|
732
732
|
|
|
733
|
+
/**
|
|
734
|
+
* Get bond length in Ångströms between two atoms from a SMILES string.
|
|
735
|
+
* Returns -1.0 if parsing fails or atom indices are out of range.
|
|
736
|
+
*
|
|
737
|
+
* # Arguments
|
|
738
|
+
* - `smiles`: SMILES string
|
|
739
|
+
* - `a`: first atom index
|
|
740
|
+
* - `b`: second atom index
|
|
741
|
+
*
|
|
742
|
+
* # Example
|
|
743
|
+
* ```javascript
|
|
744
|
+
* const len = get_bond_length_json("CC", 0, 1); // C-C single bond ≈ 1.54 Å
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
export function get_bond_length_json(smiles: string, a: number, b: number): number;
|
|
748
|
+
|
|
733
749
|
/**
|
|
734
750
|
* All scalar molecular descriptors as a single JSON object.
|
|
735
751
|
*
|
|
@@ -738,6 +754,21 @@ export function get_bond_info(mol: MolHandle, idx: number): string;
|
|
|
738
754
|
*/
|
|
739
755
|
export function get_descriptors_json(mol: MolHandle): string;
|
|
740
756
|
|
|
757
|
+
/**
|
|
758
|
+
* Get dihedral angle A—B—C—D in degrees from a SMILES string.
|
|
759
|
+
* Returns null (JSON null) if any atom index is out of range or atoms are collinear.
|
|
760
|
+
*
|
|
761
|
+
* # Arguments
|
|
762
|
+
* - `smiles`: SMILES string
|
|
763
|
+
* - `a`, `b`, `c`, `d`: atom indices
|
|
764
|
+
*
|
|
765
|
+
* # Example
|
|
766
|
+
* ```javascript
|
|
767
|
+
* const dihedral = get_dihedral_json("CCCC", 0, 1, 2, 3); // A-B-C-D
|
|
768
|
+
* ```
|
|
769
|
+
*/
|
|
770
|
+
export function get_dihedral_json(smiles: string, a: number, b: number, c: number, d: number): any;
|
|
771
|
+
|
|
741
772
|
/**
|
|
742
773
|
* Identify functional groups. Returns a JSON array of objects:
|
|
743
774
|
* `[{"atoms":[0,2,3],"type":"C,N,O"}, …]`
|
|
@@ -1074,6 +1105,24 @@ export function parse_smiles(s: string): MolHandle;
|
|
|
1074
1105
|
*/
|
|
1075
1106
|
export function peoe_vsa_json(mol: MolHandle): string;
|
|
1076
1107
|
|
|
1108
|
+
/**
|
|
1109
|
+
* Generate `count` random SMILES from a SMILES string using the given seed.
|
|
1110
|
+
* Atoms are permuted based on xorshift64 RNG. Each variant should parse back
|
|
1111
|
+
* to the same molecule. Returns a JSON array of SMILES strings.
|
|
1112
|
+
*
|
|
1113
|
+
* # Arguments
|
|
1114
|
+
* - `smiles`: input SMILES string
|
|
1115
|
+
* - `count`: number of variants to generate (capped at 100)
|
|
1116
|
+
* - `seed`: xorshift64 seed
|
|
1117
|
+
*
|
|
1118
|
+
* # Example
|
|
1119
|
+
* ```javascript
|
|
1120
|
+
* const variants = random_smiles_json("CC(C)O", 5, 42);
|
|
1121
|
+
* // variants: ["CC(C)O", "C(C)(O)C", ...]
|
|
1122
|
+
* ```
|
|
1123
|
+
*/
|
|
1124
|
+
export function random_smiles_json(smiles: string, count: number, seed: bigint): string;
|
|
1125
|
+
|
|
1077
1126
|
/**
|
|
1078
1127
|
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
1079
1128
|
*/
|
|
@@ -1180,6 +1229,23 @@ export function sdf_to_records_json(sdf: string): string;
|
|
|
1180
1229
|
*/
|
|
1181
1230
|
export function sdf_to_smiles_json(sdf: string): string;
|
|
1182
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* Set dihedral angle A—B—C—D and return PDB block with modified coordinates.
|
|
1234
|
+
* Rotates the D-side subtree around the B—C bond.
|
|
1235
|
+
* Returns a JS error if parsing fails or atom indices are invalid.
|
|
1236
|
+
*
|
|
1237
|
+
* # Arguments
|
|
1238
|
+
* - `smiles`: SMILES string
|
|
1239
|
+
* - `a`, `b`, `c`, `d`: atom indices
|
|
1240
|
+
* - `angle_deg`: target dihedral angle in degrees
|
|
1241
|
+
*
|
|
1242
|
+
* # Example
|
|
1243
|
+
* ```javascript
|
|
1244
|
+
* const pdbBlock = set_dihedral_json("CCCC", 0, 1, 2, 3, 120.0);
|
|
1245
|
+
* ```
|
|
1246
|
+
*/
|
|
1247
|
+
export function set_dihedral_json(smiles: string, a: number, b: number, c: number, d: number, angle_deg: number): string;
|
|
1248
|
+
|
|
1183
1249
|
/**
|
|
1184
1250
|
* 3D shape descriptors as a JSON object.
|
|
1185
1251
|
*
|
|
@@ -1424,7 +1490,9 @@ export interface InitOutput {
|
|
|
1424
1490
|
readonly get_atom_info: (a: number, b: number) => [number, number];
|
|
1425
1491
|
readonly get_bond_between: (a: number, b: number, c: number) => [number, number];
|
|
1426
1492
|
readonly get_bond_info: (a: number, b: number) => [number, number];
|
|
1493
|
+
readonly get_bond_length_json: (a: number, b: number, c: number, d: number) => number;
|
|
1427
1494
|
readonly get_descriptors_json: (a: number) => [number, number];
|
|
1495
|
+
readonly get_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
1428
1496
|
readonly identify_functional_groups: (a: number) => [number, number];
|
|
1429
1497
|
readonly inchi_from_smiles: (a: number, b: number) => [number, number];
|
|
1430
1498
|
readonly inchikey_from_smiles: (a: number, b: number) => [number, number];
|
|
@@ -1523,6 +1591,7 @@ export interface InitOutput {
|
|
|
1523
1591
|
readonly parse_cxsmiles_json: (a: number, b: number) => [number, number, number, number];
|
|
1524
1592
|
readonly parse_smiles: (a: number, b: number) => [number, number, number];
|
|
1525
1593
|
readonly peoe_vsa_json: (a: number) => [number, number];
|
|
1594
|
+
readonly random_smiles_json: (a: number, b: number, c: number, d: bigint) => [number, number, number, number];
|
|
1526
1595
|
readonly remove_hydrogens: (a: number) => number;
|
|
1527
1596
|
readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1528
1597
|
readonly run_md_json: (a: number, b: number, c: number) => [number, number];
|
|
@@ -1531,6 +1600,7 @@ export interface InitOutput {
|
|
|
1531
1600
|
readonly sdf_from_records_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
1532
1601
|
readonly sdf_to_records_json: (a: number, b: number) => [number, number];
|
|
1533
1602
|
readonly sdf_to_smiles_json: (a: number, b: number) => [number, number];
|
|
1603
|
+
readonly set_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
1534
1604
|
readonly shape_descriptors_json: (a: number) => [number, number];
|
|
1535
1605
|
readonly slogp_vsa_json: (a: number) => [number, number];
|
|
1536
1606
|
readonly smarts_match_atoms: (a: number, b: number, c: number) => [number, number, number, number];
|
package/chematic_wasm.js
CHANGED
|
@@ -1754,6 +1754,31 @@ export function get_bond_info(mol, idx) {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
1756
|
|
|
1757
|
+
/**
|
|
1758
|
+
* Get bond length in Ångströms between two atoms from a SMILES string.
|
|
1759
|
+
* Returns -1.0 if parsing fails or atom indices are out of range.
|
|
1760
|
+
*
|
|
1761
|
+
* # Arguments
|
|
1762
|
+
* - `smiles`: SMILES string
|
|
1763
|
+
* - `a`: first atom index
|
|
1764
|
+
* - `b`: second atom index
|
|
1765
|
+
*
|
|
1766
|
+
* # Example
|
|
1767
|
+
* ```javascript
|
|
1768
|
+
* const len = get_bond_length_json("CC", 0, 1); // C-C single bond ≈ 1.54 Å
|
|
1769
|
+
* ```
|
|
1770
|
+
* @param {string} smiles
|
|
1771
|
+
* @param {number} a
|
|
1772
|
+
* @param {number} b
|
|
1773
|
+
* @returns {number}
|
|
1774
|
+
*/
|
|
1775
|
+
export function get_bond_length_json(smiles, a, b) {
|
|
1776
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1777
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1778
|
+
const ret = wasm.get_bond_length_json(ptr0, len0, a, b);
|
|
1779
|
+
return ret;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1757
1782
|
/**
|
|
1758
1783
|
* All scalar molecular descriptors as a single JSON object.
|
|
1759
1784
|
*
|
|
@@ -1776,6 +1801,32 @@ export function get_descriptors_json(mol) {
|
|
|
1776
1801
|
}
|
|
1777
1802
|
}
|
|
1778
1803
|
|
|
1804
|
+
/**
|
|
1805
|
+
* Get dihedral angle A—B—C—D in degrees from a SMILES string.
|
|
1806
|
+
* Returns null (JSON null) if any atom index is out of range or atoms are collinear.
|
|
1807
|
+
*
|
|
1808
|
+
* # Arguments
|
|
1809
|
+
* - `smiles`: SMILES string
|
|
1810
|
+
* - `a`, `b`, `c`, `d`: atom indices
|
|
1811
|
+
*
|
|
1812
|
+
* # Example
|
|
1813
|
+
* ```javascript
|
|
1814
|
+
* const dihedral = get_dihedral_json("CCCC", 0, 1, 2, 3); // A-B-C-D
|
|
1815
|
+
* ```
|
|
1816
|
+
* @param {string} smiles
|
|
1817
|
+
* @param {number} a
|
|
1818
|
+
* @param {number} b
|
|
1819
|
+
* @param {number} c
|
|
1820
|
+
* @param {number} d
|
|
1821
|
+
* @returns {any}
|
|
1822
|
+
*/
|
|
1823
|
+
export function get_dihedral_json(smiles, a, b, c, d) {
|
|
1824
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1825
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1826
|
+
const ret = wasm.get_dihedral_json(ptr0, len0, a, b, c, d);
|
|
1827
|
+
return ret;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1779
1830
|
/**
|
|
1780
1831
|
* Identify functional groups. Returns a JSON array of objects:
|
|
1781
1832
|
* `[{"atoms":[0,2,3],"type":"C,N,O"}, …]`
|
|
@@ -2693,6 +2744,47 @@ export function peoe_vsa_json(mol) {
|
|
|
2693
2744
|
}
|
|
2694
2745
|
}
|
|
2695
2746
|
|
|
2747
|
+
/**
|
|
2748
|
+
* Generate `count` random SMILES from a SMILES string using the given seed.
|
|
2749
|
+
* Atoms are permuted based on xorshift64 RNG. Each variant should parse back
|
|
2750
|
+
* to the same molecule. Returns a JSON array of SMILES strings.
|
|
2751
|
+
*
|
|
2752
|
+
* # Arguments
|
|
2753
|
+
* - `smiles`: input SMILES string
|
|
2754
|
+
* - `count`: number of variants to generate (capped at 100)
|
|
2755
|
+
* - `seed`: xorshift64 seed
|
|
2756
|
+
*
|
|
2757
|
+
* # Example
|
|
2758
|
+
* ```javascript
|
|
2759
|
+
* const variants = random_smiles_json("CC(C)O", 5, 42);
|
|
2760
|
+
* // variants: ["CC(C)O", "C(C)(O)C", ...]
|
|
2761
|
+
* ```
|
|
2762
|
+
* @param {string} smiles
|
|
2763
|
+
* @param {number} count
|
|
2764
|
+
* @param {bigint} seed
|
|
2765
|
+
* @returns {string}
|
|
2766
|
+
*/
|
|
2767
|
+
export function random_smiles_json(smiles, count, seed) {
|
|
2768
|
+
let deferred3_0;
|
|
2769
|
+
let deferred3_1;
|
|
2770
|
+
try {
|
|
2771
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2772
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2773
|
+
const ret = wasm.random_smiles_json(ptr0, len0, count, seed);
|
|
2774
|
+
var ptr2 = ret[0];
|
|
2775
|
+
var len2 = ret[1];
|
|
2776
|
+
if (ret[3]) {
|
|
2777
|
+
ptr2 = 0; len2 = 0;
|
|
2778
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2779
|
+
}
|
|
2780
|
+
deferred3_0 = ptr2;
|
|
2781
|
+
deferred3_1 = len2;
|
|
2782
|
+
return getStringFromWasm0(ptr2, len2);
|
|
2783
|
+
} finally {
|
|
2784
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2696
2788
|
/**
|
|
2697
2789
|
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
2698
2790
|
* @param {MolHandle} mol
|
|
@@ -2950,6 +3042,49 @@ export function sdf_to_smiles_json(sdf) {
|
|
|
2950
3042
|
}
|
|
2951
3043
|
}
|
|
2952
3044
|
|
|
3045
|
+
/**
|
|
3046
|
+
* Set dihedral angle A—B—C—D and return PDB block with modified coordinates.
|
|
3047
|
+
* Rotates the D-side subtree around the B—C bond.
|
|
3048
|
+
* Returns a JS error if parsing fails or atom indices are invalid.
|
|
3049
|
+
*
|
|
3050
|
+
* # Arguments
|
|
3051
|
+
* - `smiles`: SMILES string
|
|
3052
|
+
* - `a`, `b`, `c`, `d`: atom indices
|
|
3053
|
+
* - `angle_deg`: target dihedral angle in degrees
|
|
3054
|
+
*
|
|
3055
|
+
* # Example
|
|
3056
|
+
* ```javascript
|
|
3057
|
+
* const pdbBlock = set_dihedral_json("CCCC", 0, 1, 2, 3, 120.0);
|
|
3058
|
+
* ```
|
|
3059
|
+
* @param {string} smiles
|
|
3060
|
+
* @param {number} a
|
|
3061
|
+
* @param {number} b
|
|
3062
|
+
* @param {number} c
|
|
3063
|
+
* @param {number} d
|
|
3064
|
+
* @param {number} angle_deg
|
|
3065
|
+
* @returns {string}
|
|
3066
|
+
*/
|
|
3067
|
+
export function set_dihedral_json(smiles, a, b, c, d, angle_deg) {
|
|
3068
|
+
let deferred3_0;
|
|
3069
|
+
let deferred3_1;
|
|
3070
|
+
try {
|
|
3071
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3072
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3073
|
+
const ret = wasm.set_dihedral_json(ptr0, len0, a, b, c, d, angle_deg);
|
|
3074
|
+
var ptr2 = ret[0];
|
|
3075
|
+
var len2 = ret[1];
|
|
3076
|
+
if (ret[3]) {
|
|
3077
|
+
ptr2 = 0; len2 = 0;
|
|
3078
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3079
|
+
}
|
|
3080
|
+
deferred3_0 = ptr2;
|
|
3081
|
+
deferred3_1 = len2;
|
|
3082
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3083
|
+
} finally {
|
|
3084
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
|
|
2953
3088
|
/**
|
|
2954
3089
|
* 3D shape descriptors as a JSON object.
|
|
2955
3090
|
*
|
|
@@ -3525,7 +3660,12 @@ function __wbg_get_imports() {
|
|
|
3525
3660
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3526
3661
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3527
3662
|
},
|
|
3528
|
-
__wbindgen_cast_0000000000000001: function(arg0
|
|
3663
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
3664
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
3665
|
+
const ret = arg0;
|
|
3666
|
+
return ret;
|
|
3667
|
+
},
|
|
3668
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
3529
3669
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
3530
3670
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
3531
3671
|
return ret;
|
package/chematic_wasm_bg.wasm
CHANGED
|
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.1.
|
|
8
|
+
"version": "0.1.38",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|