rdkit-esm 0.1.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.
@@ -0,0 +1,1578 @@
1
+ //#region src/types/rdkit-minimalib-typings.d.ts
2
+ // Type definitons for RDKit.js
3
+ // Project: https://github.com/rdkit/rdkit-js
4
+ // Definitions by: adam-of-barot <https://github.com/adam-of-barot>
5
+
6
+ type JSONString = string;
7
+
8
+ /**
9
+ * Represents a molecule object generated by RDKit.js
10
+ *
11
+ * @remarks
12
+ * JSMol's are created using the {@link RDKitModule.get_mol | RDKitModule.get_mol()} methods.
13
+ */
14
+ interface JSMol {
15
+ /** Delete C++ mol objects manually from memory
16
+ *
17
+ * See {@link https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management | Emscripten docs} for more details
18
+ */
19
+ delete(): void;
20
+
21
+ // string representations
22
+
23
+ /** Returns the SMILES string */
24
+ get_smiles(details_json?: JSONString): string;
25
+
26
+ /** Returns the Chemaxon Extended SMILES string */
27
+ get_cxsmiles(details_json?: JSONString): string;
28
+
29
+ /** Returns the SMARTS string */
30
+ get_smarts(details_json?: JSONString): string;
31
+
32
+ /** Returns the Chemaxon Extended SMARTS string */
33
+ get_cxsmarts(details_json?: JSONString): string;
34
+
35
+ /**
36
+ * Returns the V2000 Molfile string, unless the molecule contains V3000 features,
37
+ * in which case it returns a V3000 Molfile string
38
+ * @param RDKitGetMolBlockOpt as a stringifyed JSON
39
+ */
40
+ get_molblock(): string;
41
+ get_molblock(options: JSONString): string;
42
+
43
+ /** Returns the V3000 Molfile string
44
+ * @param RDKitGetMolBlockOpt as a stringifyed JSON
45
+ */
46
+ get_v2Kmolblock(): string;
47
+ get_v2Kmolblock(options: JSONString): string;
48
+
49
+ /** Returns the V3000 Molfile string
50
+ * @param RDKitGetMolBlockOpt as a stringifyed JSON
51
+ */
52
+ get_v3Kmolblock(): string;
53
+ get_v3Kmolblock(options: JSONString): string;
54
+
55
+ /** Return the InChI string */
56
+ get_inchi(): string;
57
+ /**
58
+ * @param args InchI CLI arguments
59
+ * @example mol.get_inchi("-FixedH -RecMet -SaveOpt -SUU -SLUUD")
60
+ */
61
+ get_inchi(args: string): string;
62
+
63
+ /** Returns the JSON representation */
64
+ get_json(): string;
65
+
66
+ // array representation
67
+
68
+ /** Returns an unsigned integer array representation */
69
+ get_as_uint8array(): Uint8Array;
70
+
71
+ // SVG representations
72
+
73
+ /** Returns an SVG of the molecule */
74
+ get_svg(): string;
75
+
76
+ /**
77
+ * Returns an SVG of the molcule, with atoms highlighted
78
+ *
79
+ * @param details A stringified JSON object containing any of the following options https://www.rdkitjs.com/#drawing-molecules-all-options
80
+ */
81
+ get_svg_with_highlights(details: string): string;
82
+
83
+ // substructure match methods
84
+
85
+ /**
86
+ * Returns a substructure match string
87
+ *
88
+ * @param q query molecule
89
+ * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
90
+ */
91
+ get_substruct_match(q: JSMol): string;
92
+
93
+ /**
94
+ * Returns all substructure matches
95
+ *
96
+ * @param q query molecule
97
+ * @returns A stringified JSON object containing the matched atoms and bonds of the parent molecule
98
+ */
99
+ get_substruct_matches(q: JSMol): string;
100
+
101
+ // molecular descriptors
102
+
103
+ /** Returns a stringified JSON object of molecular descriptors */
104
+ get_descriptors(): string;
105
+
106
+ // fingerprint methods
107
+
108
+ /**
109
+ * Returns the Morgan fingerprint as string
110
+ */
111
+ get_morgan_fp(): string;
112
+
113
+ /**
114
+ * Returns the Morgan fingerprint as string.
115
+ *
116
+ * You can also specify the following options
117
+ * (passed as a stringified JSON object)
118
+ * @param {number} radius fingerprint radius
119
+ * @param {number} len fingerprint length
120
+ */
121
+ get_morgan_fp(options: JSONString): string;
122
+
123
+ /**
124
+ * Returns the Morgan fingerprint as an unsigned integer array
125
+ */
126
+ get_morgan_fp_as_uint8array(): Uint8Array;
127
+
128
+ /**
129
+ * Returns the Morgan fingerprint as an unsigned integer array
130
+ *
131
+ * You can also specify the following options
132
+ * (passed as a stringified JSON object)
133
+ * @param {number} radius fingerprint radius
134
+ * @param {number} fplen fingerprint length
135
+ */
136
+ get_morgan_fp_as_uint8array(options: JSONString): Uint8Array;
137
+
138
+ /**
139
+ * Returns the pattern fingerprint as string
140
+ */
141
+ get_pattern_fp(): string;
142
+
143
+ /**
144
+ * Returns the pattern fingerprint as string
145
+ *
146
+ * you can also specify the following options
147
+ * (passed as a stringified JSON object)
148
+ * @param {number} len fingerprint length
149
+ */
150
+ get_pattern_fp(options: JSONString): string;
151
+
152
+ /**
153
+ * Returns the pattern fingerprint as an unsigned integer array
154
+ */
155
+ get_pattern_fp_as_uint8array(): Uint8Array;
156
+
157
+ /**
158
+ * Returns the pattern fingerprint as an unsigned integer array
159
+ *
160
+ * you can also specify the following options
161
+ * (passed as a stringified JSON object)
162
+ * @param {number} fplen fingerprint length
163
+ */
164
+ get_pattern_fp_as_uint8array(options: JSONString): Uint8Array;
165
+
166
+ /**
167
+ * Returns the topological torsion fingerprint as string
168
+ */
169
+ get_topological_torsion_fp(): string;
170
+
171
+ /**
172
+ * Returns the topological torsion fingerprint as string
173
+ *
174
+ * you can also specify the following options
175
+ * (passed as a stringified JSON object)
176
+ * @param {number} len fingerprint length
177
+ */
178
+ get_topological_torsion_fp(options: JSONString): string;
179
+
180
+ /**
181
+ * Returns the topological torsion fingerprint as an unsigned integer array
182
+ */
183
+ get_topological_torsion_fp_as_uint8array(): Uint8Array;
184
+
185
+ /**
186
+ * Returns the topological torsion fingerprint as an unsigned integer array
187
+ *
188
+ * you can also specify the following options
189
+ * (passed as a stringified JSON object)
190
+ * @param {number} fplen fingerprint length
191
+ */
192
+ get_topological_torsion_fp_as_uint8array(options: JSONString): Uint8Array;
193
+
194
+ /**
195
+ * Returns the rdkit fingerprint as string
196
+ */
197
+ get_rdkit_fp(): string;
198
+
199
+ /**
200
+ * Returns the rdkit fingerprint as string
201
+ *
202
+ * you can also specify the following options
203
+ * (passed as a stringified JSON object)
204
+ * @param {number} len fingerprint length
205
+ */
206
+ get_rdkit_fp(options: JSONString): string;
207
+
208
+ /**
209
+ * Returns the rdkit fingerprint as an unsigned integer array
210
+ */
211
+ get_rdkit_fp_as_uint8array(): Uint8Array;
212
+
213
+ /**
214
+ * Returns the rdkit fingerprint as an unsigned integer array
215
+ *
216
+ * you can also specify the following options
217
+ * (passed as a stringified JSON object)
218
+ * @param {number} fplen fingerprint length
219
+ */
220
+ get_rdkit_fp_as_uint8array(options: JSONString): Uint8Array;
221
+
222
+ /**
223
+ * Returns the atom pair fingerprint as string
224
+ */
225
+ get_atom_pair_fp(): string;
226
+
227
+ /**
228
+ * Returns the atom pair fingerprint as string
229
+ *
230
+ * you can also specify the following options
231
+ * (passed as a stringified JSON object)
232
+ * @param {number} len fingerprint length
233
+ */
234
+ get_atom_pair_fp(options: JSONString): string;
235
+
236
+ /**
237
+ * Returns the atom pair fingerprint as an unsigned integer array
238
+ */
239
+ get_atom_pair_fp_as_uint8array(): Uint8Array;
240
+
241
+ /**
242
+ * Returns the atom pair fingerprint as an unsigned integer array
243
+ *
244
+ * you can also specify the following options
245
+ * (passed as a stringified JSON object)
246
+ * @param {number} fplen fingerprint length
247
+ */
248
+ get_atom_pair_fp_as_uint8array(options: JSONString): Uint8Array;
249
+
250
+ /**
251
+ * Returns the maccs fingerprint as string
252
+ */
253
+ get_maccs_fp(): string;
254
+
255
+ /**
256
+ * Returns the maccs fingerprint as string
257
+ *
258
+ * you can also specify the following options
259
+ * (passed as a stringified JSON object)
260
+ * @param {number} len fingerprint length
261
+ */
262
+ get_maccs_fp(options: JSONString): string;
263
+
264
+ /**
265
+ * Returns the maccs fingerprint as an unsigned integer array
266
+ */
267
+ get_maccs_fp_as_uint8array(): Uint8Array;
268
+
269
+ // abbreviation methods
270
+
271
+ condense_abbreviations(): string;
272
+ condense_abbreviations(maxCoverage: number, useLinkers: boolean): string;
273
+
274
+ // coord generation
275
+
276
+ /**
277
+ * Aligns molecule with the template.
278
+ * you can also specify the following options
279
+ * (passed as a stringified JSON object)
280
+ * @param {boolean} useCoordGen
281
+ * @param {boolean} allowOptionalAttachements
282
+ * @param {boolean} acceptFailure
283
+ */
284
+ generate_aligned_coords(templateMol: JSMol, options: JSONString): string;
285
+
286
+ /** Returns true if the molecule's structure is valid */
287
+ is_valid(): boolean;
288
+ get_num_atoms(): number;
289
+ get_num_bonds(): number;
290
+
291
+ /** Check is the molecule has any 2D coordinates generated */
292
+ has_coords(): 0 | 2 | 3;
293
+
294
+ /** Returns a stringified JSON object containing the atoms and bonds of stereo centers */
295
+ get_stereo_tags(): string;
296
+
297
+ /** Returns the V2000 Molfile representation of the aromatic form of the molecule */
298
+ get_aromatic_form(): string;
299
+
300
+ /** Returns the V2000 Molfile representation of the kekule form of the molecule */
301
+ get_kekule_form(): string;
302
+
303
+ /** Returns the disconnected fragments of the molecule */
304
+ get_frags(): {
305
+ mappings: JSONString;
306
+ molList: MolList;
307
+ };
308
+
309
+ /** Generate new 2D coordinates */
310
+ set_new_coords(): boolean;
311
+
312
+ /**
313
+ * Generate new 2D coordinates
314
+ *
315
+ * @param useCoordGen use the CoordGen algorithm
316
+ */
317
+ set_new_coords(useCoordGen: boolean): boolean;
318
+
319
+ /** Return a V2000 Molfile string with newly generated coordinates */
320
+ get_new_coords(): string;
321
+
322
+ /**
323
+ * Return a V2000 Molfile string with newly generated coordinates
324
+ *
325
+ * @param useCoordGen use the CoordGen algorithm
326
+ */
327
+ get_new_coords(useCoordGen: boolean): string;
328
+
329
+ // property methods
330
+
331
+ /**
332
+ * Check whether the molecule has a certain property
333
+ *
334
+ * @param key property name
335
+ */
336
+ has_prop(key: string): boolean;
337
+
338
+ /** Returns the list of property names */
339
+ get_prop_list(): StringList;
340
+ get_prop_list(includePrivate: boolean): StringList;
341
+ get_prop_list(includePrivate: boolean, includeComputed: boolean): StringList;
342
+
343
+ /**
344
+ * Sets a property on the molecule
345
+ *
346
+ * @param key property name
347
+ * @param val property value
348
+ */
349
+ set_prop(key: string, val: string): boolean;
350
+
351
+ /**
352
+ * Sets a property on the molecule
353
+ *
354
+ * @param key property name
355
+ * @param val property value
356
+ * @param computed set true to flag the value as computed
357
+ */
358
+ set_prop(key: string, val: string, computed: boolean): boolean;
359
+
360
+ /**
361
+ * Get a property on the molecule
362
+ *
363
+ * @param key property name
364
+ */
365
+ get_prop(key: string): string;
366
+
367
+ /**
368
+ * Clears a property from the molecule
369
+ *
370
+ * @param key property name
371
+ */
372
+ clear_prop(key: string): boolean;
373
+
374
+ // hydrogen methods
375
+
376
+ /**
377
+ * Remove explicit hydrogens
378
+ *
379
+ * @returns V2000 Molfile string without explicit hydrogens
380
+ */
381
+ remove_hs(): string;
382
+ remove_hs(options: JSONString): string;
383
+
384
+ /** Remove explicit hydrogens from the molecule */
385
+ remove_hs_in_place(): boolean;
386
+ remove_hs_in_place(options: JSONString): boolean;
387
+
388
+ /**
389
+ * Add explicit hydrogens
390
+ *
391
+ * @returns V2000 Molfile string with explicit hydrogens
392
+ */
393
+ add_hs(): string;
394
+
395
+ /** Add explicit hydrogens on the molecule */
396
+ add_hs_in_place(): boolean;
397
+
398
+ // aromaticity methods
399
+
400
+ convert_to_aromatic_form(): void;
401
+ convert_to_kekule_form(): void;
402
+
403
+ /** Add component to the molecule object
404
+ * @param options stringified JSON object with { offset: [number, number, number] }
405
+ */
406
+ combine_with(other: JSMol, options?: string): void;
407
+
408
+ /** Returns a copy of the molecule */
409
+ copy(): JSMol;
410
+
411
+ // depiction methods
412
+
413
+ normalize_depiction(): number;
414
+ normalize_depiction(canonicalize: number): number;
415
+ normalize_depiction(canonicalize: number, scaleFactor: number): number;
416
+ straighten_depiction(smallRotation?: boolean): void;
417
+
418
+ // canvas methods
419
+
420
+ /**
421
+ * Draw the molecule to an HTML5 canvas
422
+ *
423
+ * @param canvas canvas ID
424
+ * @param width width in pixels
425
+ * @param height height in pixels
426
+ */
427
+ draw_to_canvas(canvas: HTMLCanvasElement, width: number, height: number): void;
428
+
429
+ /**
430
+ * Draw the molecule to an HTML5 canvas, with atom highlights
431
+ *
432
+ * @param canvas canvas ID
433
+ * @param details A stringified JSON object containing any of the following options https://www.rdkitjs.com/#drawing-molecules-all-options
434
+ */
435
+ draw_to_canvas_with_highlights(canvas: HTMLCanvasElement, details: string): void;
436
+
437
+ /**
438
+ * Draw the molecule to an HTML5 canvas with an offset
439
+ *
440
+ * @param canvas canvas ID
441
+ * @param offsetx offset X in pixels
442
+ * @param offsety offset Y in pixels
443
+ * @param width width in pixels
444
+ * @param height height in pixels
445
+ */
446
+ draw_to_canvas_with_offset(canvas: HTMLCanvasElement, offsetx: number, offsety: number, width: number, height: number): void;
447
+ }
448
+ interface JSReaction extends Pick<JSMol, 'delete' | 'draw_to_canvas' | 'draw_to_canvas_with_highlights' | 'get_svg' | 'get_svg_with_highlights'> {
449
+ is_Deleted(): boolean;
450
+ clone(): JSReaction;
451
+ run_reactants(reactants: MolList, maxProducts: number): EmscriptenVector<MolList>;
452
+ }
453
+ /**
454
+ * An object containing a collection of structures. Used for efficient substructure searching.
455
+ *
456
+ * @remarks
457
+ * Add molecules to the library with the {@link add_mol}, {@link add_smiles} or {@link add_trusted_smiles} methods.
458
+ *
459
+ * Perform substructure searches with the {@link get_matches} method.
460
+ */
461
+ interface SubstructLibrary {
462
+ /**
463
+ * Add a molecule to the library
464
+ *
465
+ * @param m molecule
466
+ */
467
+ add_mol(m: JSMol): number;
468
+
469
+ /**
470
+ * Add a molecule to the library
471
+ *
472
+ * @param smi SMILES string
473
+ */
474
+ add_smiles(smi: string): number;
475
+
476
+ /**
477
+ * Add a molecule to the library.
478
+ *
479
+ * Molecule validity will not be checked!
480
+ *
481
+ * @param smi SMILES string (trusted to be valid)
482
+ */
483
+ add_trusted_smiles(smi: string): number;
484
+
485
+ /**
486
+ * Get a molecule from the library
487
+ *
488
+ * @param i index of the molecule
489
+ */
490
+ get_mol(i: number): JSMol;
491
+
492
+ /**
493
+ * Get all molecules from the library matching the substructure query
494
+ *
495
+ * @param q query molecule
496
+ */
497
+ get_matches(q: JSMol): string;
498
+
499
+ /**
500
+ * Get all molecules from the library matching the substructure query
501
+ *
502
+ * @param q query molecule
503
+ * @param maxResults maximum number of results
504
+ */
505
+ get_matches(q: JSMol, maxResults: number): string;
506
+
507
+ /**
508
+ * Get all molecules from the library matching the substructure query
509
+ *
510
+ * @param q query molecule
511
+ * @param useChirality set to true to enable chiral substructure searching
512
+ * @param numThreads number of threads to use
513
+ * @param maxResults maximum number of results
514
+ */
515
+ get_matches(q: JSMol, useChirality: boolean, numThreads: number, maxResults: number): string;
516
+
517
+ /**
518
+ * Return the number of substructure matches
519
+ *
520
+ * @param q query molecule
521
+ */
522
+ count_matches(q: JSMol): number;
523
+
524
+ /**
525
+ * Return the number of substructure matches
526
+ *
527
+ * @param q query molecule
528
+ * @param useChirality set to true to enable chiral substructure searching
529
+ * @param numThreads number of threads to use
530
+ */
531
+ count_matches(q: JSMol, useChirality: boolean, numThreads: number): number;
532
+ }
533
+ interface MolList {
534
+ /**
535
+ * push back a molecule to the list and return the new size of the list
536
+ * @param m molecule
537
+ */
538
+ append(m: JSMol): number;
539
+
540
+ /**
541
+ * return the molecule at index i, or null if i is out of bounds
542
+ * @param i position in the list (0-based index)
543
+ */
544
+ at(i: number): JSMol | null;
545
+
546
+ /**
547
+ * returns true if the current index for iteration is at the end of the list
548
+ * @returns boolean
549
+ */
550
+ at_end: () => boolean;
551
+ clone: () => MolList;
552
+ delete: () => void;
553
+ isDeleted: () => boolean;
554
+
555
+ /**
556
+ * Insert a molecule at the specified index
557
+ * @param i index at which to insert the molecule
558
+ * @param m molecule to insert
559
+ * @returns new size of the list
560
+ */
561
+ insert(i: number, m: JSMol): number;
562
+
563
+ /**
564
+ * Return the next molecule in the list, or null if at the end of the list. Advances the internal index by 1.
565
+ * @returns next molecule or null
566
+ */
567
+ next: () => JSMol | null;
568
+
569
+ /**
570
+ * Returns the molecule at index i and removes it and all subsequent molecules from the list. Returns null if i is out of bounds.
571
+ * @param i index at which to pop the molecule
572
+ */
573
+ pop(i: number): JSMol | null;
574
+
575
+ /**
576
+ * Reset the internal index for iteration to the beginning of the list
577
+ * @returns void
578
+ */
579
+ reset: () => void;
580
+
581
+ /**
582
+ * Return the current size of the list
583
+ * @returns size of the list
584
+ */
585
+ size: () => number;
586
+ }
587
+ /** Emscripten vector<T> wrapper — raw std::vector binding with get/size/delete */
588
+ interface EmscriptenVector<T> {
589
+ size(): number;
590
+ get(i: number): T;
591
+ delete(): void;
592
+ }
593
+ /** Emscripten vector<string> wrapper */
594
+ interface StringList extends EmscriptenVector<string> {}
595
+ // constructor interfaces
596
+
597
+ /** Returns a new SubstructLibrary instance */
598
+ interface SubstructLibraryConstructor {
599
+ new (): SubstructLibrary;
600
+ }
601
+ interface MolListConstructor {
602
+ new (): MolList;
603
+ }
604
+ interface RGroupDecomposition {
605
+ add(mol: JSMol): number;
606
+ process(): boolean;
607
+ get_rgroups_as_columns(): {
608
+ [key: 'Core' | `R${number}`]: MolList;
609
+ };
610
+ get_rgroups_as_rows(): {
611
+ [key: 'Core' | `R${number}`]: JSMol;
612
+ }[];
613
+ delete(): void;
614
+ }
615
+
616
+ /** The main RDKit module */
617
+ interface RDKitModule {
618
+ SubstructLibrary: SubstructLibraryConstructor;
619
+ MolList: MolListConstructor;
620
+
621
+ /**
622
+ * Create a molecule from a variety of input strings.
623
+ * This will return null if the input is invalid.
624
+ *
625
+ * @param input SMILES / SMARTS / MolFile / JSON string
626
+ * @param details_json @type {RDKitGetMolOpt}
627
+ */
628
+ get_mol(input: string, details_json?: string): JSMol | null;
629
+
630
+ /**
631
+ * Create a molecule from an integer array
632
+ *
633
+ * @param pklAsUInt8Array unsigned integer array
634
+ */
635
+ get_mol_from_uint8array(pklAsUInt8Array: Uint8Array): JSMol;
636
+
637
+ /**
638
+ * Create a copy of a molecule
639
+ *
640
+ * @param other molecule to copy
641
+ */
642
+ get_mol_copy(other: JSMol): JSMol;
643
+
644
+ /**
645
+ * Create a query molecule
646
+ * This will return null if the input is invalid.
647
+ *
648
+ * @param input SMARTS string
649
+ */
650
+ get_qmol(input: string): JSMol | null;
651
+ get_qmol(input: string, details_json?: string): JSMol | null;
652
+
653
+ /**
654
+ * Create a reaction instance
655
+ * @param input
656
+ * @param details_json RDKitRxnDetails in JSON string format
657
+ */
658
+ get_rxn(input: string, details_json?: JSONString): JSReaction;
659
+
660
+ /**
661
+ * Get the InChI key for an InChI string
662
+ *
663
+ * @param inchi InChI string
664
+ */
665
+ get_inchikey_for_inchi(inchi: string): string;
666
+ get_mcs_as_json(list: MolList, details_json?: string): string;
667
+ get_mcs_as_mol(list: MolList, details_json?: string): JSMol;
668
+ get_mcs_as_smarts(list: MolList, details_json?: string): string;
669
+
670
+ /**
671
+ * Zip two molecules together using dummy attachments by default,
672
+ * or specified labels in the details_json argument
673
+ * @param mol1
674
+ * @param mol2
675
+ * @param details_json
676
+ * @example
677
+ * const mol1 = RDKitModule.get_mol("F/C=C/[*:1]");
678
+ * const mol2 = RDKitModule.get_mol("[*:1]F");
679
+ * const mol = RDKitModule.molzip(mol1, mol2); // returns the molecule represented by "F/C=C/F"
680
+ */
681
+ molzip(mol1: JSMol, mol2: JSMol, details_json?: string): JSMol;
682
+ get_rgd(core: JSMol | MolList, details_json?: string): RGroupDecomposition;
683
+
684
+ /**
685
+ * Get the version number of the RDKit module
686
+ */
687
+ version(): string;
688
+
689
+ /**
690
+ * Set whether to prefer the CoordGen library's algorithm for coordinate generation
691
+ *
692
+ * @param prefer
693
+ */
694
+ prefer_coordgen(prefer: boolean): void;
695
+
696
+ /**
697
+ * Set whether to use legacy stereo perception
698
+ *
699
+ * @param value
700
+ */
701
+ use_legacy_stereo_perception(value: boolean): void;
702
+ enable_logging(): void;
703
+ disable_logging(): void;
704
+ /**
705
+ * Create a JSLog handle object and log messages to its buffer and the browser console
706
+ *
707
+ * @example const logHandle = rdkit.set_log_tee('rdApp.*')
708
+ * const logBuffer = logHandle.get_buffer()
709
+ * logHandle.clear_buffer()
710
+ * logHandle.delete()
711
+ */
712
+ set_log_tee(logLevel: LogLevel): RDKitJSLog;
713
+ /**
714
+ * Create a JSLog handle object and log messages to its buffer
715
+ *
716
+ * @example const logHandle = rdkit.set_log_tee('rdApp.*')
717
+ * const logBuffer = logHandle.get_buffer()
718
+ * logHandle.clear_buffer()
719
+ * logHandle.delete()
720
+ */
721
+
722
+ set_log_capture(logLevel: LogLevel): RDKitJSLog;
723
+ }
724
+ type LogLevel = 'rdApp.debug' | 'rdApp.info' | 'rdApp.warning' | 'rdApp.error' | 'rdApp.*';
725
+ type RDKitJSLog = {
726
+ get_buffer(): string;
727
+ clear_buffer(): void;
728
+ delete(): void;
729
+ isDeleted(): boolean;
730
+ };
731
+ type RDKitLoaderOptions = {
732
+ /**
733
+ * Optional path to the RDKit module .wasm file on your server.
734
+ */
735
+ locateFile?: () => string;
736
+ };
737
+
738
+ /**
739
+ * Loads the RDKit module asynchronously.
740
+ * In order to use the RDKit module, calling this function is necessary.
741
+ */
742
+ type RDKitLoader = (options?: RDKitLoaderOptions) => Promise<RDKitModule>;
743
+ declare global {
744
+ interface Window {
745
+ initRDKitModule: RDKitLoader;
746
+ }
747
+ }
748
+ //#endregion
749
+ //#region src/types/rdkit-minimalib-json-typings.d.ts
750
+ /**
751
+ * Manually generated typings for the RDKit module functions responses and parameters
752
+ */
753
+
754
+ type RDKitDescriptorNames = 'exactmw' | 'amw' | 'lipinskiHBA' | 'lipinskiHBD' | 'NumRotatableBonds' | 'NumHBD' | 'NumHBA' | 'NumHeavyAtoms' | 'NumAtoms' | 'NumHeteroatoms' | 'NumAmideBonds' | 'FractionCSP3' | 'NumRings' | 'NumAromaticRings' | 'NumAliphaticRings' | 'NumSaturatedRings' | 'NumHeterocycles' | 'NumAromaticHeterocycles' | 'NumSaturatedHeterocycles' | 'NumAliphaticHeterocycles' | 'NumSpiroAtoms' | 'NumBridgeheadAtoms' | 'NumAtomStereoCenters' | 'NumUnspecifiedAtomStereoCenters' | 'labuteASA' | 'tpsa' | 'CrippenClogP' | 'CrippenMR' | 'chi0v' | 'chi1v' | 'chi2v' | 'chi3v' | 'chi4v' | 'chi0n' | 'chi1n' | 'chi2n' | 'chi3n' | 'chi4n' | 'hallKierAlpha' | 'kappa1' | 'kappa2' | 'kappa3' | 'Phi';
755
+ type RDKitDescriptors = Record<RDKitDescriptorNames, number>;
756
+ type RDKitAtom = {
757
+ chg: number;
758
+ /** Implicit Hydrogens count */
759
+ impHs: number;
760
+ isotope: number;
761
+ nRad: number;
762
+ stereo: 'unspecified' | 'cw' | 'ccw' | 'other';
763
+ z: number;
764
+ };
765
+ type RDKitBond = {
766
+ /** Bond order */
767
+ bo: number;
768
+ stereo: 'unspecified' | 'cis' | 'trans' | 'either';
769
+ stereoAtoms: [number, number];
770
+ atoms: [number, number];
771
+ };
772
+ type RDKitExtension = {
773
+ aromaticAtoms?: number[];
774
+ aromaticBonds?: number[];
775
+ atomRings?: number[][];
776
+ cipCodes: [number, 'R' | 'S'][];
777
+ cipRanks: number[];
778
+ formatVersion: number;
779
+ name: 'rdkitRepresentation';
780
+ toolkitVersion: string;
781
+ };
782
+ type RDKitConformer2D = {
783
+ dim: 2;
784
+ coords: [number, number][];
785
+ };
786
+ type RDKitConformer3D = {
787
+ dim: 3;
788
+ coords: [number, number, number][];
789
+ };
790
+ type RDKitMolecule = {
791
+ atoms: Partial<RDKitAtom>[];
792
+ bonds: (Partial<RDKitBond> & Pick<RDKitBond, 'atoms'>)[];
793
+ conformers?: RDKitConformer2D[] | RDKitConformer3D[];
794
+ extensions: RDKitExtension[];
795
+ name: string;
796
+ };
797
+ type RDKitJson = {
798
+ defaults: {
799
+ atom: RDKitAtom;
800
+ bond: RDKitBond;
801
+ };
802
+ molecules: RDKitMolecule[];
803
+ };
804
+ type DrawColour = [number, number, number, number?];
805
+ type ColourPalette = {
806
+ [k: number]: DrawColour;
807
+ };
808
+ type RDKitDepictionDetails = {
809
+ width: number;
810
+ height: number;
811
+ offsetx: number;
812
+ offsety: number;
813
+ atomLabelDeuteriumTritium: boolean;
814
+ dummiesAreAttachments: boolean;
815
+ circleAtoms: boolean;
816
+ splitBonds: boolean;
817
+ highlightColour: DrawColour;
818
+ continuousHighlight: boolean;
819
+ fillHighlights: boolean;
820
+ highlightRadius: number;
821
+ flagCloseContactsDist: number;
822
+ includeAtomTags: boolean;
823
+ clearBackground: boolean;
824
+ backgroundColour: DrawColour;
825
+ legendFontSize: number;
826
+ legendFraction: number;
827
+ maxFontSize: number;
828
+ minFontSize: number;
829
+ fixedFontSize: number;
830
+ annotationFontScale: number;
831
+ fontFile: string;
832
+ legendColour: DrawColour;
833
+ multipleBondOffset: number;
834
+ padding: number;
835
+ additionalAtomLabelPadding: number;
836
+ atomLabels: Record<number, string>;
837
+ noAtomLabels: boolean;
838
+ atomRegions: number[][];
839
+ symbolColour: DrawColour;
840
+ annotationColour: DrawColour;
841
+ bondLineWidth: number;
842
+ scaleBondWidth: number;
843
+ scaleHighlightBondWidth: boolean;
844
+ highlightBondWidthMultiplier: number;
845
+ prepareMolsBeforeDrawing: boolean;
846
+ highlightColourPalette: DrawColour[];
847
+ atomColourPalette: ColourPalette;
848
+ fixedScale: number;
849
+ fixedBondLength: number;
850
+ rotate: number;
851
+ addAtomIndices: boolean;
852
+ addBondIndices: boolean;
853
+ isotopeLabels: boolean;
854
+ dummyIsotopeLabels: boolean;
855
+ addStereoAnnotation: boolean;
856
+ atomHighlightsAreCircles: boolean;
857
+ centreMoleculesBeforeDrawing: boolean;
858
+ explicitMethyl: boolean;
859
+ includeRadicals: boolean;
860
+ includeMetadata: boolean;
861
+ comicMode: boolean;
862
+ variableBondWidthMultiplier: number;
863
+ variableAtomRadius: number;
864
+ variableAttachmentColour: DrawColour;
865
+ includeChiralFlagLabel: boolean;
866
+ simplifiedStereoGroupLabel: boolean;
867
+ unspecifiedStereoIsUnknown: boolean;
868
+ singleColourWedgeBonds: boolean;
869
+ useMolBlockWedging: boolean;
870
+ scalingFactor: number;
871
+ baseFontSize: number;
872
+ drawMolsSameScale: boolean;
873
+ atoms: number[];
874
+ bonds: number[];
875
+ highlightAtomColors: Record<number, DrawColour>;
876
+ highlightBondColors: Record<number, DrawColour>;
877
+ standardColoursForHighlightedAtoms: boolean;
878
+ };
879
+ type RDKitRxnDepictionDetails = RDKitDepictionDetails & {
880
+ highlightByReactant: boolean;
881
+ highlightColorsReactants: DrawColour[];
882
+ };
883
+ type RDKitStereoTags = {
884
+ CIP_atoms: [number, '(S)' | '(R)' | '(?)'][];
885
+ CIP_bonds: [number, number, string][];
886
+ };
887
+ type RDKitRxnDetails = {
888
+ sanitize: boolean;
889
+ useSmiles: boolean;
890
+ removeHs: boolean;
891
+ strictParsing: boolean;
892
+ adjustReactants: boolean;
893
+ mergeQueryHs: boolean;
894
+ };
895
+ type RDKitSubstructMatch = {
896
+ atoms: number[];
897
+ bonds: number[];
898
+ };
899
+ type RDKitGetMolOpt = {
900
+ kekulize: boolean;
901
+ setAromaticity: boolean;
902
+ fastFindRings: boolean;
903
+ mappedDummiesAreRGroups: boolean;
904
+ sanitize: boolean;
905
+ removeHs: boolean;
906
+ assignStereo: boolean;
907
+ mergeQueryHs: boolean;
908
+ };
909
+ type RDKitGetMolBlockOptions = {
910
+ /** @default true */
911
+ includeStereo: boolean;
912
+ /** @default true */
913
+ kekulize: boolean;
914
+ /** @default false */
915
+ useMolBlockWedging: boolean;
916
+ /** @default false */
917
+ addChiralHs: boolean;
918
+ /** @default 'AUTO' */
919
+ forceMDLVersion: 'AUTO' | 'V2000' | 'V3000';
920
+ };
921
+ type RDKitGetSmilesOptions = {
922
+ /** Include stereochemistry and isotope information @default true */
923
+ doIsomericSmiles: boolean;
924
+ /**
925
+ * Kekulize the molecule before generating the SMILES and output
926
+ * single/double bonds. NOTE that the output is not canonical and that this
927
+ * will throw an exception if the molecule cannot be kekulized.
928
+ * @default false
929
+ */
930
+ doKekule: boolean;
931
+ /**
932
+ * Make sure the SMILES starts at the specified atom. The resulting SMILES
933
+ * is not canonical and the value of the canonical parameter will be ignored.
934
+ * @default -1
935
+ */
936
+ rootedAtAtom: number;
937
+ /** Generate canonical SMILES @default true */
938
+ canonical: boolean;
939
+ /** Include symbols for all bonds @default false */
940
+ allBondsExplicit: boolean;
941
+ /** Provide hydrogen counts for every atom @default false */
942
+ allHsExplicit: boolean;
943
+ /**
944
+ * Randomize the output order. The resulting SMILES is not canonical and
945
+ * the value of the canonical parameter will be ignored.
946
+ * @default false
947
+ */
948
+ doRandom: boolean;
949
+ };
950
+ /** CX extension field names (without the `CX_` prefix) */
951
+ type CxSmilesField = 'NONE' | 'ATOM_LABELS' | 'MOLFILE_VALUES' | 'COORDS' | 'RADICALS' | 'ATOM_PROPS' | 'LINKNODES' | 'ENHANCEDSTEREO' | 'SGROUPS' | 'POLYMER' | 'BOND_CFG' | 'BOND_ATROPISOMER' | 'COORDINATE_BONDS' | 'HYDROGEN_BONDS' | 'ZERO_BONDS' | 'ALL' | 'ALL_BUT_COORDS';
952
+ type RDKitGetMCSOptions = {
953
+ MaximizeBonds: boolean;
954
+ Threshold: number;
955
+ Timeout: number;
956
+ InitialSeed: string;
957
+ MatchValences: boolean;
958
+ MatchChiralTag: boolean;
959
+ MatchFormalCharge: boolean;
960
+ /**
961
+ * @alias BondRingMatchesRingOnly
962
+ */
963
+ RingMatchesRingOnly: boolean;
964
+ AtomRingMatchesRingOnly: boolean;
965
+ BondRingMatchesRingOnly: boolean;
966
+ MaxDistance: number;
967
+ /**
968
+ * @alias BondCompleteRingsOnly
969
+ */
970
+ CompleteRingsOnly: boolean;
971
+ AtomCompleteRingsOnly: boolean;
972
+ BondCompleteRingsOnly: boolean;
973
+ /**
974
+ * @alias BondCompleteRingsOnly
975
+ */
976
+ CompleteRingsOnly: boolean;
977
+ MatchFusedRings: boolean;
978
+ MatchFusedRingsStrict: boolean;
979
+ MatchStereo: boolean;
980
+ StoreAll: boolean;
981
+ AtomCompare: 'Elements' | 'Any' | 'Isotopes' | 'AnyHeavy';
982
+ BondCompare: 'Order' | 'Any' | 'OrderExact';
983
+ };
984
+ type RDKitMCSResult = {
985
+ numAtoms: number;
986
+ numBonds: number;
987
+ canceled: boolean;
988
+ /**
989
+ * Can be an array iff option `StoreAll` is set to true
990
+ */
991
+ smarts: string | string[];
992
+ };
993
+ type RDKitMorganFPOptions = {
994
+ /** @default 2 */
995
+ radius: number;
996
+ /** @default 2048 */
997
+ nBits: number;
998
+ /** @default false */
999
+ useCountSimulation: boolean;
1000
+ /** @default false */
1001
+ useChirality: boolean;
1002
+ /** @default true */
1003
+ useBondTypes: boolean;
1004
+ /** @default false */
1005
+ includeRedundantEnvironments: boolean;
1006
+ /** @default false */
1007
+ onlyNonzeroInvariants: boolean;
1008
+ };
1009
+ type RDKitPatternFPOptions = {
1010
+ /** @default 2048 */
1011
+ nBits: number;
1012
+ /** @default false */
1013
+ tautomericFingerprint: boolean;
1014
+ };
1015
+ type RDKitTopologicalTorsionFPOptions = {
1016
+ /** @default 2048 */
1017
+ nBits: number;
1018
+ /** @default false */
1019
+ useChirality: boolean;
1020
+ /** @default 4 */
1021
+ torsionAtomCount: number;
1022
+ /** @default true */
1023
+ useCountSimulation: boolean;
1024
+ };
1025
+ type RDKitRdkitFpOptions = {
1026
+ /** @default 2048 */
1027
+ nBits: number;
1028
+ /** @default 2 */
1029
+ nBitsPerHash: number;
1030
+ /** @default 1 */
1031
+ minPath: number;
1032
+ /** @default 7 */
1033
+ maxPath: number;
1034
+ /** @default true */
1035
+ useBondOrder: boolean;
1036
+ /** @default true */
1037
+ branchedPaths: boolean;
1038
+ /** @default false */
1039
+ useCountSimulation: boolean;
1040
+ /** @default true */
1041
+ useHs: boolean;
1042
+ };
1043
+ type RDKitAtomPairFPOptions = {
1044
+ /** @default 2048 */
1045
+ nBits: number;
1046
+ /** @default false */
1047
+ useChirality: boolean;
1048
+ /** @default 1 */
1049
+ minLength: number;
1050
+ /** @default 30 */
1051
+ maxLength: number;
1052
+ /** @default true */
1053
+ useCountSimulation: boolean;
1054
+ /** @default true */
1055
+ use2D: boolean;
1056
+ };
1057
+ type RDKitRemoveHsOptions = {
1058
+ /** @default false — hydrogens that have no bonds */
1059
+ removeDegreeZero: boolean;
1060
+ /** @default false — hydrogens with two (or more) bonds */
1061
+ removeHigherDegrees: boolean;
1062
+ /** @default false — hydrogens with bonds only to other hydrogens */
1063
+ removeOnlyHNeighbors: boolean;
1064
+ /** @default false — hydrogens with non-default isotopes */
1065
+ removeIsotopes: boolean;
1066
+ /** @default false — removes isotopic Hs, tracks them via _isotopicHs property */
1067
+ removeAndTrackIsotopes: boolean;
1068
+ /** @default false — hydrogens with at least one dummy-atom neighbor */
1069
+ removeDummyNeighbors: boolean;
1070
+ /** @default false — hydrogens defining bond stereochemistry */
1071
+ removeDefiningBondStereo: boolean;
1072
+ /** @default true — hydrogens with wedged bonds */
1073
+ removeWithWedgedBond: boolean;
1074
+ /** @default false — hydrogens with queries defined */
1075
+ removeWithQuery: boolean;
1076
+ /** @default true — mapped hydrogens */
1077
+ removeMapped: boolean;
1078
+ /** @default true — hydrogens in SubstanceGroups */
1079
+ removeInSGroups: boolean;
1080
+ /** @default true — display warnings for Hs that are not removed */
1081
+ showWarnings: boolean;
1082
+ /** @default true @deprecated — equivalent of !implicitOnly */
1083
+ removeNonimplicit: boolean;
1084
+ /** @default false @deprecated */
1085
+ updateExplicitCount: boolean;
1086
+ /** @default false — remove hydrides */
1087
+ removeHydrides: boolean;
1088
+ /** @default false — remove Hs bonded to atoms with non-tetrahedral stereochemistry */
1089
+ removeNontetrahedralNeighbors: boolean;
1090
+ };
1091
+ type RDKitAlignedCoordsOptions = {
1092
+ useCoordGen: boolean;
1093
+ referenceSmarts: string;
1094
+ allowRGroups: boolean;
1095
+ acceptFailure: boolean;
1096
+ alignOnly: boolean;
1097
+ };
1098
+ type RDKitMolZipOptions = {
1099
+ Label: string;
1100
+ AtomSymbols: string[];
1101
+ AtomProperty: string;
1102
+ EnforceValenceRules: boolean;
1103
+ GenerateCoordinates: boolean;
1104
+ AlignCoordinates: boolean;
1105
+ };
1106
+ type RDKitGetRgdOptions = {
1107
+ labels: 'IsotopeLabels' | 'AtomMapLabels' | 'MDLRGroupLabels' | 'DummyAtomLabels' | 'AtomIndexLabels' | 'AutoDetect' | 'RelabelDuplicateLabels';
1108
+ /**
1109
+ * choose where the rlabels are stored on the decomposition
1110
+ * @default "AtomMap | MDLRGroup"
1111
+ * */
1112
+ rgroupLabelling: 'AtomMap' | 'Isotope' | 'MDLRGroup';
1113
+ alignment: 'None' | 'NoAlignment' | 'MCS';
1114
+ scoreMethod: 'Match' | 'FingerprintVariance';
1115
+ matchingStrategy: 'Greedy' | 'GreedyChunks' | 'Exhaustive' | 'NoSymmetrization' | 'GA';
1116
+ /**
1117
+ * only allow rgroup decomposition at the specified rgroups
1118
+ */
1119
+ onlyMatchAtRGroups: boolean;
1120
+ removeAllHydrogenRGroupsAndLabels: boolean;
1121
+ removeHydrogensPostMatch: boolean;
1122
+ allowNonTerminalRGroups: boolean;
1123
+ doTautomers: boolean;
1124
+ doEnumeration: boolean;
1125
+ allowMultipleRGroupsOnUnlabelled: boolean;
1126
+ allowMultipleCoresInSameMol: boolean;
1127
+ includeTargetMolInResults: boolean;
1128
+ timeout: number;
1129
+ chunkSize: number;
1130
+ };
1131
+ //#endregion
1132
+ //#region src/mol-array.d.ts
1133
+ /**
1134
+ * An array of {@link Mol} instances with batch lifecycle management.
1135
+ *
1136
+ * Extends the native `Array` so all standard array methods (indexing,
1137
+ * iteration, `map`, `filter`, …) work out of the box.
1138
+ *
1139
+ * Call {@link delete} (or use the `using` keyword) to delete every `Mol`
1140
+ * in the array at once.
1141
+ */
1142
+ declare class MolArray extends Array<Mol> implements Disposable {
1143
+ /** Deletes every Mol in this array */
1144
+ delete(): void;
1145
+ /** Disposable support — allows use with the `using` keyword */
1146
+ [Symbol.dispose](): void;
1147
+ }
1148
+ //#endregion
1149
+ //#region src/types/inchi.d.ts
1150
+ type InChI_Flags = 'DoNotAddH' | 'SNon' | 'SRel' | 'SRac' | 'SUCF' | 'ChiralFlagON' | 'ChiralFlagOff' | 'SUU' | 'SLUUD' | 'FixedH' | 'RecMet' | 'KET' | '15T' | 'AuxNone';
1151
+ //#endregion
1152
+ //#region src/types/rdkit-esm.typings.d.ts
1153
+ /** Wrapper-level CX SMILES options with ergonomic `fields` array */
1154
+ type RDKitGetCxSmilesOptions = RDKitGetSmilesOptions & {
1155
+ /** CX extension fields to include. Omit for all fields (default). Empty array for none. */
1156
+ fields: CxSmilesField[];
1157
+ /** Restore bond direction option. Accepts `true`, `'true'`, or `'clear'`. */
1158
+ restoreBondDirOption: true | 'true' | 'clear';
1159
+ };
1160
+ //#endregion
1161
+ //#region src/mol.d.ts
1162
+ /**
1163
+ * A wrapper around RDKit's JSMol object providing a typed, camelCase API.
1164
+ *
1165
+ * @remarks
1166
+ * Mol instances are created via RDKit.getMol or RDKit.getQMol,
1167
+ * not directly by consumers. The underlying `jsMol` is accessible for advanced use cases.
1168
+ *
1169
+ * Implements `Disposable` for use with the `using` keyword:
1170
+ * ```ts
1171
+ * using mol = rdkit.getMol('c1ccccc1')!;
1172
+ * const svg = mol.getSvg();
1173
+ * // mol is automatically deleted when the scope exits
1174
+ * ```
1175
+ */
1176
+ declare class Mol implements Disposable {
1177
+ #private;
1178
+ constructor(jsMol: JSMol, module: RDKitModule);
1179
+ /**
1180
+ * The underlying JSMol object for direct access to the raw API.
1181
+ * @throws If the molecule has been deleted.
1182
+ */
1183
+ get jsMol(): JSMol;
1184
+ /**
1185
+ * Resolves a substructure query argument to a JSMol.
1186
+ * If the query is a string, creates a temporary query molecule.
1187
+ * @returns A tuple of [jsMol, shouldDelete] where shouldDelete indicates
1188
+ * whether the caller is responsible for deleting the JSMol.
1189
+ */
1190
+ private resolveQuery;
1191
+ /** Returns the canonical SMILES string */
1192
+ getSmiles(options?: RDKitGetSmilesOptions): string;
1193
+ /** Returns the Chemaxon Extended SMILES string */
1194
+ getCxSmiles(options?: Partial<RDKitGetCxSmilesOptions>): string;
1195
+ /** Returns the SMARTS string */
1196
+ getSmarts(options?: RDKitGetSmilesOptions): string;
1197
+ /** Returns the Chemaxon Extended SMARTS string */
1198
+ getCxSmarts(options?: Partial<RDKitGetCxSmilesOptions>): string;
1199
+ /**
1200
+ * Returns the V2000 Molfile string
1201
+ * @param options - Molblock generation options
1202
+ */
1203
+ getMolblock(options?: Partial<RDKitGetMolBlockOptions>): string;
1204
+ /**
1205
+ * Returns the V3000 Molfile string
1206
+ * @param options - Molblock generation options
1207
+ */
1208
+ getV2KMolblock(options?: Partial<RDKitGetMolBlockOptions>): string;
1209
+ /**
1210
+ * Returns the V3000 Molfile string
1211
+ * @param options - Molblock generation options
1212
+ */
1213
+ getV3KMolblock(options?: Partial<RDKitGetMolBlockOptions>): string;
1214
+ /**
1215
+ * Returns the InChI string
1216
+ * @param args - Optional InChI CLI arguments
1217
+ * @example mol.getInchi(["FixedH", "RecMet", "SaveOpt", "SUU", "SLUUD"])
1218
+ */
1219
+ getInchi(args?: InChI_Flags[]): string;
1220
+ /**
1221
+ * Returns the InChIKey string
1222
+ * @param args - Optional InChI CLI arguments
1223
+ * @example mol.getInchi(["FixedH", "RecMet", "SaveOpt", "SUU", "SLUUD"])
1224
+ */
1225
+ getInchikey(args?: InChI_Flags[]): string;
1226
+ /** Returns the parsed JSON representation of the molecule */
1227
+ getJson(): RDKitJson;
1228
+ /** Returns an unsigned integer array representation of the molecule */
1229
+ getAsUint8Array(): Uint8Array;
1230
+ /**
1231
+ * Returns an SVG depiction of the molecule
1232
+ *
1233
+ * @param options - Drawing options including dimensions and highlighting.
1234
+ * When omitted, uses RDKit defaults (250×200).
1235
+ *
1236
+ * @example
1237
+ * // Default SVG
1238
+ * const svg = mol.getSvg();
1239
+ *
1240
+ * // Custom size with atom indices
1241
+ * const svg = mol.getSvg({ width: 400, height: 300, addAtomIndices: true });
1242
+ *
1243
+ * // With atom highlighting
1244
+ * const svg = mol.getSvg({ atoms: [0, 1, 2], highlightColour: [1, 0, 0, 1] });
1245
+ */
1246
+ getSvg(options?: Partial<RDKitDepictionDetails>): string;
1247
+ /**
1248
+ * Returns the first substructure match
1249
+ *
1250
+ * @param query - A Mol instance or a SMARTS string to use as query
1251
+ * @returns The matched atom and bond indices
1252
+ */
1253
+ getSubstructMatch(query: Mol | string): RDKitSubstructMatch;
1254
+ /**
1255
+ * Returns all substructure matches
1256
+ *
1257
+ * @param query - A Mol instance or a SMARTS string to use as query
1258
+ * @returns An array of matched atom and bond indices
1259
+ */
1260
+ getSubstructMatches(query: Mol | string): RDKitSubstructMatch[];
1261
+ /** Returns molecular descriptors as a typed object */
1262
+ getDescriptors(): RDKitDescriptors | null;
1263
+ /**
1264
+ * Returns the Morgan fingerprint as a bit string
1265
+ * @param options - Fingerprint options
1266
+ */
1267
+ getMorganFp(options?: Partial<RDKitMorganFPOptions>): string;
1268
+ /** Returns the pattern fingerprint as a bit string */
1269
+ getPatternFp(options?: Partial<RDKitPatternFPOptions>): string;
1270
+ /** Returns the topological torsion fingerprint as a bit string */
1271
+ getTopologicalTorsionFp(options?: Partial<RDKitTopologicalTorsionFPOptions>): string;
1272
+ /** Returns the RDKit fingerprint as a bit string */
1273
+ getRdkitFp(options?: Partial<RDKitRdkitFpOptions>): string;
1274
+ /** Returns the atom pair fingerprint as a bit string */
1275
+ getAtomPairFp(options?: Partial<RDKitAtomPairFPOptions>): string;
1276
+ /** Returns the MACCS fingerprint as a bit string (fixed 167-bit) */
1277
+ getMaccsFp(): string;
1278
+ /** Returns the Morgan fingerprint as a Uint8Array */
1279
+ getMorganFpAsUint8Array(options?: Partial<RDKitMorganFPOptions>): Uint8Array;
1280
+ /** Returns the pattern fingerprint as a Uint8Array */
1281
+ getPatternFpAsUint8Array(options?: Partial<RDKitPatternFPOptions>): Uint8Array;
1282
+ /** Returns the topological torsion fingerprint as a Uint8Array */
1283
+ getTopologicalTorsionFpAsUint8Array(options?: Partial<RDKitTopologicalTorsionFPOptions>): Uint8Array;
1284
+ /** Returns the RDKit fingerprint as a Uint8Array */
1285
+ getRdkitFpAsUint8Array(options?: Partial<RDKitRdkitFpOptions>): Uint8Array;
1286
+ /** Returns the atom pair fingerprint as a Uint8Array */
1287
+ getAtomPairFpAsUint8Array(options?: Partial<RDKitAtomPairFPOptions>): Uint8Array;
1288
+ /** Returns the MACCS fingerprint as a Uint8Array */
1289
+ getMaccsFpAsUint8Array(): Uint8Array;
1290
+ /**
1291
+ * Checks whether the molecule has a given property
1292
+ * @param key - Property name
1293
+ */
1294
+ hasProp(key: string): boolean;
1295
+ /**
1296
+ * Gets a property value from the molecule
1297
+ * @param key - Property name
1298
+ */
1299
+ getProp(key: string): string;
1300
+ /**
1301
+ * Sets a property on the molecule
1302
+ * @param key - Property name
1303
+ * @param val - Property value
1304
+ */
1305
+ setProp(key: string, val: string): boolean;
1306
+ /**
1307
+ * Clears a property from the molecule
1308
+ * @param key - Property name
1309
+ */
1310
+ clearProp(key: string): boolean;
1311
+ /**
1312
+ * Returns the list of property names
1313
+ * @param options - Filter options
1314
+ */
1315
+ getPropList(options?: {
1316
+ includePrivate?: boolean;
1317
+ includeComputed?: boolean;
1318
+ }): string[];
1319
+ /** Returns true if the molecule's structure is valid */
1320
+ isValid(): boolean;
1321
+ /** Returns the number of atoms in the molecule */
1322
+ getNumAtoms(): number;
1323
+ /** Returns the number of bonds in the molecule */
1324
+ getNumBonds(): number;
1325
+ /** Returns 0 if no coords, 2 for 2D, 3 for 3D */
1326
+ hasCoords(): 0 | 2 | 3;
1327
+ /** Returns stereo tags (CIP codes) for the molecule */
1328
+ getStereoTags(): RDKitStereoTags;
1329
+ /** Returns the V2000 Molfile representation of the aromatic form */
1330
+ getAromaticForm(): string;
1331
+ /** Returns the V2000 Molfile representation of the Kekule form */
1332
+ getKekuleForm(): string;
1333
+ /** Converts the molecule to aromatic form in place */
1334
+ convertToAromaticForm(): void;
1335
+ /** Converts the molecule to Kekule form in place */
1336
+ convertToKekuleForm(): void;
1337
+ /**
1338
+ * Returns a V2000 Molfile string with explicit hydrogens removed
1339
+ * @param options - Options controlling which hydrogens to remove
1340
+ */
1341
+ removeHs(options?: Partial<RDKitRemoveHsOptions>): string;
1342
+ /**
1343
+ * Removes explicit hydrogens from the molecule in place
1344
+ * @param options - Options controlling which hydrogens to remove
1345
+ */
1346
+ removeHsInPlace(options?: Partial<RDKitRemoveHsOptions>): boolean;
1347
+ /** Returns a V2000 Molfile string with explicit hydrogens added */
1348
+ addHs(): string;
1349
+ /** Adds explicit hydrogens to the molecule in place */
1350
+ addHsInPlace(): boolean;
1351
+ combineWith(other: Mol, options?: {
1352
+ offset: [number, number, number];
1353
+ }): void;
1354
+ zipWith(other: Mol, options?: RDKitMolZipOptions): void;
1355
+ /**
1356
+ * Generates new 2D coordinates for the molecule
1357
+ * @param useCoordGen - Use the CoordGen algorithm
1358
+ */
1359
+ setNewCoords(useCoordGen?: boolean): boolean;
1360
+ /**
1361
+ * Returns a V2000 Molfile string with newly generated coordinates
1362
+ * @param useCoordGen - Use the CoordGen algorithm
1363
+ */
1364
+ getNewCoords(useCoordGen?: boolean): string;
1365
+ /**
1366
+ * Aligns molecule coordinates with a template molecule
1367
+ * @param template - Template molecule to align to
1368
+ * @param options - Alignment options
1369
+ */
1370
+ generateAlignedCoords(template: Mol, options?: Partial<RDKitAlignedCoordsOptions>): string;
1371
+ /**
1372
+ * Normalizes the depiction of the molecule
1373
+ * @param options - Normalization options
1374
+ */
1375
+ normalizeDepiction(options?: {
1376
+ canonicalize?: number;
1377
+ scaleFactor?: number;
1378
+ }): number;
1379
+ /**
1380
+ * Straightens the depiction of the molecule
1381
+ * @param smallRotation - Only apply small rotations
1382
+ */
1383
+ straightenDepiction(smallRotation?: boolean): void;
1384
+ /**
1385
+ * Condenses functional group abbreviations in the molecule
1386
+ * @param options - Abbreviation options
1387
+ */
1388
+ condenseAbbreviations(options?: {
1389
+ maxCoverage?: number;
1390
+ useLinkers?: boolean;
1391
+ }): string;
1392
+ drawToCanvas(canvas: HTMLCanvasElement, options?: Partial<RDKitDepictionDetails>): void;
1393
+ /**
1394
+ * Returns the disconnected fragments of the molecule
1395
+ * @warning The `mols` array contains new `Mol` instances that must be
1396
+ * manually deleted by the caller to avoid memory leaks.
1397
+ * @returns An object with atom/fragment mappings and a `MolArray` of fragments
1398
+ */
1399
+ getFrags(): {
1400
+ mappings: {
1401
+ atomToFrag: number[];
1402
+ fragToAtoms: number[][];
1403
+ };
1404
+ mols: MolArray;
1405
+ };
1406
+ /** Returns a copy of the molecule */
1407
+ copy(): Mol;
1408
+ /**
1409
+ * Deletes the underlying C++ molecule object from memory.
1410
+ *
1411
+ * @see {@link https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management | Emscripten docs}
1412
+ */
1413
+ delete(): void;
1414
+ /** Disposable support — allows use with the `using` keyword */
1415
+ [Symbol.dispose](): void;
1416
+ }
1417
+ //#endregion
1418
+ //#region src/reaction.d.ts
1419
+ /**
1420
+ * A wrapper around RDKit's JSReaction object providing a typed, camelCase API.
1421
+ *
1422
+ * @remarks
1423
+ * Reaction instances are created via {@link RDKit.getRxn}, not directly by consumers.
1424
+ *
1425
+ * Implements `Disposable` for use with the `using` keyword:
1426
+ * ```ts
1427
+ * using rxn = rdkit.getRxn('[CH3:1][OH:2]>>[CH2:1]=[OH0:2]')!;
1428
+ * const products = rxn.runReactants(['CO']);
1429
+ * ```
1430
+ */
1431
+ declare class Reaction implements Disposable {
1432
+ #private;
1433
+ constructor(jsReaction: JSReaction, module: RDKitModule);
1434
+ /**
1435
+ * The underlying JSReaction object for direct access to the raw API.
1436
+ * @throws If the reaction has been deleted.
1437
+ */
1438
+ get jsReaction(): JSReaction;
1439
+ /**
1440
+ * Runs the reaction on a set of reactants.
1441
+ *
1442
+ * Returns an array of product sets. Each product set is an array of `Mol`
1443
+ * instances corresponding to one match between the reactants and the
1444
+ * reaction definition.
1445
+ *
1446
+ * **WARNING:** The caller is responsible for deleting each returned `Mol`
1447
+ * (via `.delete()` or `using`) to avoid memory leaks.
1448
+ *
1449
+ * @param reactants - An array of Mol instances or molecule strings
1450
+ * (SMILES, MolBlocks, etc.)
1451
+ * @param maxProducts - Maximum number of product sets to return (default: 1000)
1452
+ * @returns An array of product sets, where each set is an array of Mol instances
1453
+ */
1454
+ runReactants(reactants: Mol[] | string[], maxProducts?: number): MolArray[];
1455
+ /**
1456
+ * Returns an SVG depiction of the reaction
1457
+ *
1458
+ * @param options - Drawing options including highlighting.
1459
+ * When omitted, uses RDKit defaults.
1460
+ */
1461
+ getSvg(options?: Partial<RDKitRxnDepictionDetails>): string;
1462
+ /**
1463
+ * Draws the reaction to an HTML5 canvas with highlighting options
1464
+ * @param canvas - Target canvas element
1465
+ * @param options - Drawing options including dimensions and highlighting
1466
+ */
1467
+ drawToCanvas(canvas: HTMLCanvasElement, options: Partial<RDKitRxnDepictionDetails>): void;
1468
+ /**
1469
+ * Deletes the underlying C++ reaction object from memory.
1470
+ *
1471
+ * @see {@link https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management | Emscripten docs}
1472
+ */
1473
+ delete(): void;
1474
+ /** Disposable support — allows use with the `using` keyword */
1475
+ [Symbol.dispose](): void;
1476
+ }
1477
+ //#endregion
1478
+ //#region src/rgd.d.ts
1479
+ /**
1480
+ * A row from R-Group Decomposition, mapping labels like `Core`, `R1`, `R2`, …
1481
+ * to Mol instances.
1482
+ */
1483
+ type RGDRow = Record<string, Mol>;
1484
+ //#endregion
1485
+ //#region src/init.d.ts
1486
+ /** Options for initializing the RDKit module */
1487
+ interface InitRDKitOptions {
1488
+ /**
1489
+ * Custom function to locate the WASM file.
1490
+ * By default, the WASM file is resolved relative to the bundled JS output
1491
+ * using the Vite/Rolldown `?url` import.
1492
+ */
1493
+ locateFile?: () => string;
1494
+ }
1495
+ /** The main RDKit wrapper interface returned by {@link initRDKit} */
1496
+ interface RDKit {
1497
+ /**
1498
+ * Creates a molecule from a variety of input formats.
1499
+ *
1500
+ * @param input - SMILES, SMARTS, MolFile, or JSON string
1501
+ * @param options - Molecule parsing options
1502
+ * @returns A Mol instance, or null if the input is invalid
1503
+ */
1504
+ getMol(input: string, options?: Partial<RDKitGetMolOpt>): Mol | null;
1505
+ /**
1506
+ * Creates a query molecule from a SMARTS string.
1507
+ *
1508
+ * @param input - SMARTS string
1509
+ * @returns A Mol instance, or null if the input is invalid
1510
+ */
1511
+ getQMol(input: string): Mol | null;
1512
+ /**
1513
+ * Computes the Maximum Common Substructure (MCS) of a set of molecules.
1514
+ *
1515
+ * @param mols - An array of Mol instances or SMILES strings
1516
+ * @param options - MCS algorithm options
1517
+ * @returns An MCSResult with match info and a lazy `qmol` getter
1518
+ */
1519
+ getMCS(mols: Mol[] | string[], options?: Partial<RDKitGetMCSOptions>): MCSResult;
1520
+ /**
1521
+ * Creates a Reaction from a reaction SMARTS, SMILES, or RXN block.
1522
+ *
1523
+ * @param input - Reaction SMARTS, SMILES, or RXN block string
1524
+ * @param options - Reaction parsing options
1525
+ * @returns A Reaction instance, or null if the input is invalid
1526
+ */
1527
+ getRxn(input: string, options?: Partial<RDKitRxnDetails>): Reaction | null;
1528
+ /**
1529
+ * Performs R-Group Decomposition on a set of molecules against one or more cores.
1530
+ *
1531
+ * **WARNING:** The caller is responsible for deleting each `Mol` in the
1532
+ * returned rows (via `.delete()` or `using`) to avoid memory leaks.
1533
+ *
1534
+ * @param core - Core structure(s): a SMARTS string, an array of SMARTS strings,
1535
+ * a Mol instance, or an array of Mol instances
1536
+ * @param molecules - Molecules to decompose: an array of SMILES strings or Mol instances
1537
+ * @param options - R-Group decomposition options
1538
+ * @returns An array of rows, one per molecule. Each row maps R-group labels
1539
+ * (`Core`, `R1`, `R2`, …) to Mol instances.
1540
+ */
1541
+ getRGD(core: string | string[] | Mol | Mol[], molecules: string[] | Mol[], options?: Partial<RDKitGetRgdOptions>): RGDRow[] | null;
1542
+ molzip(mol1: Mol, mol2: Mol): Mol | null;
1543
+ /** Returns the RDKit version string */
1544
+ version: string;
1545
+ /** The underlying RDKitModule for direct access to the raw API */
1546
+ readonly module: RDKitModule;
1547
+ }
1548
+ /** Result of a Maximum Common Substructure (MCS) computation */
1549
+ interface MCSResult {
1550
+ numAtoms: number;
1551
+ numBonds: number;
1552
+ canceled: boolean;
1553
+ /** SMARTS string(s) — an array when the `StoreAll` option is used */
1554
+ smarts: string | string[];
1555
+ /**
1556
+ * Lazily creates a query Mol from the first SMARTS.
1557
+ * Returns null if SMARTS is empty.
1558
+ *
1559
+ * **WARNING:** The caller is responsible for explicitly deleting this
1560
+ * object (via `.delete()` or `using`) to avoid memory leaks.
1561
+ */
1562
+ get qmol(): Mol | null;
1563
+ }
1564
+ /**
1565
+ * Initializes the RDKit WASM module and returns a typed wrapper.
1566
+ *
1567
+ * @param options - Initialization options
1568
+ * @returns A promise that resolves to the RDKit wrapper
1569
+ *
1570
+ * @example
1571
+ * ```ts
1572
+ * const rdkit = await initRDKit();
1573
+ * const mol = rdkit.getMol('c1ccccc1');
1574
+ * ```
1575
+ */
1576
+ declare function initRDKit(options?: InitRDKitOptions): Promise<RDKit>;
1577
+ //#endregion
1578
+ export { type InitRDKitOptions, type JSMol, type JSReaction, type MCSResult, Mol, MolArray, type MolList, type RDKit, type RDKitAlignedCoordsOptions, type RDKitAtomPairFPOptions, type RDKitDepictionDetails, type RDKitDescriptors, type RDKitGetMCSOptions, type RDKitGetMolBlockOptions, type RDKitGetMolOpt, type RDKitGetRgdOptions, type RDKitGetSmilesOptions, type RDKitJson, type RDKitMCSResult, type RDKitModule, type RDKitMorganFPOptions, type RDKitPatternFPOptions, type RDKitRdkitFpOptions, type RDKitRemoveHsOptions, type RDKitRxnDetails, type RDKitStereoTags, type RDKitSubstructMatch, type RDKitTopologicalTorsionFPOptions, type RGDRow, Reaction, initRDKit };