@kent-tokyo/chematic 1.0.3 → 1.0.5
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 +1 -21
- package/chematic_wasm.d.ts +41 -0
- package/chematic_wasm.js +170 -0
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,29 +160,9 @@ portable across native and `wasm32-unknown-unknown`
|
|
|
160
160
|
precision across every JS engine, only that the value is finite, non-negative,
|
|
161
161
|
and enforced correctly on all of them.
|
|
162
162
|
|
|
163
|
-
## Version History
|
|
164
|
-
|
|
165
|
-
**v0.1.94** (2026-06-12):
|
|
166
|
-
- SA Score corpus expanded: 188 FDA molecules (1415 unique fragments)
|
|
167
|
-
- Enhanced fingerprints: True MHFP, True ERG, path FP with bond types
|
|
168
|
-
- Full multi-sphere CIP stereochemistry for R/S assignment
|
|
169
|
-
- InChI stereo layer round-trip support (tetrahedral and E/Z)
|
|
170
|
-
|
|
171
|
-
**v0.1.93** (2026-06-12):
|
|
172
|
-
- Full multi-sphere CIP priority rules
|
|
173
|
-
- Correct stereochemistry assignment for complex chiral centers
|
|
174
|
-
|
|
175
|
-
**v0.1.92** (2026-06-12):
|
|
176
|
-
- InChI stereo layer parsing (tetrahedral `/t` and E/Z `/b`)
|
|
177
|
-
- Path fingerprint with bond type interleaving
|
|
178
|
-
|
|
179
|
-
**v0.1.91** (2026-06-12):
|
|
180
|
-
- True MHFP (structural fragment hashing)
|
|
181
|
-
- True ERG (Ertl 2017 functional group detection)
|
|
182
|
-
|
|
183
163
|
## Bundle Size
|
|
184
164
|
|
|
185
|
-
|
|
165
|
+
The optimized v1.0.2-candidate artifact was measured at **3.30 MB raw / 1.21 MB gzip**. Bundle size depends on features and toolchain; see [`benchmarks/2026-09-04-wasm-size.md`](../../benchmarks/2026-09-04-wasm-size.md) for exact tools, digest, and reproduction steps.
|
|
186
166
|
|
|
187
167
|
PNG rasterization (`tiny_skia`) is excluded from the WASM build — use SVG output instead. All SVG depiction APIs remain fully available.
|
|
188
168
|
|
package/chematic_wasm.d.ts
CHANGED
|
@@ -856,6 +856,13 @@ export function ecfp6_bitvec_with_chirality(mol: MolHandle, use_chirality: boole
|
|
|
856
856
|
*/
|
|
857
857
|
export function ecfp_bitvec_custom(mol: MolHandle, radius: number, nbits: number, use_chirality: boolean): Uint8Array;
|
|
858
858
|
|
|
859
|
+
/**
|
|
860
|
+
* Apply a loss-preserving page/presentation edit to a CDXML document.
|
|
861
|
+
* `edit_json` is a `CdxmlEdit` command object; unknown presentation XML is
|
|
862
|
+
* retained and the result is reparsed before it is returned.
|
|
863
|
+
*/
|
|
864
|
+
export function edit_cdxml_document_json(cdxml: string, edit_json: string): string;
|
|
865
|
+
|
|
859
866
|
/**
|
|
860
867
|
* Run `embed_ensemble_v2` on `mol`'s own atom order (never canonicalizes/
|
|
861
868
|
* reparses, same convention as `embed_pipeline_v2_json`). See the module doc
|
|
@@ -2152,6 +2159,18 @@ export function ring_families_json(mol: MolHandle): string;
|
|
|
2152
2159
|
*/
|
|
2153
2160
|
export function run_reactants(smirks: string, reactants_smiles: string): string;
|
|
2154
2161
|
|
|
2162
|
+
/**
|
|
2163
|
+
* Parse an MDL RXN V2000 file into the typed reaction-document JSON
|
|
2164
|
+
* contract shared with the Rust and Python bindings.
|
|
2165
|
+
*/
|
|
2166
|
+
export function rxn_document_from_rxn(text: string): string;
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Write typed reaction-document JSON as MDL RXN V2000. Unsupported rich
|
|
2170
|
+
* fields return an error instead of being silently discarded.
|
|
2171
|
+
*/
|
|
2172
|
+
export function rxn_document_to_rxn(document_json: string): string;
|
|
2173
|
+
|
|
2155
2174
|
/**
|
|
2156
2175
|
* Synthetic Accessibility Score (1 = easy, 10 = hard).
|
|
2157
2176
|
*/
|
|
@@ -2218,6 +2237,22 @@ export function sdf_to_records_json(sdf: string): string;
|
|
|
2218
2237
|
*/
|
|
2219
2238
|
export function sdf_to_smiles_json(sdf: string): string;
|
|
2220
2239
|
|
|
2240
|
+
/**
|
|
2241
|
+
* Apply an explicit Markush selection command to a semantic model JSON.
|
|
2242
|
+
*/
|
|
2243
|
+
export function semantic_apply_json_command(model_json: string, command_json: string): string;
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Expand a validated semantic model against a base SMILES and return the
|
|
2247
|
+
* expanded graph plus source-to-expanded atom mapping.
|
|
2248
|
+
*/
|
|
2249
|
+
export function semantic_expand_json(base_smiles: string, model_json: string): string;
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Validate and normalize a typed Markush/polymer semantic model JSON.
|
|
2253
|
+
*/
|
|
2254
|
+
export function semantic_model_json(model_json: string): string;
|
|
2255
|
+
|
|
2221
2256
|
/**
|
|
2222
2257
|
* Set dihedral angle A—B—C—D and return PDB block with modified coordinates.
|
|
2223
2258
|
* Rotates the D-side subtree around the B—C bond.
|
|
@@ -2681,6 +2716,7 @@ export interface InitOutput {
|
|
|
2681
2716
|
readonly ecfp6_bitvec: (a: number) => [number, number];
|
|
2682
2717
|
readonly ecfp6_bitvec_with_chirality: (a: number, b: number) => [number, number];
|
|
2683
2718
|
readonly ecfp_bitvec_custom: (a: number, b: number, c: number, d: number) => [number, number];
|
|
2719
|
+
readonly edit_cdxml_document_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2684
2720
|
readonly embed_ensemble_v2_json: (a: number, b: number, c: number) => [number, number];
|
|
2685
2721
|
readonly embed_pipeline_v2_json: (a: number, b: number, c: number) => [number, number];
|
|
2686
2722
|
readonly enumerate_library_2way: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
@@ -2890,11 +2926,16 @@ export interface InitOutput {
|
|
|
2890
2926
|
readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2891
2927
|
readonly ring_families_json: (a: number) => [number, number, number, number];
|
|
2892
2928
|
readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2929
|
+
readonly rxn_document_from_rxn: (a: number, b: number) => [number, number, number, number];
|
|
2930
|
+
readonly rxn_document_to_rxn: (a: number, b: number) => [number, number, number, number];
|
|
2893
2931
|
readonly sa_score: (a: number) => number;
|
|
2894
2932
|
readonly screen_smiles_json: (a: number, b: number, c: number, d: number) => [number, number];
|
|
2895
2933
|
readonly sdf_from_records_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2896
2934
|
readonly sdf_to_records_json: (a: number, b: number) => [number, number];
|
|
2897
2935
|
readonly sdf_to_smiles_json: (a: number, b: number) => [number, number];
|
|
2936
|
+
readonly semantic_apply_json_command: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2937
|
+
readonly semantic_expand_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2938
|
+
readonly semantic_model_json: (a: number, b: number) => [number, number, number, number];
|
|
2898
2939
|
readonly set_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
2899
2940
|
readonly shape_descriptors_json: (a: number) => [number, number];
|
|
2900
2941
|
readonly slogp_vsa_json: (a: number) => [number, number];
|
package/chematic_wasm.js
CHANGED
|
@@ -2067,6 +2067,37 @@ export function ecfp_bitvec_custom(mol, radius, nbits, use_chirality) {
|
|
|
2067
2067
|
return v1;
|
|
2068
2068
|
}
|
|
2069
2069
|
|
|
2070
|
+
/**
|
|
2071
|
+
* Apply a loss-preserving page/presentation edit to a CDXML document.
|
|
2072
|
+
* `edit_json` is a `CdxmlEdit` command object; unknown presentation XML is
|
|
2073
|
+
* retained and the result is reparsed before it is returned.
|
|
2074
|
+
* @param {string} cdxml
|
|
2075
|
+
* @param {string} edit_json
|
|
2076
|
+
* @returns {string}
|
|
2077
|
+
*/
|
|
2078
|
+
export function edit_cdxml_document_json(cdxml, edit_json) {
|
|
2079
|
+
let deferred4_0;
|
|
2080
|
+
let deferred4_1;
|
|
2081
|
+
try {
|
|
2082
|
+
const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2083
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2084
|
+
const ptr1 = passStringToWasm0(edit_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2085
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2086
|
+
const ret = wasm.edit_cdxml_document_json(ptr0, len0, ptr1, len1);
|
|
2087
|
+
var ptr3 = ret[0];
|
|
2088
|
+
var len3 = ret[1];
|
|
2089
|
+
if (ret[3]) {
|
|
2090
|
+
ptr3 = 0; len3 = 0;
|
|
2091
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2092
|
+
}
|
|
2093
|
+
deferred4_0 = ptr3;
|
|
2094
|
+
deferred4_1 = len3;
|
|
2095
|
+
return getStringFromWasm0(ptr3, len3);
|
|
2096
|
+
} finally {
|
|
2097
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2070
2101
|
/**
|
|
2071
2102
|
* Run `embed_ensemble_v2` on `mol`'s own atom order (never canonicalizes/
|
|
2072
2103
|
* reparses, same convention as `embed_pipeline_v2_json`). See the module doc
|
|
@@ -5401,6 +5432,60 @@ export function run_reactants(smirks, reactants_smiles) {
|
|
|
5401
5432
|
}
|
|
5402
5433
|
}
|
|
5403
5434
|
|
|
5435
|
+
/**
|
|
5436
|
+
* Parse an MDL RXN V2000 file into the typed reaction-document JSON
|
|
5437
|
+
* contract shared with the Rust and Python bindings.
|
|
5438
|
+
* @param {string} text
|
|
5439
|
+
* @returns {string}
|
|
5440
|
+
*/
|
|
5441
|
+
export function rxn_document_from_rxn(text) {
|
|
5442
|
+
let deferred3_0;
|
|
5443
|
+
let deferred3_1;
|
|
5444
|
+
try {
|
|
5445
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5446
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5447
|
+
const ret = wasm.rxn_document_from_rxn(ptr0, len0);
|
|
5448
|
+
var ptr2 = ret[0];
|
|
5449
|
+
var len2 = ret[1];
|
|
5450
|
+
if (ret[3]) {
|
|
5451
|
+
ptr2 = 0; len2 = 0;
|
|
5452
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5453
|
+
}
|
|
5454
|
+
deferred3_0 = ptr2;
|
|
5455
|
+
deferred3_1 = len2;
|
|
5456
|
+
return getStringFromWasm0(ptr2, len2);
|
|
5457
|
+
} finally {
|
|
5458
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5462
|
+
/**
|
|
5463
|
+
* Write typed reaction-document JSON as MDL RXN V2000. Unsupported rich
|
|
5464
|
+
* fields return an error instead of being silently discarded.
|
|
5465
|
+
* @param {string} document_json
|
|
5466
|
+
* @returns {string}
|
|
5467
|
+
*/
|
|
5468
|
+
export function rxn_document_to_rxn(document_json) {
|
|
5469
|
+
let deferred3_0;
|
|
5470
|
+
let deferred3_1;
|
|
5471
|
+
try {
|
|
5472
|
+
const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5473
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5474
|
+
const ret = wasm.rxn_document_to_rxn(ptr0, len0);
|
|
5475
|
+
var ptr2 = ret[0];
|
|
5476
|
+
var len2 = ret[1];
|
|
5477
|
+
if (ret[3]) {
|
|
5478
|
+
ptr2 = 0; len2 = 0;
|
|
5479
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5480
|
+
}
|
|
5481
|
+
deferred3_0 = ptr2;
|
|
5482
|
+
deferred3_1 = len2;
|
|
5483
|
+
return getStringFromWasm0(ptr2, len2);
|
|
5484
|
+
} finally {
|
|
5485
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5404
5489
|
/**
|
|
5405
5490
|
* Synthetic Accessibility Score (1 = easy, 10 = hard).
|
|
5406
5491
|
* @param {MolHandle} mol
|
|
@@ -5548,6 +5633,91 @@ export function sdf_to_smiles_json(sdf) {
|
|
|
5548
5633
|
}
|
|
5549
5634
|
}
|
|
5550
5635
|
|
|
5636
|
+
/**
|
|
5637
|
+
* Apply an explicit Markush selection command to a semantic model JSON.
|
|
5638
|
+
* @param {string} model_json
|
|
5639
|
+
* @param {string} command_json
|
|
5640
|
+
* @returns {string}
|
|
5641
|
+
*/
|
|
5642
|
+
export function semantic_apply_json_command(model_json, command_json) {
|
|
5643
|
+
let deferred4_0;
|
|
5644
|
+
let deferred4_1;
|
|
5645
|
+
try {
|
|
5646
|
+
const ptr0 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5647
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5648
|
+
const ptr1 = passStringToWasm0(command_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5649
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5650
|
+
const ret = wasm.semantic_apply_json_command(ptr0, len0, ptr1, len1);
|
|
5651
|
+
var ptr3 = ret[0];
|
|
5652
|
+
var len3 = ret[1];
|
|
5653
|
+
if (ret[3]) {
|
|
5654
|
+
ptr3 = 0; len3 = 0;
|
|
5655
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5656
|
+
}
|
|
5657
|
+
deferred4_0 = ptr3;
|
|
5658
|
+
deferred4_1 = len3;
|
|
5659
|
+
return getStringFromWasm0(ptr3, len3);
|
|
5660
|
+
} finally {
|
|
5661
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
|
|
5665
|
+
/**
|
|
5666
|
+
* Expand a validated semantic model against a base SMILES and return the
|
|
5667
|
+
* expanded graph plus source-to-expanded atom mapping.
|
|
5668
|
+
* @param {string} base_smiles
|
|
5669
|
+
* @param {string} model_json
|
|
5670
|
+
* @returns {string}
|
|
5671
|
+
*/
|
|
5672
|
+
export function semantic_expand_json(base_smiles, model_json) {
|
|
5673
|
+
let deferred4_0;
|
|
5674
|
+
let deferred4_1;
|
|
5675
|
+
try {
|
|
5676
|
+
const ptr0 = passStringToWasm0(base_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5677
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5678
|
+
const ptr1 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5679
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5680
|
+
const ret = wasm.semantic_expand_json(ptr0, len0, ptr1, len1);
|
|
5681
|
+
var ptr3 = ret[0];
|
|
5682
|
+
var len3 = ret[1];
|
|
5683
|
+
if (ret[3]) {
|
|
5684
|
+
ptr3 = 0; len3 = 0;
|
|
5685
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5686
|
+
}
|
|
5687
|
+
deferred4_0 = ptr3;
|
|
5688
|
+
deferred4_1 = len3;
|
|
5689
|
+
return getStringFromWasm0(ptr3, len3);
|
|
5690
|
+
} finally {
|
|
5691
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
|
|
5695
|
+
/**
|
|
5696
|
+
* Validate and normalize a typed Markush/polymer semantic model JSON.
|
|
5697
|
+
* @param {string} model_json
|
|
5698
|
+
* @returns {string}
|
|
5699
|
+
*/
|
|
5700
|
+
export function semantic_model_json(model_json) {
|
|
5701
|
+
let deferred3_0;
|
|
5702
|
+
let deferred3_1;
|
|
5703
|
+
try {
|
|
5704
|
+
const ptr0 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5705
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5706
|
+
const ret = wasm.semantic_model_json(ptr0, len0);
|
|
5707
|
+
var ptr2 = ret[0];
|
|
5708
|
+
var len2 = ret[1];
|
|
5709
|
+
if (ret[3]) {
|
|
5710
|
+
ptr2 = 0; len2 = 0;
|
|
5711
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5712
|
+
}
|
|
5713
|
+
deferred3_0 = ptr2;
|
|
5714
|
+
deferred3_1 = len2;
|
|
5715
|
+
return getStringFromWasm0(ptr2, len2);
|
|
5716
|
+
} finally {
|
|
5717
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
5718
|
+
}
|
|
5719
|
+
}
|
|
5720
|
+
|
|
5551
5721
|
/**
|
|
5552
5722
|
* Set dihedral angle A—B—C—D and return PDB block with modified coordinates.
|
|
5553
5723
|
* Rotates the D-side subtree around the B—C bond.
|
package/chematic_wasm_bg.wasm
CHANGED
|
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.0.
|
|
8
|
+
"version": "1.0.5",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|