@kent-tokyo/chematic 0.1.5 → 0.1.10
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 +135 -0
- package/chematic_wasm.js +1 -1
- package/chematic_wasm_bg.js +380 -0
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/chematic_wasm.d.ts
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Style options for [`MolHandle::depict_svg_opts`].
|
|
6
|
+
*
|
|
7
|
+
* Construct with `new DepictOptions()`, then call setters:
|
|
8
|
+
* ```js
|
|
9
|
+
* const opts = new DepictOptions();
|
|
10
|
+
* opts.set_background("transparent");
|
|
11
|
+
* opts.set_dark(true);
|
|
12
|
+
* opts.set_width(240);
|
|
13
|
+
* opts.set_height(240);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export class DepictOptions {
|
|
17
|
+
free(): void;
|
|
18
|
+
[Symbol.dispose](): void;
|
|
19
|
+
constructor();
|
|
20
|
+
set_atom_ids(v: boolean): void;
|
|
21
|
+
set_background(bg: string): void;
|
|
22
|
+
set_dark(dark: boolean): void;
|
|
23
|
+
set_height(h: number): void;
|
|
24
|
+
set_highlight_atoms(atoms: Uint32Array): void;
|
|
25
|
+
set_highlight_bonds(bonds: Uint32Array): void;
|
|
26
|
+
set_highlight_color(color: string): void;
|
|
27
|
+
set_kekulize(v: boolean): void;
|
|
28
|
+
set_padding(p: number): void;
|
|
29
|
+
set_show_atom_indices(v: boolean): void;
|
|
30
|
+
set_width(w: number): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
4
33
|
/**
|
|
5
34
|
* A handle to a parsed molecule. Owns the molecule behind an `Rc` so that
|
|
6
35
|
* it can be cheaply cloned on the JS side without copying atom/bond data.
|
|
@@ -17,6 +46,10 @@ export class MolHandle {
|
|
|
17
46
|
* Number of heavy atoms (explicit atoms in the graph; does not count implicit H).
|
|
18
47
|
*/
|
|
19
48
|
atom_count(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Bertz complexity index (BertzCT).
|
|
51
|
+
*/
|
|
52
|
+
bertz_ct(): number;
|
|
20
53
|
/**
|
|
21
54
|
* Number of bonds.
|
|
22
55
|
*/
|
|
@@ -25,10 +58,54 @@ export class MolHandle {
|
|
|
25
58
|
* Canonical SMILES string.
|
|
26
59
|
*/
|
|
27
60
|
canonical_smiles(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Kier–Hall χ0 molecular connectivity index.
|
|
63
|
+
*/
|
|
64
|
+
chi0(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Kier–Hall χ0v valence-weighted connectivity index.
|
|
67
|
+
*/
|
|
68
|
+
chi0v(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Kier–Hall χ1 molecular connectivity index.
|
|
71
|
+
*/
|
|
72
|
+
chi1(): number;
|
|
73
|
+
/**
|
|
74
|
+
* Kier–Hall χ1v valence-weighted connectivity index.
|
|
75
|
+
*/
|
|
76
|
+
chi1v(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Kier–Hall χ2 molecular connectivity index.
|
|
79
|
+
*/
|
|
80
|
+
chi2(): number;
|
|
81
|
+
/**
|
|
82
|
+
* Kier–Hall χ2v valence-weighted connectivity index.
|
|
83
|
+
*/
|
|
84
|
+
chi2v(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Kier–Hall χ3 molecular connectivity index.
|
|
87
|
+
*/
|
|
88
|
+
chi3(): number;
|
|
89
|
+
/**
|
|
90
|
+
* Kier–Hall χ3v valence-weighted connectivity index.
|
|
91
|
+
*/
|
|
92
|
+
chi3v(): number;
|
|
93
|
+
/**
|
|
94
|
+
* Kier–Hall χ4 molecular connectivity index.
|
|
95
|
+
*/
|
|
96
|
+
chi4(): number;
|
|
97
|
+
/**
|
|
98
|
+
* Kier–Hall χ4v valence-weighted connectivity index.
|
|
99
|
+
*/
|
|
100
|
+
chi4v(): number;
|
|
28
101
|
/**
|
|
29
102
|
* 2D SVG depiction of the molecule (CPK coloring).
|
|
30
103
|
*/
|
|
31
104
|
depict_svg(): string;
|
|
105
|
+
/**
|
|
106
|
+
* 2D SVG depiction with style options.
|
|
107
|
+
*/
|
|
108
|
+
depict_svg_opts(opts: DepictOptions): string;
|
|
32
109
|
/**
|
|
33
110
|
* Returns `true` if the molecule passes Egan's absorption criteria
|
|
34
111
|
* (TPSA ≤ 131.6 Ų and LogP ≤ 5.88).
|
|
@@ -67,6 +144,22 @@ export class MolHandle {
|
|
|
67
144
|
* Number of non-hydrogen heavy atoms.
|
|
68
145
|
*/
|
|
69
146
|
heavy_atom_count(): number;
|
|
147
|
+
/**
|
|
148
|
+
* Hall–Kier κ1 shape index.
|
|
149
|
+
*/
|
|
150
|
+
kappa1(): number;
|
|
151
|
+
/**
|
|
152
|
+
* Hall–Kier κ2 shape index.
|
|
153
|
+
*/
|
|
154
|
+
kappa2(): number;
|
|
155
|
+
/**
|
|
156
|
+
* Hall–Kier κ3 shape index.
|
|
157
|
+
*/
|
|
158
|
+
kappa3(): number;
|
|
159
|
+
/**
|
|
160
|
+
* Labute approximate surface area (Ų).
|
|
161
|
+
*/
|
|
162
|
+
labute_asa(): number;
|
|
70
163
|
/**
|
|
71
164
|
* Returns `true` if the molecule satisfies Lipinski's Rule of Five.
|
|
72
165
|
*/
|
|
@@ -83,6 +176,12 @@ export class MolHandle {
|
|
|
83
176
|
* Average molecular weight (Da).
|
|
84
177
|
*/
|
|
85
178
|
molecular_weight(): number;
|
|
179
|
+
/**
|
|
180
|
+
* Morgan count fingerprint as a JSON object string (`{"<hash>": count, …}`).
|
|
181
|
+
*
|
|
182
|
+
* `radius` controls the ECFP radius (2 = ECFP4-equivalent).
|
|
183
|
+
*/
|
|
184
|
+
morgan_fp_counts_json(radius: number): string;
|
|
86
185
|
/**
|
|
87
186
|
* Number of non-aromatic rings containing at least one heteroatom.
|
|
88
187
|
*/
|
|
@@ -140,8 +239,17 @@ export class MolHandle {
|
|
|
140
239
|
* (TPSA ≤ 140 Ų and rotatable bonds ≤ 10).
|
|
141
240
|
*/
|
|
142
241
|
veber_passes(): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Wiener topological index (sum of all pairwise shortest-path distances).
|
|
244
|
+
*/
|
|
245
|
+
wiener_index(): number;
|
|
143
246
|
}
|
|
144
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
|
|
250
|
+
*/
|
|
251
|
+
export function add_hydrogens(mol: MolHandle): MolHandle;
|
|
252
|
+
|
|
145
253
|
/**
|
|
146
254
|
* Number of BRICS fragments produced by fragmenting the molecule.
|
|
147
255
|
*
|
|
@@ -149,11 +257,24 @@ export class MolHandle {
|
|
|
149
257
|
*/
|
|
150
258
|
export function brics_fragment_count(mol: MolHandle): number;
|
|
151
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Render a grid SVG from newline-separated SMILES (one per line).
|
|
262
|
+
*
|
|
263
|
+
* Lines that fail to parse are silently skipped.
|
|
264
|
+
* `cols` controls the number of columns (each cell is 200×200 px).
|
|
265
|
+
*/
|
|
266
|
+
export function depict_svg_grid(smiles_block: string, cols: number): string;
|
|
267
|
+
|
|
152
268
|
/**
|
|
153
269
|
* Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
154
270
|
*/
|
|
155
271
|
export function ecfp4_bitvec(mol: MolHandle): Uint8Array;
|
|
156
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Returns `true` if the SMILES string can be parsed without error.
|
|
275
|
+
*/
|
|
276
|
+
export function is_valid_smiles(s: string): boolean;
|
|
277
|
+
|
|
157
278
|
/**
|
|
158
279
|
* Parse a SMILES string into a `MolHandle`.
|
|
159
280
|
*
|
|
@@ -161,6 +282,20 @@ export function ecfp4_bitvec(mol: MolHandle): Uint8Array;
|
|
|
161
282
|
*/
|
|
162
283
|
export function parse_smiles(s: string): MolHandle;
|
|
163
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
287
|
+
*/
|
|
288
|
+
export function remove_hydrogens(mol: MolHandle): MolHandle;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Apply a SMIRKS reaction template and return product SMILES as a JSON string.
|
|
292
|
+
*
|
|
293
|
+
* `reactants_smiles`: pipe-separated SMILES, one per reactant slot in the SMIRKS.
|
|
294
|
+
* Returns a JSON array of arrays: `[["product_smi", …], …]`.
|
|
295
|
+
* Returns a JS error on parse failure or arity mismatch.
|
|
296
|
+
*/
|
|
297
|
+
export function run_reactants(smirks: string, reactants_smiles: string): string;
|
|
298
|
+
|
|
164
299
|
/**
|
|
165
300
|
* Tanimoto similarity between two molecules using AtomPair fingerprints.
|
|
166
301
|
*/
|
package/chematic_wasm.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./chematic_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
MolHandle, brics_fragment_count, ecfp4_bitvec, parse_smiles, tanimoto_atom_pair, tanimoto_ecfp4, tanimoto_fcfp4, tanimoto_torsion
|
|
8
|
+
DepictOptions, MolHandle, add_hydrogens, brics_fragment_count, depict_svg_grid, ecfp4_bitvec, is_valid_smiles, parse_smiles, remove_hydrogens, run_reactants, tanimoto_atom_pair, tanimoto_ecfp4, tanimoto_fcfp4, tanimoto_torsion
|
|
9
9
|
} from "./chematic_wasm_bg.js";
|
package/chematic_wasm_bg.js
CHANGED
|
@@ -1,3 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style options for [`MolHandle::depict_svg_opts`].
|
|
3
|
+
*
|
|
4
|
+
* Construct with `new DepictOptions()`, then call setters:
|
|
5
|
+
* ```js
|
|
6
|
+
* const opts = new DepictOptions();
|
|
7
|
+
* opts.set_background("transparent");
|
|
8
|
+
* opts.set_dark(true);
|
|
9
|
+
* opts.set_width(240);
|
|
10
|
+
* opts.set_height(240);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export class DepictOptions {
|
|
14
|
+
__destroy_into_raw() {
|
|
15
|
+
const ptr = this.__wbg_ptr;
|
|
16
|
+
this.__wbg_ptr = 0;
|
|
17
|
+
DepictOptionsFinalization.unregister(this);
|
|
18
|
+
return ptr;
|
|
19
|
+
}
|
|
20
|
+
free() {
|
|
21
|
+
const ptr = this.__destroy_into_raw();
|
|
22
|
+
wasm.__wbg_depictoptions_free(ptr, 0);
|
|
23
|
+
}
|
|
24
|
+
constructor() {
|
|
25
|
+
const ret = wasm.depictoptions_new();
|
|
26
|
+
this.__wbg_ptr = ret;
|
|
27
|
+
DepictOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @param {boolean} v
|
|
32
|
+
*/
|
|
33
|
+
set_atom_ids(v) {
|
|
34
|
+
wasm.depictoptions_set_atom_ids(this.__wbg_ptr, v);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} bg
|
|
38
|
+
*/
|
|
39
|
+
set_background(bg) {
|
|
40
|
+
const ptr0 = passStringToWasm0(bg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
41
|
+
const len0 = WASM_VECTOR_LEN;
|
|
42
|
+
wasm.depictoptions_set_background(this.__wbg_ptr, ptr0, len0);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @param {boolean} dark
|
|
46
|
+
*/
|
|
47
|
+
set_dark(dark) {
|
|
48
|
+
wasm.depictoptions_set_dark(this.__wbg_ptr, dark);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param {number} h
|
|
52
|
+
*/
|
|
53
|
+
set_height(h) {
|
|
54
|
+
wasm.depictoptions_set_height(this.__wbg_ptr, h);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @param {Uint32Array} atoms
|
|
58
|
+
*/
|
|
59
|
+
set_highlight_atoms(atoms) {
|
|
60
|
+
const ptr0 = passArray32ToWasm0(atoms, wasm.__wbindgen_malloc);
|
|
61
|
+
const len0 = WASM_VECTOR_LEN;
|
|
62
|
+
wasm.depictoptions_set_highlight_atoms(this.__wbg_ptr, ptr0, len0);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @param {Uint32Array} bonds
|
|
66
|
+
*/
|
|
67
|
+
set_highlight_bonds(bonds) {
|
|
68
|
+
const ptr0 = passArray32ToWasm0(bonds, wasm.__wbindgen_malloc);
|
|
69
|
+
const len0 = WASM_VECTOR_LEN;
|
|
70
|
+
wasm.depictoptions_set_highlight_bonds(this.__wbg_ptr, ptr0, len0);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {string} color
|
|
74
|
+
*/
|
|
75
|
+
set_highlight_color(color) {
|
|
76
|
+
const ptr0 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
77
|
+
const len0 = WASM_VECTOR_LEN;
|
|
78
|
+
wasm.depictoptions_set_highlight_color(this.__wbg_ptr, ptr0, len0);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @param {boolean} v
|
|
82
|
+
*/
|
|
83
|
+
set_kekulize(v) {
|
|
84
|
+
wasm.depictoptions_set_kekulize(this.__wbg_ptr, v);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param {number} p
|
|
88
|
+
*/
|
|
89
|
+
set_padding(p) {
|
|
90
|
+
wasm.depictoptions_set_padding(this.__wbg_ptr, p);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @param {boolean} v
|
|
94
|
+
*/
|
|
95
|
+
set_show_atom_indices(v) {
|
|
96
|
+
wasm.depictoptions_set_show_atom_indices(this.__wbg_ptr, v);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @param {number} w
|
|
100
|
+
*/
|
|
101
|
+
set_width(w) {
|
|
102
|
+
wasm.depictoptions_set_width(this.__wbg_ptr, w);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (Symbol.dispose) DepictOptions.prototype[Symbol.dispose] = DepictOptions.prototype.free;
|
|
106
|
+
|
|
1
107
|
/**
|
|
2
108
|
* A handle to a parsed molecule. Owns the molecule behind an `Rc` so that
|
|
3
109
|
* it can be cheaply cloned on the JS side without copying atom/bond data.
|
|
@@ -35,6 +141,14 @@ export class MolHandle {
|
|
|
35
141
|
const ret = wasm.molhandle_atom_count(this.__wbg_ptr);
|
|
36
142
|
return ret >>> 0;
|
|
37
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Bertz complexity index (BertzCT).
|
|
146
|
+
* @returns {number}
|
|
147
|
+
*/
|
|
148
|
+
bertz_ct() {
|
|
149
|
+
const ret = wasm.molhandle_bertz_ct(this.__wbg_ptr);
|
|
150
|
+
return ret;
|
|
151
|
+
}
|
|
38
152
|
/**
|
|
39
153
|
* Number of bonds.
|
|
40
154
|
* @returns {number}
|
|
@@ -59,6 +173,86 @@ export class MolHandle {
|
|
|
59
173
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
60
174
|
}
|
|
61
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Kier–Hall χ0 molecular connectivity index.
|
|
178
|
+
* @returns {number}
|
|
179
|
+
*/
|
|
180
|
+
chi0() {
|
|
181
|
+
const ret = wasm.molhandle_chi0(this.__wbg_ptr);
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Kier–Hall χ0v valence-weighted connectivity index.
|
|
186
|
+
* @returns {number}
|
|
187
|
+
*/
|
|
188
|
+
chi0v() {
|
|
189
|
+
const ret = wasm.molhandle_chi0v(this.__wbg_ptr);
|
|
190
|
+
return ret;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Kier–Hall χ1 molecular connectivity index.
|
|
194
|
+
* @returns {number}
|
|
195
|
+
*/
|
|
196
|
+
chi1() {
|
|
197
|
+
const ret = wasm.molhandle_chi1(this.__wbg_ptr);
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Kier–Hall χ1v valence-weighted connectivity index.
|
|
202
|
+
* @returns {number}
|
|
203
|
+
*/
|
|
204
|
+
chi1v() {
|
|
205
|
+
const ret = wasm.molhandle_chi1v(this.__wbg_ptr);
|
|
206
|
+
return ret;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Kier–Hall χ2 molecular connectivity index.
|
|
210
|
+
* @returns {number}
|
|
211
|
+
*/
|
|
212
|
+
chi2() {
|
|
213
|
+
const ret = wasm.molhandle_chi2(this.__wbg_ptr);
|
|
214
|
+
return ret;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Kier–Hall χ2v valence-weighted connectivity index.
|
|
218
|
+
* @returns {number}
|
|
219
|
+
*/
|
|
220
|
+
chi2v() {
|
|
221
|
+
const ret = wasm.molhandle_chi2v(this.__wbg_ptr);
|
|
222
|
+
return ret;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Kier–Hall χ3 molecular connectivity index.
|
|
226
|
+
* @returns {number}
|
|
227
|
+
*/
|
|
228
|
+
chi3() {
|
|
229
|
+
const ret = wasm.molhandle_chi3(this.__wbg_ptr);
|
|
230
|
+
return ret;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Kier–Hall χ3v valence-weighted connectivity index.
|
|
234
|
+
* @returns {number}
|
|
235
|
+
*/
|
|
236
|
+
chi3v() {
|
|
237
|
+
const ret = wasm.molhandle_chi3v(this.__wbg_ptr);
|
|
238
|
+
return ret;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Kier–Hall χ4 molecular connectivity index.
|
|
242
|
+
* @returns {number}
|
|
243
|
+
*/
|
|
244
|
+
chi4() {
|
|
245
|
+
const ret = wasm.molhandle_chi4(this.__wbg_ptr);
|
|
246
|
+
return ret;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Kier–Hall χ4v valence-weighted connectivity index.
|
|
250
|
+
* @returns {number}
|
|
251
|
+
*/
|
|
252
|
+
chi4v() {
|
|
253
|
+
const ret = wasm.molhandle_chi4v(this.__wbg_ptr);
|
|
254
|
+
return ret;
|
|
255
|
+
}
|
|
62
256
|
/**
|
|
63
257
|
* 2D SVG depiction of the molecule (CPK coloring).
|
|
64
258
|
* @returns {string}
|
|
@@ -75,6 +269,24 @@ export class MolHandle {
|
|
|
75
269
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
76
270
|
}
|
|
77
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* 2D SVG depiction with style options.
|
|
274
|
+
* @param {DepictOptions} opts
|
|
275
|
+
* @returns {string}
|
|
276
|
+
*/
|
|
277
|
+
depict_svg_opts(opts) {
|
|
278
|
+
let deferred1_0;
|
|
279
|
+
let deferred1_1;
|
|
280
|
+
try {
|
|
281
|
+
_assertClass(opts, DepictOptions);
|
|
282
|
+
const ret = wasm.molhandle_depict_svg_opts(this.__wbg_ptr, opts.__wbg_ptr);
|
|
283
|
+
deferred1_0 = ret[0];
|
|
284
|
+
deferred1_1 = ret[1];
|
|
285
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
286
|
+
} finally {
|
|
287
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
78
290
|
/**
|
|
79
291
|
* Returns `true` if the molecule passes Egan's absorption criteria
|
|
80
292
|
* (TPSA ≤ 131.6 Ų and LogP ≤ 5.88).
|
|
@@ -157,6 +369,38 @@ export class MolHandle {
|
|
|
157
369
|
const ret = wasm.molhandle_heavy_atom_count(this.__wbg_ptr);
|
|
158
370
|
return ret >>> 0;
|
|
159
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Hall–Kier κ1 shape index.
|
|
374
|
+
* @returns {number}
|
|
375
|
+
*/
|
|
376
|
+
kappa1() {
|
|
377
|
+
const ret = wasm.molhandle_kappa1(this.__wbg_ptr);
|
|
378
|
+
return ret;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Hall–Kier κ2 shape index.
|
|
382
|
+
* @returns {number}
|
|
383
|
+
*/
|
|
384
|
+
kappa2() {
|
|
385
|
+
const ret = wasm.molhandle_kappa2(this.__wbg_ptr);
|
|
386
|
+
return ret;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Hall–Kier κ3 shape index.
|
|
390
|
+
* @returns {number}
|
|
391
|
+
*/
|
|
392
|
+
kappa3() {
|
|
393
|
+
const ret = wasm.molhandle_kappa3(this.__wbg_ptr);
|
|
394
|
+
return ret;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Labute approximate surface area (Ų).
|
|
398
|
+
* @returns {number}
|
|
399
|
+
*/
|
|
400
|
+
labute_asa() {
|
|
401
|
+
const ret = wasm.molhandle_labute_asa(this.__wbg_ptr);
|
|
402
|
+
return ret;
|
|
403
|
+
}
|
|
160
404
|
/**
|
|
161
405
|
* Returns `true` if the molecule satisfies Lipinski's Rule of Five.
|
|
162
406
|
* @returns {boolean}
|
|
@@ -189,6 +433,25 @@ export class MolHandle {
|
|
|
189
433
|
const ret = wasm.molhandle_molecular_weight(this.__wbg_ptr);
|
|
190
434
|
return ret;
|
|
191
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Morgan count fingerprint as a JSON object string (`{"<hash>": count, …}`).
|
|
438
|
+
*
|
|
439
|
+
* `radius` controls the ECFP radius (2 = ECFP4-equivalent).
|
|
440
|
+
* @param {number} radius
|
|
441
|
+
* @returns {string}
|
|
442
|
+
*/
|
|
443
|
+
morgan_fp_counts_json(radius) {
|
|
444
|
+
let deferred1_0;
|
|
445
|
+
let deferred1_1;
|
|
446
|
+
try {
|
|
447
|
+
const ret = wasm.molhandle_morgan_fp_counts_json(this.__wbg_ptr, radius);
|
|
448
|
+
deferred1_0 = ret[0];
|
|
449
|
+
deferred1_1 = ret[1];
|
|
450
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
451
|
+
} finally {
|
|
452
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
192
455
|
/**
|
|
193
456
|
* Number of non-aromatic rings containing at least one heteroatom.
|
|
194
457
|
* @returns {number}
|
|
@@ -302,9 +565,28 @@ export class MolHandle {
|
|
|
302
565
|
const ret = wasm.molhandle_veber_passes(this.__wbg_ptr);
|
|
303
566
|
return ret !== 0;
|
|
304
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* Wiener topological index (sum of all pairwise shortest-path distances).
|
|
570
|
+
* @returns {number}
|
|
571
|
+
*/
|
|
572
|
+
wiener_index() {
|
|
573
|
+
const ret = wasm.molhandle_wiener_index(this.__wbg_ptr);
|
|
574
|
+
return ret;
|
|
575
|
+
}
|
|
305
576
|
}
|
|
306
577
|
if (Symbol.dispose) MolHandle.prototype[Symbol.dispose] = MolHandle.prototype.free;
|
|
307
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
|
|
581
|
+
* @param {MolHandle} mol
|
|
582
|
+
* @returns {MolHandle}
|
|
583
|
+
*/
|
|
584
|
+
export function add_hydrogens(mol) {
|
|
585
|
+
_assertClass(mol, MolHandle);
|
|
586
|
+
const ret = wasm.add_hydrogens(mol.__wbg_ptr);
|
|
587
|
+
return MolHandle.__wrap(ret);
|
|
588
|
+
}
|
|
589
|
+
|
|
308
590
|
/**
|
|
309
591
|
* Number of BRICS fragments produced by fragmenting the molecule.
|
|
310
592
|
*
|
|
@@ -318,6 +600,30 @@ export function brics_fragment_count(mol) {
|
|
|
318
600
|
return ret >>> 0;
|
|
319
601
|
}
|
|
320
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Render a grid SVG from newline-separated SMILES (one per line).
|
|
605
|
+
*
|
|
606
|
+
* Lines that fail to parse are silently skipped.
|
|
607
|
+
* `cols` controls the number of columns (each cell is 200×200 px).
|
|
608
|
+
* @param {string} smiles_block
|
|
609
|
+
* @param {number} cols
|
|
610
|
+
* @returns {string}
|
|
611
|
+
*/
|
|
612
|
+
export function depict_svg_grid(smiles_block, cols) {
|
|
613
|
+
let deferred2_0;
|
|
614
|
+
let deferred2_1;
|
|
615
|
+
try {
|
|
616
|
+
const ptr0 = passStringToWasm0(smiles_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
617
|
+
const len0 = WASM_VECTOR_LEN;
|
|
618
|
+
const ret = wasm.depict_svg_grid(ptr0, len0, cols);
|
|
619
|
+
deferred2_0 = ret[0];
|
|
620
|
+
deferred2_1 = ret[1];
|
|
621
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
622
|
+
} finally {
|
|
623
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
321
627
|
/**
|
|
322
628
|
* Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
323
629
|
* @param {MolHandle} mol
|
|
@@ -331,6 +637,18 @@ export function ecfp4_bitvec(mol) {
|
|
|
331
637
|
return v1;
|
|
332
638
|
}
|
|
333
639
|
|
|
640
|
+
/**
|
|
641
|
+
* Returns `true` if the SMILES string can be parsed without error.
|
|
642
|
+
* @param {string} s
|
|
643
|
+
* @returns {boolean}
|
|
644
|
+
*/
|
|
645
|
+
export function is_valid_smiles(s) {
|
|
646
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
647
|
+
const len0 = WASM_VECTOR_LEN;
|
|
648
|
+
const ret = wasm.is_valid_smiles(ptr0, len0);
|
|
649
|
+
return ret !== 0;
|
|
650
|
+
}
|
|
651
|
+
|
|
334
652
|
/**
|
|
335
653
|
* Parse a SMILES string into a `MolHandle`.
|
|
336
654
|
*
|
|
@@ -348,6 +666,50 @@ export function parse_smiles(s) {
|
|
|
348
666
|
return MolHandle.__wrap(ret[0]);
|
|
349
667
|
}
|
|
350
668
|
|
|
669
|
+
/**
|
|
670
|
+
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
671
|
+
* @param {MolHandle} mol
|
|
672
|
+
* @returns {MolHandle}
|
|
673
|
+
*/
|
|
674
|
+
export function remove_hydrogens(mol) {
|
|
675
|
+
_assertClass(mol, MolHandle);
|
|
676
|
+
const ret = wasm.remove_hydrogens(mol.__wbg_ptr);
|
|
677
|
+
return MolHandle.__wrap(ret);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Apply a SMIRKS reaction template and return product SMILES as a JSON string.
|
|
682
|
+
*
|
|
683
|
+
* `reactants_smiles`: pipe-separated SMILES, one per reactant slot in the SMIRKS.
|
|
684
|
+
* Returns a JSON array of arrays: `[["product_smi", …], …]`.
|
|
685
|
+
* Returns a JS error on parse failure or arity mismatch.
|
|
686
|
+
* @param {string} smirks
|
|
687
|
+
* @param {string} reactants_smiles
|
|
688
|
+
* @returns {string}
|
|
689
|
+
*/
|
|
690
|
+
export function run_reactants(smirks, reactants_smiles) {
|
|
691
|
+
let deferred4_0;
|
|
692
|
+
let deferred4_1;
|
|
693
|
+
try {
|
|
694
|
+
const ptr0 = passStringToWasm0(smirks, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
695
|
+
const len0 = WASM_VECTOR_LEN;
|
|
696
|
+
const ptr1 = passStringToWasm0(reactants_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
697
|
+
const len1 = WASM_VECTOR_LEN;
|
|
698
|
+
const ret = wasm.run_reactants(ptr0, len0, ptr1, len1);
|
|
699
|
+
var ptr3 = ret[0];
|
|
700
|
+
var len3 = ret[1];
|
|
701
|
+
if (ret[3]) {
|
|
702
|
+
ptr3 = 0; len3 = 0;
|
|
703
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
704
|
+
}
|
|
705
|
+
deferred4_0 = ptr3;
|
|
706
|
+
deferred4_1 = len3;
|
|
707
|
+
return getStringFromWasm0(ptr3, len3);
|
|
708
|
+
} finally {
|
|
709
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
351
713
|
/**
|
|
352
714
|
* Tanimoto similarity between two molecules using AtomPair fingerprints.
|
|
353
715
|
* @param {MolHandle} a
|
|
@@ -416,6 +778,9 @@ export function __wbindgen_init_externref_table() {
|
|
|
416
778
|
table.set(offset + 2, true);
|
|
417
779
|
table.set(offset + 3, false);
|
|
418
780
|
}
|
|
781
|
+
const DepictOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
782
|
+
? { register: () => {}, unregister: () => {} }
|
|
783
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_depictoptions_free(ptr, 1));
|
|
419
784
|
const MolHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
420
785
|
? { register: () => {}, unregister: () => {} }
|
|
421
786
|
: new FinalizationRegistry(ptr => wasm.__wbg_molhandle_free(ptr, 1));
|
|
@@ -435,6 +800,14 @@ function getStringFromWasm0(ptr, len) {
|
|
|
435
800
|
return decodeText(ptr >>> 0, len);
|
|
436
801
|
}
|
|
437
802
|
|
|
803
|
+
let cachedUint32ArrayMemory0 = null;
|
|
804
|
+
function getUint32ArrayMemory0() {
|
|
805
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
806
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
807
|
+
}
|
|
808
|
+
return cachedUint32ArrayMemory0;
|
|
809
|
+
}
|
|
810
|
+
|
|
438
811
|
let cachedUint8ArrayMemory0 = null;
|
|
439
812
|
function getUint8ArrayMemory0() {
|
|
440
813
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
@@ -443,6 +816,13 @@ function getUint8ArrayMemory0() {
|
|
|
443
816
|
return cachedUint8ArrayMemory0;
|
|
444
817
|
}
|
|
445
818
|
|
|
819
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
820
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
821
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
822
|
+
WASM_VECTOR_LEN = arg.length;
|
|
823
|
+
return ptr;
|
|
824
|
+
}
|
|
825
|
+
|
|
446
826
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
447
827
|
if (realloc === undefined) {
|
|
448
828
|
const buf = cachedTextEncoder.encode(arg);
|
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.10",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|