@kent-tokyo/chematic 0.4.29 → 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 +68 -2
- package/chematic_wasm.js +124 -2
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/chematic_wasm.d.ts
CHANGED
|
@@ -593,6 +593,17 @@ export function canonical_tautomer_with_blocked_atoms_json(mol: MolHandle, block
|
|
|
593
593
|
*/
|
|
594
594
|
export function cdxml_to_smiles_json(cdxml: string): string;
|
|
595
595
|
|
|
596
|
+
/**
|
|
597
|
+
* CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
|
|
598
|
+
* array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
|
|
599
|
+
* but merges the accurate engine's tetrahedral R/S (~99.6% oracle-stable agreement,
|
|
600
|
+
* see `docs/cip_accurate_rfc.md`) with legacy's E/Z and allene answers (the accurate
|
|
601
|
+
* engine computes neither). Atoms it can't resolve are omitted here -- see
|
|
602
|
+
* [`cip_unresolved_json`] -- never a silently-guessed label. Returns `"null"` on an
|
|
603
|
+
* internal engine error (budget-independent computations should not normally hit this).
|
|
604
|
+
*/
|
|
605
|
+
export function cip_assignments_accurate_json(mol: MolHandle): string;
|
|
606
|
+
|
|
596
607
|
/**
|
|
597
608
|
* CIP stereo assignments as a JSON array of `{atomIdx, cipCode}` objects.
|
|
598
609
|
*
|
|
@@ -601,6 +612,15 @@ export function cdxml_to_smiles_json(cdxml: string): string;
|
|
|
601
612
|
*/
|
|
602
613
|
export function cip_assignments_json(mol: MolHandle): string;
|
|
603
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Atoms the accurate CIP engine could not resolve a tetrahedral R/S for, as a JSON
|
|
617
|
+
* array of `{atomIdx, reason}` objects. `reason` is `"tied"` (a genuine CIP-rule tie,
|
|
618
|
+
* not a missing rule) or `"budgetExceeded"`. Always `[]` for the legacy engine (see
|
|
619
|
+
* [`cip_assignments_json`]) -- it never reports "I don't know". Returns `"null"` on
|
|
620
|
+
* an internal engine error.
|
|
621
|
+
*/
|
|
622
|
+
export function cip_unresolved_json(mol: MolHandle): string;
|
|
623
|
+
|
|
604
624
|
/**
|
|
605
625
|
* Compare multiple SMILES strings (up to 256 by default).
|
|
606
626
|
* Accepts a delimiter-separated list (e.g., newline or comma).
|
|
@@ -1179,7 +1199,33 @@ export function mmff94_charges_json(mol: MolHandle): string;
|
|
|
1179
1199
|
export function mmff94_charges_typed_json(mol: MolHandle): string;
|
|
1180
1200
|
|
|
1181
1201
|
/**
|
|
1182
|
-
* 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
|
+
*
|
|
1183
1229
|
* Returns JSON: {"bond":B,"angle":A,"torsion":T,"vdw":V,"elec":E,"total":X} or {"error":"..."}.
|
|
1184
1230
|
*/
|
|
1185
1231
|
export function mmff94_energy_breakdown_json(mol: MolHandle): string;
|
|
@@ -1259,7 +1305,10 @@ export function mol_from_cml(cml: string): MolHandle;
|
|
|
1259
1305
|
export function mol_from_moljson(json: string): MolHandle;
|
|
1260
1306
|
|
|
1261
1307
|
/**
|
|
1262
|
-
* 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).
|
|
1263
1312
|
*
|
|
1264
1313
|
* Uses CONECT records for connectivity if present; otherwise infers bonds from
|
|
1265
1314
|
* atom distances (the same heuristic as the internal `pdb_to_molecule` function).
|
|
@@ -1430,6 +1479,19 @@ export function parse_cxsmiles_json(s: string): string;
|
|
|
1430
1479
|
*/
|
|
1431
1480
|
export function parse_smiles(s: string): MolHandle;
|
|
1432
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
|
+
|
|
1433
1495
|
/**
|
|
1434
1496
|
* PEOE_VSA descriptors (14 bins) as a JSON array.
|
|
1435
1497
|
*/
|
|
@@ -1872,7 +1934,9 @@ export interface InitOutput {
|
|
|
1872
1934
|
readonly canonical_tautomer: (a: number) => number;
|
|
1873
1935
|
readonly canonical_tautomer_with_blocked_atoms_json: (a: number, b: number, c: number) => [number, number];
|
|
1874
1936
|
readonly cdxml_to_smiles_json: (a: number, b: number) => [number, number, number, number];
|
|
1937
|
+
readonly cip_assignments_accurate_json: (a: number) => [number, number];
|
|
1875
1938
|
readonly cip_assignments_json: (a: number) => [number, number];
|
|
1939
|
+
readonly cip_unresolved_json: (a: number) => [number, number];
|
|
1876
1940
|
readonly compare_molecules_batch_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1877
1941
|
readonly compare_molecules_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1878
1942
|
readonly conformer_ensemble_json: (a: number, b: number, c: number) => [number, number];
|
|
@@ -1965,6 +2029,7 @@ export interface InitOutput {
|
|
|
1965
2029
|
readonly minimize_uff_json: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1966
2030
|
readonly mmff94_charges_json: (a: number) => [number, number];
|
|
1967
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];
|
|
1968
2033
|
readonly mmff94_energy_breakdown_json: (a: number) => [number, number];
|
|
1969
2034
|
readonly mmff94_partial_charges_json: (a: number) => [number, number];
|
|
1970
2035
|
readonly mmp_pairs_json: (a: number, b: number) => [number, number, number, number];
|
|
@@ -2069,6 +2134,7 @@ export interface InitOutput {
|
|
|
2069
2134
|
readonly parse_cxsmarts_json: (a: number, b: number) => [number, number, number, number];
|
|
2070
2135
|
readonly parse_cxsmiles_json: (a: number, b: number) => [number, number, number, number];
|
|
2071
2136
|
readonly parse_smiles: (a: number, b: number) => [number, number, number];
|
|
2137
|
+
readonly pdb_coords_json: (a: number, b: number) => [number, number];
|
|
2072
2138
|
readonly peoe_vsa_json: (a: number) => [number, number];
|
|
2073
2139
|
readonly pharmacophore_features_json: (a: number) => [number, number];
|
|
2074
2140
|
readonly pharmacophore_fp_2d_summary: (a: number) => [number, number];
|
package/chematic_wasm.js
CHANGED
|
@@ -1398,6 +1398,31 @@ export function cdxml_to_smiles_json(cdxml) {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
1400
|
|
|
1401
|
+
/**
|
|
1402
|
+
* CIP stereo assignments via the accurate hierarchical-digraph engine, as a JSON
|
|
1403
|
+
* array of `{atomIdx, cipCode}` objects -- same shape as [`cip_assignments_json`],
|
|
1404
|
+
* but merges the accurate engine's tetrahedral R/S (~99.6% oracle-stable agreement,
|
|
1405
|
+
* see `docs/cip_accurate_rfc.md`) with legacy's E/Z and allene answers (the accurate
|
|
1406
|
+
* engine computes neither). Atoms it can't resolve are omitted here -- see
|
|
1407
|
+
* [`cip_unresolved_json`] -- never a silently-guessed label. Returns `"null"` on an
|
|
1408
|
+
* internal engine error (budget-independent computations should not normally hit this).
|
|
1409
|
+
* @param {MolHandle} mol
|
|
1410
|
+
* @returns {string}
|
|
1411
|
+
*/
|
|
1412
|
+
export function cip_assignments_accurate_json(mol) {
|
|
1413
|
+
let deferred1_0;
|
|
1414
|
+
let deferred1_1;
|
|
1415
|
+
try {
|
|
1416
|
+
_assertClass(mol, MolHandle);
|
|
1417
|
+
const ret = wasm.cip_assignments_accurate_json(mol.__wbg_ptr);
|
|
1418
|
+
deferred1_0 = ret[0];
|
|
1419
|
+
deferred1_1 = ret[1];
|
|
1420
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1421
|
+
} finally {
|
|
1422
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1401
1426
|
/**
|
|
1402
1427
|
* CIP stereo assignments as a JSON array of `{atomIdx, cipCode}` objects.
|
|
1403
1428
|
*
|
|
@@ -1420,6 +1445,29 @@ export function cip_assignments_json(mol) {
|
|
|
1420
1445
|
}
|
|
1421
1446
|
}
|
|
1422
1447
|
|
|
1448
|
+
/**
|
|
1449
|
+
* Atoms the accurate CIP engine could not resolve a tetrahedral R/S for, as a JSON
|
|
1450
|
+
* array of `{atomIdx, reason}` objects. `reason` is `"tied"` (a genuine CIP-rule tie,
|
|
1451
|
+
* not a missing rule) or `"budgetExceeded"`. Always `[]` for the legacy engine (see
|
|
1452
|
+
* [`cip_assignments_json`]) -- it never reports "I don't know". Returns `"null"` on
|
|
1453
|
+
* an internal engine error.
|
|
1454
|
+
* @param {MolHandle} mol
|
|
1455
|
+
* @returns {string}
|
|
1456
|
+
*/
|
|
1457
|
+
export function cip_unresolved_json(mol) {
|
|
1458
|
+
let deferred1_0;
|
|
1459
|
+
let deferred1_1;
|
|
1460
|
+
try {
|
|
1461
|
+
_assertClass(mol, MolHandle);
|
|
1462
|
+
const ret = wasm.cip_unresolved_json(mol.__wbg_ptr);
|
|
1463
|
+
deferred1_0 = ret[0];
|
|
1464
|
+
deferred1_1 = ret[1];
|
|
1465
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1466
|
+
} finally {
|
|
1467
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1423
1471
|
/**
|
|
1424
1472
|
* Compare multiple SMILES strings (up to 256 by default).
|
|
1425
1473
|
* Accepts a delimiter-separated list (e.g., newline or comma).
|
|
@@ -2922,7 +2970,50 @@ export function mmff94_charges_typed_json(mol) {
|
|
|
2922
2970
|
}
|
|
2923
2971
|
|
|
2924
2972
|
/**
|
|
2925
|
-
* 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
|
+
*
|
|
2926
3017
|
* Returns JSON: {"bond":B,"angle":A,"torsion":T,"vdw":V,"elec":E,"total":X} or {"error":"..."}.
|
|
2927
3018
|
* @param {MolHandle} mol
|
|
2928
3019
|
* @returns {string}
|
|
@@ -3138,7 +3229,10 @@ export function mol_from_moljson(json) {
|
|
|
3138
3229
|
}
|
|
3139
3230
|
|
|
3140
3231
|
/**
|
|
3141
|
-
* 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).
|
|
3142
3236
|
*
|
|
3143
3237
|
* Uses CONECT records for connectivity if present; otherwise infers bonds from
|
|
3144
3238
|
* atom distances (the same heuristic as the internal `pdb_to_molecule` function).
|
|
@@ -3608,6 +3702,34 @@ export function parse_smiles(s) {
|
|
|
3608
3702
|
return MolHandle.__wrap(ret[0]);
|
|
3609
3703
|
}
|
|
3610
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
|
+
|
|
3611
3733
|
/**
|
|
3612
3734
|
* PEOE_VSA descriptors (14 bins) as a JSON array.
|
|
3613
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",
|