@kent-tokyo/chematic 0.4.30 → 0.5.0
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 +46 -2
- package/chematic_wasm.js +76 -2
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/chematic_wasm.d.ts
CHANGED
|
@@ -1199,7 +1199,33 @@ export function mmff94_charges_json(mol: MolHandle): string;
|
|
|
1199
1199
|
export function mmff94_charges_typed_json(mol: MolHandle): string;
|
|
1200
1200
|
|
|
1201
1201
|
/**
|
|
1202
|
-
* Compute MMFF94 energy breakdown for
|
|
1202
|
+
* Compute MMFF94 energy breakdown for EXPLICIT, caller-supplied 3D
|
|
1203
|
+
* coordinates -- unlike `mmff94_energy_breakdown_json`, this reads the
|
|
1204
|
+
* geometry the caller actually has (e.g. from `pdb_coords_json`,
|
|
1205
|
+
* `generate_3d_coords_json`, `generate_3d_etkdg_coords_json`, or an
|
|
1206
|
+
* externally computed conformer) instead of silently generating a fresh
|
|
1207
|
+
* rule-based one, matching the Python binding's
|
|
1208
|
+
* `mol.mmff94_energy_breakdown(coords)` contract (issue #90).
|
|
1209
|
+
*
|
|
1210
|
+
* `coords_json` -- JSON array of `[x,y,z]` arrays (Å), one per heavy atom,
|
|
1211
|
+
* in the same atom order as `mol`.
|
|
1212
|
+
*
|
|
1213
|
+
* Returns JSON `{"bond":B,"angle":A,"stretch_bend":S,"torsion":T,"oop":O,
|
|
1214
|
+
* "vdw":V,"electrostatic":E,"total":X}` at full `f64` round-trip precision
|
|
1215
|
+
* (not rounded -- this API exists specifically for oracle comparison
|
|
1216
|
+
* against the Python binding, where 4-decimal rounding would mask
|
|
1217
|
+
* sub-1e-4 discrepancies), or `{"error":"<msg>"}` on malformed JSON, a
|
|
1218
|
+
* non-finite coordinate, or a coordinate-count/atom-count mismatch. Never
|
|
1219
|
+
* falls back to a generated conformer.
|
|
1220
|
+
*/
|
|
1221
|
+
export function mmff94_energy_breakdown_from_coords_json(mol: MolHandle, coords_json: string): string;
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Computes energy on an internally generated conformer.
|
|
1225
|
+
* `MolHandle` stores topology only; coordinates previously read from PDB/XYZ
|
|
1226
|
+
* are not used by this function.
|
|
1227
|
+
* Use [`mmff94_energy_breakdown_from_coords_json`] for explicit coordinates.
|
|
1228
|
+
*
|
|
1203
1229
|
* Returns JSON: {"bond":B,"angle":A,"torsion":T,"vdw":V,"elec":E,"total":X} or {"error":"..."}.
|
|
1204
1230
|
*/
|
|
1205
1231
|
export function mmff94_energy_breakdown_json(mol: MolHandle): string;
|
|
@@ -1279,7 +1305,10 @@ export function mol_from_cml(cml: string): MolHandle;
|
|
|
1279
1305
|
export function mol_from_moljson(json: string): MolHandle;
|
|
1280
1306
|
|
|
1281
1307
|
/**
|
|
1282
|
-
* Parse a PDB file and return a `MolHandle` (topology only; coordinates are
|
|
1308
|
+
* Parse a PDB file and return a `MolHandle` (topology only; coordinates are
|
|
1309
|
+
* discarded -- use [`pdb_coords_json`] to recover them in the SAME atom
|
|
1310
|
+
* order, and [`mmff94_energy_breakdown_from_coords_json`] to score them
|
|
1311
|
+
* without chematic regenerating a fresh conformer).
|
|
1283
1312
|
*
|
|
1284
1313
|
* Uses CONECT records for connectivity if present; otherwise infers bonds from
|
|
1285
1314
|
* atom distances (the same heuristic as the internal `pdb_to_molecule` function).
|
|
@@ -1450,6 +1479,19 @@ export function parse_cxsmiles_json(s: string): string;
|
|
|
1450
1479
|
*/
|
|
1451
1480
|
export function parse_smiles(s: string): MolHandle;
|
|
1452
1481
|
|
|
1482
|
+
/**
|
|
1483
|
+
* Extract the atomic coordinates from a PDB block, in the SAME atom order
|
|
1484
|
+
* `mol_from_pdb` returns topology for (both read the identical underlying
|
|
1485
|
+
* parse via `parse_pdb_molecule_and_coords`, so atom-index correspondence
|
|
1486
|
+
* between the two calls is structural, not just conventional -- issue #90).
|
|
1487
|
+
*
|
|
1488
|
+
* Returns JSON `[[x,y,z],...]` (full `f64` precision, not rounded -- for
|
|
1489
|
+
* oracle comparison against the Python binding) or `{"error":"<msg>"}` --
|
|
1490
|
+
* including when a coordinate field parsed to a non-finite value (see
|
|
1491
|
+
* `coords_all_finite`'s doc comment), rather than emitting invalid JSON.
|
|
1492
|
+
*/
|
|
1493
|
+
export function pdb_coords_json(pdb: string): string;
|
|
1494
|
+
|
|
1453
1495
|
/**
|
|
1454
1496
|
* PEOE_VSA descriptors (14 bins) as a JSON array.
|
|
1455
1497
|
*/
|
|
@@ -1987,6 +2029,7 @@ export interface InitOutput {
|
|
|
1987
2029
|
readonly minimize_uff_json: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1988
2030
|
readonly mmff94_charges_json: (a: number) => [number, number];
|
|
1989
2031
|
readonly mmff94_charges_typed_json: (a: number) => [number, number];
|
|
2032
|
+
readonly mmff94_energy_breakdown_from_coords_json: (a: number, b: number, c: number) => [number, number];
|
|
1990
2033
|
readonly mmff94_energy_breakdown_json: (a: number) => [number, number];
|
|
1991
2034
|
readonly mmff94_partial_charges_json: (a: number) => [number, number];
|
|
1992
2035
|
readonly mmp_pairs_json: (a: number, b: number) => [number, number, number, number];
|
|
@@ -2091,6 +2134,7 @@ export interface InitOutput {
|
|
|
2091
2134
|
readonly parse_cxsmarts_json: (a: number, b: number) => [number, number, number, number];
|
|
2092
2135
|
readonly parse_cxsmiles_json: (a: number, b: number) => [number, number, number, number];
|
|
2093
2136
|
readonly parse_smiles: (a: number, b: number) => [number, number, number];
|
|
2137
|
+
readonly pdb_coords_json: (a: number, b: number) => [number, number];
|
|
2094
2138
|
readonly peoe_vsa_json: (a: number) => [number, number];
|
|
2095
2139
|
readonly pharmacophore_features_json: (a: number) => [number, number];
|
|
2096
2140
|
readonly pharmacophore_fp_2d_summary: (a: number) => [number, number];
|
package/chematic_wasm.js
CHANGED
|
@@ -2970,7 +2970,50 @@ export function mmff94_charges_typed_json(mol) {
|
|
|
2970
2970
|
}
|
|
2971
2971
|
|
|
2972
2972
|
/**
|
|
2973
|
-
* Compute MMFF94 energy breakdown for
|
|
2973
|
+
* Compute MMFF94 energy breakdown for EXPLICIT, caller-supplied 3D
|
|
2974
|
+
* coordinates -- unlike `mmff94_energy_breakdown_json`, this reads the
|
|
2975
|
+
* geometry the caller actually has (e.g. from `pdb_coords_json`,
|
|
2976
|
+
* `generate_3d_coords_json`, `generate_3d_etkdg_coords_json`, or an
|
|
2977
|
+
* externally computed conformer) instead of silently generating a fresh
|
|
2978
|
+
* rule-based one, matching the Python binding's
|
|
2979
|
+
* `mol.mmff94_energy_breakdown(coords)` contract (issue #90).
|
|
2980
|
+
*
|
|
2981
|
+
* `coords_json` -- JSON array of `[x,y,z]` arrays (Å), one per heavy atom,
|
|
2982
|
+
* in the same atom order as `mol`.
|
|
2983
|
+
*
|
|
2984
|
+
* Returns JSON `{"bond":B,"angle":A,"stretch_bend":S,"torsion":T,"oop":O,
|
|
2985
|
+
* "vdw":V,"electrostatic":E,"total":X}` at full `f64` round-trip precision
|
|
2986
|
+
* (not rounded -- this API exists specifically for oracle comparison
|
|
2987
|
+
* against the Python binding, where 4-decimal rounding would mask
|
|
2988
|
+
* sub-1e-4 discrepancies), or `{"error":"<msg>"}` on malformed JSON, a
|
|
2989
|
+
* non-finite coordinate, or a coordinate-count/atom-count mismatch. Never
|
|
2990
|
+
* falls back to a generated conformer.
|
|
2991
|
+
* @param {MolHandle} mol
|
|
2992
|
+
* @param {string} coords_json
|
|
2993
|
+
* @returns {string}
|
|
2994
|
+
*/
|
|
2995
|
+
export function mmff94_energy_breakdown_from_coords_json(mol, coords_json) {
|
|
2996
|
+
let deferred2_0;
|
|
2997
|
+
let deferred2_1;
|
|
2998
|
+
try {
|
|
2999
|
+
_assertClass(mol, MolHandle);
|
|
3000
|
+
const ptr0 = passStringToWasm0(coords_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3001
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3002
|
+
const ret = wasm.mmff94_energy_breakdown_from_coords_json(mol.__wbg_ptr, ptr0, len0);
|
|
3003
|
+
deferred2_0 = ret[0];
|
|
3004
|
+
deferred2_1 = ret[1];
|
|
3005
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3006
|
+
} finally {
|
|
3007
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
/**
|
|
3012
|
+
* Computes energy on an internally generated conformer.
|
|
3013
|
+
* `MolHandle` stores topology only; coordinates previously read from PDB/XYZ
|
|
3014
|
+
* are not used by this function.
|
|
3015
|
+
* Use [`mmff94_energy_breakdown_from_coords_json`] for explicit coordinates.
|
|
3016
|
+
*
|
|
2974
3017
|
* Returns JSON: {"bond":B,"angle":A,"torsion":T,"vdw":V,"elec":E,"total":X} or {"error":"..."}.
|
|
2975
3018
|
* @param {MolHandle} mol
|
|
2976
3019
|
* @returns {string}
|
|
@@ -3186,7 +3229,10 @@ export function mol_from_moljson(json) {
|
|
|
3186
3229
|
}
|
|
3187
3230
|
|
|
3188
3231
|
/**
|
|
3189
|
-
* Parse a PDB file and return a `MolHandle` (topology only; coordinates are
|
|
3232
|
+
* Parse a PDB file and return a `MolHandle` (topology only; coordinates are
|
|
3233
|
+
* discarded -- use [`pdb_coords_json`] to recover them in the SAME atom
|
|
3234
|
+
* order, and [`mmff94_energy_breakdown_from_coords_json`] to score them
|
|
3235
|
+
* without chematic regenerating a fresh conformer).
|
|
3190
3236
|
*
|
|
3191
3237
|
* Uses CONECT records for connectivity if present; otherwise infers bonds from
|
|
3192
3238
|
* atom distances (the same heuristic as the internal `pdb_to_molecule` function).
|
|
@@ -3656,6 +3702,34 @@ export function parse_smiles(s) {
|
|
|
3656
3702
|
return MolHandle.__wrap(ret[0]);
|
|
3657
3703
|
}
|
|
3658
3704
|
|
|
3705
|
+
/**
|
|
3706
|
+
* Extract the atomic coordinates from a PDB block, in the SAME atom order
|
|
3707
|
+
* `mol_from_pdb` returns topology for (both read the identical underlying
|
|
3708
|
+
* parse via `parse_pdb_molecule_and_coords`, so atom-index correspondence
|
|
3709
|
+
* between the two calls is structural, not just conventional -- issue #90).
|
|
3710
|
+
*
|
|
3711
|
+
* Returns JSON `[[x,y,z],...]` (full `f64` precision, not rounded -- for
|
|
3712
|
+
* oracle comparison against the Python binding) or `{"error":"<msg>"}` --
|
|
3713
|
+
* including when a coordinate field parsed to a non-finite value (see
|
|
3714
|
+
* `coords_all_finite`'s doc comment), rather than emitting invalid JSON.
|
|
3715
|
+
* @param {string} pdb
|
|
3716
|
+
* @returns {string}
|
|
3717
|
+
*/
|
|
3718
|
+
export function pdb_coords_json(pdb) {
|
|
3719
|
+
let deferred2_0;
|
|
3720
|
+
let deferred2_1;
|
|
3721
|
+
try {
|
|
3722
|
+
const ptr0 = passStringToWasm0(pdb, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3723
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3724
|
+
const ret = wasm.pdb_coords_json(ptr0, len0);
|
|
3725
|
+
deferred2_0 = ret[0];
|
|
3726
|
+
deferred2_1 = ret[1];
|
|
3727
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3728
|
+
} finally {
|
|
3729
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3659
3733
|
/**
|
|
3660
3734
|
* PEOE_VSA descriptors (14 bins) as a JSON array.
|
|
3661
3735
|
* @param {MolHandle} mol
|
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.
|
|
8
|
+
"version": "0.5.0",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|