@kent-tokyo/chematic 0.1.19 → 0.1.21

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.
@@ -1,6 +1,64 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * A conformer ensemble: one molecule geometry with multiple 3D coordinate sets.
6
+ *
7
+ * Create with `new(smiles)`, then add conformers with `add_generated_conformer`
8
+ * or `add_minimized_conformer`. Retrieve coordinates as PDB strings via
9
+ * `get_conformer_pdb(idx)`. Compare conformers with `conformer_rmsd`.
10
+ */
11
+ export class ConformerHandle {
12
+ free(): void;
13
+ [Symbol.dispose](): void;
14
+ /**
15
+ * Generate a new 3D conformer using distance-geometry and add it to the ensemble.
16
+ *
17
+ * Returns the index of the newly added conformer.
18
+ */
19
+ add_generated_conformer(): number;
20
+ /**
21
+ * Generate a new 3D conformer, run force-field minimization, and add it.
22
+ *
23
+ * Returns the index of the newly added conformer.
24
+ */
25
+ add_minimized_conformer(): number;
26
+ /**
27
+ * Number of conformers currently stored.
28
+ */
29
+ conformer_count(): number;
30
+ /**
31
+ * Kabsch-aligned RMSD (Å) between conformers `a` and `b`.
32
+ *
33
+ * Returns `NaN` if either index is out of range.
34
+ */
35
+ conformer_rmsd(a: number, b: number): number;
36
+ /**
37
+ * Un-aligned (translation + rotation NOT removed) RMSD (Å) between conformers `a` and `b`.
38
+ *
39
+ * Returns `NaN` if either index is out of range.
40
+ */
41
+ conformer_rmsd_no_align(a: number, b: number): number;
42
+ /**
43
+ * Return conformer `idx` as a PDB string, or `null` if `idx` is out of range.
44
+ */
45
+ get_conformer_pdb(idx: number): string | undefined;
46
+ /**
47
+ * The ensemble's molecule as a `MolHandle`.
48
+ */
49
+ mol(): MolHandle;
50
+ /**
51
+ * Create a new empty ensemble for the molecule given by `smiles`.
52
+ *
53
+ * Returns a JS error on SMILES parse failure.
54
+ */
55
+ constructor(smiles: string);
56
+ /**
57
+ * Remove conformer `idx` and return `true`, or `false` if `idx` is out of range.
58
+ */
59
+ remove_conformer(idx: number): boolean;
60
+ }
61
+
4
62
  /**
5
63
  * Style options for [`MolHandle::depict_svg_opts`].
6
64
  *
@@ -200,6 +258,10 @@ export class MolHandle {
200
258
  * Number of non-aromatic rings containing at least one heteroatom.
201
259
  */
202
260
  num_aliphatic_heterocycles(): number;
261
+ /**
262
+ * Count of aliphatic (non-aromatic) rings in the SSSR.
263
+ */
264
+ num_aliphatic_rings(): number;
203
265
  /**
204
266
  * Number of aromatic rings containing at least one heteroatom (N, O, S, …).
205
267
  */
@@ -216,6 +278,10 @@ export class MolHandle {
216
278
  * Number of fully saturated rings containing at least one heteroatom.
217
279
  */
218
280
  num_saturated_heterocycles(): number;
281
+ /**
282
+ * Count of fully saturated rings in the SSSR.
283
+ */
284
+ num_saturated_rings(): number;
219
285
  /**
220
286
  * Number of spiro atoms (sole shared atom between exactly 2 rings).
221
287
  */
@@ -224,6 +290,10 @@ export class MolHandle {
224
290
  * Number of assigned stereocenters (R/S).
225
291
  */
226
292
  num_stereocenters(): number;
293
+ /**
294
+ * Count of tetrahedral stereocenters with unspecified configuration.
295
+ */
296
+ num_unspecified_stereocenters(): number;
227
297
  /**
228
298
  * Returns `true` if the molecule has no PAINS structural alerts.
229
299
  */
@@ -268,6 +338,11 @@ export class MolHandle {
268
338
  */
269
339
  export function add_hydrogens(mol: MolHandle): MolHandle;
270
340
 
341
+ /**
342
+ * AtomPair fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
343
+ */
344
+ export function atom_pair_bitvec(mol: MolHandle): Uint8Array;
345
+
271
346
  /**
272
347
  * Number of BRICS fragments produced by fragmenting the molecule.
273
348
  *
@@ -275,6 +350,94 @@ export function add_hydrogens(mol: MolHandle): MolHandle;
275
350
  */
276
351
  export function brics_fragment_count(mol: MolHandle): number;
277
352
 
353
+ /**
354
+ * BRICS fragment SMILES as a JSON array.
355
+ *
356
+ * Applies the BRICS fragmentation rules and returns the canonical SMILES of
357
+ * every resulting fragment. Returns `[]` for molecules with no BRICS-breakable
358
+ * bonds (e.g. benzene).
359
+ *
360
+ * The count of fragments equals `brics_fragment_count`.
361
+ */
362
+ export function brics_fragments_json(mol: MolHandle): string;
363
+
364
+ /**
365
+ * Cluster molecules by structural similarity (Butina algorithm, ECFP4 Tanimoto).
366
+ *
367
+ * `smiles_json` — a JSON array of SMILES strings.
368
+ * `cutoff` — Tanimoto similarity threshold (0.0–1.0); molecules within this
369
+ * distance of a cluster centre are assigned to that cluster.
370
+ * Returns a JSON array of clusters, each cluster being an array of 0-based input indices.
371
+ * Returns a JS error if any SMILES fails to parse.
372
+ */
373
+ export function butina_cluster_ecfp4_json(smiles_json: string, cutoff: number): string;
374
+
375
+ /**
376
+ * Canonical tautomer of `mol`.
377
+ *
378
+ * Applies a rule-based tautomer normalisation and returns the canonical form
379
+ * as a new `MolHandle`.
380
+ */
381
+ export function canonical_tautomer(mol: MolHandle): MolHandle;
382
+
383
+ /**
384
+ * Parse all molecular fragments from a CDXML string.
385
+ *
386
+ * Returns a JSON array of SMILES strings, one per fragment:
387
+ * `["CC","c1ccccc1"]`
388
+ *
389
+ * Stereochemistry (wedge/dash bonds) is read from the `Display` attribute
390
+ * of bond elements.
391
+ */
392
+ export function cdxml_to_smiles_json(cdxml: string): string;
393
+
394
+ /**
395
+ * CIP stereo assignments as a JSON array of `{atomIdx, cipCode}` objects.
396
+ *
397
+ * `cipCode` is one of `"R"`, `"S"`, `"E"`, or `"Z"`.
398
+ * Returns `[]` for molecules with no specified stereocenters.
399
+ */
400
+ export function cip_assignments_json(mol: MolHandle): string;
401
+
402
+ /**
403
+ * Return the CPK color (CSS hex string) for the given element symbol.
404
+ *
405
+ * Returns `"#000000"` (black) for carbon and unknown elements.
406
+ */
407
+ export function cpk_color(element_symbol: string): string;
408
+
409
+ /**
410
+ * Compute structured depiction data for `mol` as a JSON object.
411
+ *
412
+ * Returns:
413
+ * ```json
414
+ * {
415
+ * "atoms": [
416
+ * {"idx": 0, "element": "C", "x": 1.5, "y": 0.0, "charge": 0,
417
+ * "label": null, "color": "#000000"},
418
+ * ...
419
+ * ],
420
+ * "bonds": [
421
+ * {"idx": 0, "atom1": 0, "atom2": 1, "kind": "Single"},
422
+ * ...
423
+ * ]
424
+ * }
425
+ * ```
426
+ *
427
+ * `label` is `null` for carbon atoms in skeletal structures (label suppressed).
428
+ * `kind` is one of `"Single"`, `"Double"`, `"Triple"`, `"Aromatic"`, `"Up"`, `"Down"`.
429
+ */
430
+ export function depict_data_json(mol: MolHandle): string;
431
+
432
+ /**
433
+ * Compute structured depiction data using caller-supplied 2D coordinates.
434
+ *
435
+ * `coords_json` — JSON array of `[x, y]` pairs, one per atom in order.
436
+ *
437
+ * Returns the same JSON format as `depict_data_json`.
438
+ */
439
+ export function depict_data_with_coords_json(mol: MolHandle, coords_json: string): string;
440
+
278
441
  /**
279
442
  * Render a reaction SMILES string (e.g. `"CC(=O)O.CCO>>CC(=O)OCC.O"`) as a
280
443
  * single SVG showing reactants → products with `+` separators.
@@ -291,6 +454,19 @@ export function depict_reaction_svg(rxn_smiles: string): string;
291
454
  */
292
455
  export function depict_svg_grid(smiles_block: string, cols: number): string;
293
456
 
457
+ /**
458
+ * Render a molecule grid with SMARTS-based atom highlighting.
459
+ *
460
+ * `smiles_block` — newline-separated SMILES strings (same format as `depict_svg_grid`).
461
+ * `cols` — number of grid columns.
462
+ * `match_smarts` — SMARTS pattern; matched atoms in each molecule are highlighted.
463
+ * Pass an empty string `""` to render without any highlighting.
464
+ *
465
+ * Invalid SMILES are rendered as empty cells; SMARTS parse failure returns an
466
+ * unhighlighted grid (the SMARTS is silently ignored).
467
+ */
468
+ export function depict_svg_grid_highlighted(smiles_block: string, cols: number, match_smarts: string): string;
469
+
294
470
  /**
295
471
  * Detect named functional groups in `mol`.
296
472
  *
@@ -301,11 +477,63 @@ export function depict_svg_grid(smiles_block: string, cols: number): string;
301
477
  */
302
478
  export function detect_functional_groups(mol: MolHandle): string;
303
479
 
480
+ /**
481
+ * Dice similarity between `a` and `b` using ECFP4 fingerprints.
482
+ */
483
+ export function dice_ecfp4(a: MolHandle, b: MolHandle): number;
484
+
485
+ /**
486
+ * Dice similarity between `a` and `b` using ECFP6 fingerprints.
487
+ */
488
+ export function dice_ecfp6(a: MolHandle, b: MolHandle): number;
489
+
490
+ /**
491
+ * Dice similarity between `a` and `b` using MACCS 166-bit fingerprints.
492
+ */
493
+ export function dice_maccs(a: MolHandle, b: MolHandle): number;
494
+
304
495
  /**
305
496
  * Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
306
497
  */
307
498
  export function ecfp4_bitvec(mol: MolHandle): Uint8Array;
308
499
 
500
+ /**
501
+ * ECFP6 (radius-3) fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
502
+ */
503
+ export function ecfp6_bitvec(mol: MolHandle): Uint8Array;
504
+
505
+ /**
506
+ * Compute a fingerprint bit-vector with configurable ECFP radius and bit width.
507
+ *
508
+ * `radius` — Morgan radius (1 = ECFP2, 2 = ECFP4, 3 = ECFP6).
509
+ * `nbits` — bit width; must be one of 256, 512, 1024, or 2048.
510
+ * Returns a `Uint8Array` of `nbits/8` bytes.
511
+ *
512
+ * The hash modulo is applied at fingerprint-generation time (`id % nbits`),
513
+ * so no post-processing fold is needed.
514
+ */
515
+ export function ecfp_bitvec_custom(mol: MolHandle, radius: number, nbits: number): Uint8Array;
516
+
517
+ /**
518
+ * Enumerate all stereoisomers arising from unspecified tetrahedral stereocenters.
519
+ *
520
+ * Only considers carbon stereocenters without explicit `@`/`@@` annotation.
521
+ * Already-specified centers and E/Z double-bond geometry are unchanged.
522
+ * Returns a JSON array of canonical SMILES strings.
523
+ *
524
+ * At most 2^6 = 64 combinations are enumerated; if more than 6 unspecified
525
+ * centers are present this function returns a JS error to avoid combinatorial
526
+ * explosion.
527
+ */
528
+ export function enumerate_stereo_isomers_json(mol: MolHandle): string;
529
+
530
+ /**
531
+ * All enumerated tautomers of `mol` as a JSON array of canonical SMILES strings.
532
+ *
533
+ * Example return value: `["Oc1cccc2ccccc12","O=C1C=CC=Cc2ccccc21"]`
534
+ */
535
+ export function enumerate_tautomers_json(mol: MolHandle): string;
536
+
309
537
  /**
310
538
  * Per-atom EState values as a JSON array of f64.
311
539
  *
@@ -313,11 +541,30 @@ export function ecfp4_bitvec(mol: MolHandle): Uint8Array;
313
541
  */
314
542
  export function estate_indices_json(mol: MolHandle): string;
315
543
 
544
+ /**
545
+ * FCFP4 (pharmacophore, radius-2) fingerprint as a bit-packed byte vector (256 bytes).
546
+ */
547
+ export function fcfp4_bitvec(mol: MolHandle): Uint8Array;
548
+
549
+ /**
550
+ * FCFP6 (pharmacophore, radius-3) fingerprint as a bit-packed byte vector (256 bytes).
551
+ */
552
+ export function fcfp6_bitvec(mol: MolHandle): Uint8Array;
553
+
316
554
  /**
317
555
  * Gasteiger-Marsili PEOE partial charges as a JSON array of f64.
318
556
  */
319
557
  export function gasteiger_charges_json(mol: MolHandle): string;
320
558
 
559
+ /**
560
+ * Generate energy-minimized 3D coordinates and return a PDB string.
561
+ *
562
+ * Runs distance-geometry placement followed by gradient-descent force-field
563
+ * minimization. Geometry quality is better than `generate_3d_pdb` for
564
+ * flexible molecules; the force field is approximate (not MMFF94/UFF).
565
+ */
566
+ export function generate_3d_minimized_pdb(mol: MolHandle): string;
567
+
321
568
  /**
322
569
  * Generate 3D coordinates for the molecule and return a PDB string.
323
570
  *
@@ -326,6 +573,14 @@ export function gasteiger_charges_json(mol: MolHandle): string;
326
573
  */
327
574
  export function generate_3d_pdb(mol: MolHandle): string;
328
575
 
576
+ /**
577
+ * Generic (atom-type-erased) Murcko scaffold of `mol`.
578
+ *
579
+ * All atoms become carbon and all bonds become single bonds, giving the pure
580
+ * graph topology of the scaffold.
581
+ */
582
+ export function generic_murcko_scaffold(mol: MolHandle): MolHandle;
583
+
329
584
  /**
330
585
  * Return information about a single atom as a JSON object.
331
586
  *
@@ -360,6 +615,14 @@ export function get_bond_between(mol: MolHandle, atom1: number, atom2: number):
360
615
  */
361
616
  export function get_bond_info(mol: MolHandle, idx: number): string;
362
617
 
618
+ /**
619
+ * All scalar molecular descriptors as a single JSON object.
620
+ *
621
+ * Keys use camelCase and match the individual `MolHandle` method names.
622
+ * Drug-likeness rule outcomes are included as boolean fields.
623
+ */
624
+ export function get_descriptors_json(mol: MolHandle): string;
625
+
363
626
  /**
364
627
  * Identify functional groups. Returns a JSON array of objects:
365
628
  * `[{"atoms":[0,2,3],"type":"C,N,O"}, …]`
@@ -371,6 +634,34 @@ export function identify_functional_groups(mol: MolHandle): string;
371
634
  */
372
635
  export function is_valid_smiles(s: string): boolean;
373
636
 
637
+ /**
638
+ * Per-atom Labute approximate surface area contributions as a JSON array of f64.
639
+ *
640
+ * Non-finite values (single-atom molecules etc.) are emitted as JSON `null`.
641
+ */
642
+ export function labute_asa_per_atom_json(mol: MolHandle): string;
643
+
644
+ /**
645
+ * Return the largest fragment of `mol` (salt/solvent stripping).
646
+ *
647
+ * For single-component molecules returns a copy of the same molecule.
648
+ */
649
+ export function largest_fragment(mol: MolHandle): MolHandle;
650
+
651
+ /**
652
+ * Per-atom Crippen LogP contributions as a JSON array of f64.
653
+ *
654
+ * Index `i` corresponds to atom `i` in `mol.atoms()` order.
655
+ */
656
+ export function logp_per_atom_json(mol: MolHandle): string;
657
+
658
+ /**
659
+ * MACCS 166-bit structural keys fingerprint as a byte array (21 bytes, LSB-first).
660
+ *
661
+ * Bit `i` (0-indexed) corresponds to MACCS key `i+1`.
662
+ */
663
+ export function maccs_bitvec(mol: MolHandle): Uint8Array;
664
+
374
665
  /**
375
666
  * Find all SMARTS matches in a molecule given only SMILES strings.
376
667
  *
@@ -381,13 +672,86 @@ export function is_valid_smiles(s: string): boolean;
381
672
  export function match_smarts_smiles(smiles: string, smarts: string): string;
382
673
 
383
674
  /**
384
- * Serialize a SMILES string directly to a MOL V2000 block.
675
+ * Select `n` maximally-diverse molecules (MaxMin algorithm, ECFP4 Tanimoto).
676
+ *
677
+ * `smiles_json` — a JSON array of SMILES strings, e.g. `["CC","c1ccccc1","CCO"]`.
678
+ * Returns a JSON array of 0-based indices into the input array.
679
+ * Returns a JS error if any SMILES fails to parse (indices would otherwise shift).
680
+ */
681
+ export function maxmin_picks_ecfp4_json(smiles_json: string, n: number): string;
682
+
683
+ /**
684
+ * Maximum Common Substructure of a set of molecules, returned as a canonical SMILES string.
685
+ *
686
+ * `smiles_json` — a JSON array of at least 2 SMILES strings.
687
+ * Returns the MCS SMILES, or `"null"` when no common substructure was found.
688
+ * Returns a JS error on SMILES parse failure.
689
+ */
690
+ export function mcs_smiles_json(smiles_json: string): string;
691
+
692
+ /**
693
+ * Find matched molecular pairs in a set of molecules as JSON.
694
+ *
695
+ * `smiles_json` — JSON array of SMILES strings to analyze.
696
+ *
697
+ * Returns a JSON array of matched pairs:
698
+ * ```json
699
+ * [
700
+ * {
701
+ * "mol_a": "CC(=O)Oc1ccccc1",
702
+ * "mol_b": "CC(=O)Nc1ccccc1",
703
+ * "core": "c1ccccc1[*]",
704
+ * "fragment_a": "[*]OC(C)=O",
705
+ * "fragment_b": "[*]NC(C)=O"
706
+ * }
707
+ * ]
708
+ * ```
709
+ *
710
+ * Each pair represents molecules that share a common core scaffold but differ
711
+ * by exactly one structural fragment at a single BRICS-breakable bond cut.
712
+ *
713
+ * Returns a JS error if any SMILES fails to parse.
714
+ */
715
+ export function mmp_pairs_json(smiles_json: string): string;
716
+
717
+ /**
718
+ * Parse a MOL V2000 string and return 2D coordinates as a JSON array.
719
+ *
720
+ * Returns `[[x0,y0],[x1,y1],...]` in atom-insertion order.
721
+ * Coordinates are in Ångström as stored in the MOL file.
722
+ */
723
+ export function mol_block_coords_json(mol_block: string): string;
724
+
725
+ /**
726
+ * Serialize a SMILES string directly to a MOL V2000 block with 2D coordinates.
385
727
  *
386
- * Convenience wrapper; all atom coordinates are 0.0.
387
728
  * Returns a JS error on SMILES parse failure.
388
729
  */
389
730
  export function mol_block_from_smiles(smiles: string): string;
390
731
 
732
+ /**
733
+ * Parse a ChemDraw XML (CDXML) string into a `MolHandle`.
734
+ *
735
+ * Only the first molecular fragment in the document is returned.
736
+ * Returns a JS error if the document cannot be parsed.
737
+ */
738
+ export function mol_from_cdxml(cdxml: string): MolHandle;
739
+
740
+ /**
741
+ * Parse a CML string into a `MolHandle`.
742
+ *
743
+ * Returns a JS error if the CML is invalid (unknown element, bad bond, etc.).
744
+ */
745
+ export function mol_from_cml(cml: string): MolHandle;
746
+
747
+ /**
748
+ * Parse a PDB file and return a `MolHandle` (topology only; coordinates are discarded).
749
+ *
750
+ * Uses CONECT records for connectivity if present; otherwise infers bonds from
751
+ * atom distances (the same heuristic as the internal `pdb_to_molecule` function).
752
+ */
753
+ export function mol_from_pdb(pdb: string): MolHandle;
754
+
391
755
  /**
392
756
  * Parse a MOL V2000 block and return a `MolHandle`.
393
757
  *
@@ -395,6 +759,107 @@ export function mol_block_from_smiles(smiles: string): string;
395
759
  */
396
760
  export function mol_from_sdf_block(block: string): MolHandle;
397
761
 
762
+ /**
763
+ * Parse a MOL V3000 block and return a `MolHandle`.
764
+ *
765
+ * Returns a JS error string on parse failure.
766
+ */
767
+ export function mol_from_v3000_block(block: string): MolHandle;
768
+
769
+ /**
770
+ * Parse an XYZ file and return a `MolHandle` (topology only; coordinates are discarded).
771
+ *
772
+ * Returns a JS error on parse failure.
773
+ */
774
+ export function mol_from_xyz(xyz: string): MolHandle;
775
+
776
+ /**
777
+ * Return the index that would be assigned to an atom appended to `mol`.
778
+ */
779
+ export function mol_next_atom_idx(mol: MolHandle): number;
780
+
781
+ /**
782
+ * Return a new `MolHandle` with one atom appended.
783
+ *
784
+ * The second return value is the new atom's index (as a JS number).
785
+ * Use `with_atom_added_idx` to retrieve the index.
786
+ */
787
+ export function mol_with_atom_added(mol: MolHandle, element_symbol: string): MolHandle;
788
+
789
+ /**
790
+ * Return a new `MolHandle` with the formal charge of atom `idx` changed.
791
+ *
792
+ * Returns a JS error if `idx` is out of range.
793
+ */
794
+ export function mol_with_atom_charge(mol: MolHandle, idx: number, charge: number): MolHandle;
795
+
796
+ /**
797
+ * Return a new `MolHandle` with the element of atom `idx` changed.
798
+ *
799
+ * `element_symbol` — periodic-table symbol, e.g. `"N"`, `"O"`, `"Cl"`.
800
+ * Returns a JS error if `idx` is out of range or the symbol is unknown.
801
+ */
802
+ export function mol_with_atom_element(mol: MolHandle, idx: number, element_symbol: string): MolHandle;
803
+
804
+ /**
805
+ * Return a new `MolHandle` with atom `idx` and all its bonds removed.
806
+ *
807
+ * Atom indices above `idx` shift down by 1. Returns a JS error if `idx`
808
+ * is out of range.
809
+ */
810
+ export function mol_with_atom_removed(mol: MolHandle, idx: number): MolHandle;
811
+
812
+ /**
813
+ * Return a new `MolHandle` with one bond added between `a` and `b`.
814
+ *
815
+ * `order` — 1 = single, 2 = double, 3 = triple.
816
+ * Returns a JS error if the bond already exists or `a == b`.
817
+ */
818
+ export function mol_with_bond_added(mol: MolHandle, a: number, b: number, order: number): MolHandle;
819
+
820
+ /**
821
+ * Return a new `MolHandle` with bond `idx` removed.
822
+ *
823
+ * Atom indices are unchanged; bond indices above `idx` shift down.
824
+ * Returns a JS error if `idx` is out of range.
825
+ */
826
+ export function mol_with_bond_removed(mol: MolHandle, idx: number): MolHandle;
827
+
828
+ /**
829
+ * Per-atom molar refractivity contributions as a JSON array of f64.
830
+ */
831
+ export function mr_per_atom_json(mol: MolHandle): string;
832
+
833
+ /**
834
+ * Murcko scaffold of `mol` — the ring system plus linkers, side-chains removed.
835
+ *
836
+ * Returns a new `MolHandle`. For acyclic molecules returns an empty molecule.
837
+ */
838
+ export function murcko_scaffold(mol: MolHandle): MolHandle;
839
+
840
+ /**
841
+ * Neutralize formal charges on `mol` by proton addition/removal.
842
+ *
843
+ * Returns a new `MolHandle` with all formal charges set to zero where possible.
844
+ */
845
+ export function neutralize_charges(mol: MolHandle): MolHandle;
846
+
847
+ /**
848
+ * Parse and re-serialise a reaction SMILES string, returning the normalised form.
849
+ *
850
+ * Useful for validating reaction SMILES and obtaining a canonical representation.
851
+ * Returns a JS error on parse failure.
852
+ */
853
+ export function normalize_reaction_smiles(rxn_smiles: string): string;
854
+
855
+ /**
856
+ * PAINS structural alert names matched by `mol` as a JSON array.
857
+ *
858
+ * Returns `[]` when no alerts fire, or e.g. `["ene_six_het_A(483)"]`.
859
+ * Use alongside `pains_passes()` to know *which* alerts triggered.
860
+ */
861
+ export function pains_matches_json(mol: MolHandle): string;
862
+
398
863
  /**
399
864
  * Parse a SMILES string into a `MolHandle`.
400
865
  *
@@ -412,6 +877,29 @@ export function peoe_vsa_json(mol: MolHandle): string;
412
877
  */
413
878
  export function remove_hydrogens(mol: MolHandle): MolHandle;
414
879
 
880
+ /**
881
+ * Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
882
+ *
883
+ * `smiles_json` — JSON array of SMILES strings.
884
+ * `core_smarts` — SMARTS pattern with `*` (wildcard) atoms marking R-group
885
+ * attachment points. For example `c1ccc(*)cc1` for para-substituted benzene.
886
+ *
887
+ * Returns a JSON array with one entry per input molecule:
888
+ * ```json
889
+ * [
890
+ * {"matched":true, "r1":"C"},
891
+ * {"matched":true, "r1":"CC"},
892
+ * {"matched":false}
893
+ * ]
894
+ * ```
895
+ * R-group keys are `"r1"`, `"r2"`, … in the order the `*` atoms appear in
896
+ * the SMARTS pattern. A molecule that does not contain the core gets
897
+ * `"matched": false` and no R-group keys.
898
+ *
899
+ * Returns a JS error if the SMARTS fails to parse or any SMILES is invalid.
900
+ */
901
+ export function rgroup_decompose_json(smiles_json: string, core_smarts: string): string;
902
+
415
903
  /**
416
904
  * Apply a SMIRKS reaction template and return product SMILES as a JSON string.
417
905
  *
@@ -426,6 +914,37 @@ export function run_reactants(smirks: string, reactants_smiles: string): string;
426
914
  */
427
915
  export function sa_score(mol: MolHandle): number;
428
916
 
917
+ /**
918
+ * Serialize multiple molecules with properties to an SDF string.
919
+ *
920
+ * # Arguments
921
+ * * `smiles_json` — JSON array of SMILES strings, e.g. `["CC(=O)O","c1ccccc1"]`
922
+ * * `names_json` — JSON array of molecule names (same length as `smiles_json`)
923
+ * * `props_json` — JSON array where each element encodes one molecule's SD data fields
924
+ * as `"key1\tvalue1\nkey2\tvalue2"` (tab-separated key/value, `\n`-separated pairs;
925
+ * pass `""` for a molecule with no properties)
926
+ *
927
+ * Returns the SDF string, or a JS error if any SMILES fails to parse or the
928
+ * arrays have mismatched lengths.
929
+ *
930
+ * The `\n` and `\t` sequences in `props_json` are JSON-escaped — they are
931
+ * decoded to the actual characters before SDF formatting.
932
+ */
933
+ export function sdf_from_records_json(smiles_json: string, names_json: string, props_json: string): string;
934
+
935
+ /**
936
+ * Parse an SDF string and return a JSON array of record objects.
937
+ *
938
+ * Each record has the shape:
939
+ * ```json
940
+ * {"smiles":"CC(=O)O","name":"aspirin","properties":{"MW":"180.2","Activity":"high"}}
941
+ * ```
942
+ *
943
+ * Invalid records are represented as `null`. SD data fields are included in
944
+ * `properties`; multi-line values are joined with `\n`.
945
+ */
946
+ export function sdf_to_records_json(sdf: string): string;
947
+
429
948
  /**
430
949
  * Parse an SDF string and return a JSON array of canonical SMILES strings.
431
950
  *
@@ -433,6 +952,15 @@ export function sa_score(mol: MolHandle): number;
433
952
  */
434
953
  export function sdf_to_smiles_json(sdf: string): string;
435
954
 
955
+ /**
956
+ * 3D shape descriptors as a JSON object.
957
+ *
958
+ * Keys: `pmi1`, `pmi2`, `pmi3`, `npr1`, `npr2`, `asphericity`, `eccentricity`,
959
+ * `radiusOfGyration`, `planeOfBestFit`. Non-finite values (e.g. single-atom
960
+ * molecules where pmi3 = 0) are serialised as JSON `null`.
961
+ */
962
+ export function shape_descriptors_json(mol: MolHandle): string;
963
+
436
964
  /**
437
965
  * SlogP_VSA descriptors (12 bins) as a JSON array.
438
966
  */
@@ -447,6 +975,14 @@ export function slogp_vsa_json(mol: MolHandle): string;
447
975
  */
448
976
  export function smarts_match_atoms(smarts: string, mol: MolHandle): string;
449
977
 
978
+ /**
979
+ * Serialise a JSON array of SMILES to an SDF string.
980
+ *
981
+ * Generates 2D coordinates for each molecule. Property data can be
982
+ * included by using `sdf_from_records_json` instead.
983
+ */
984
+ export function smiles_array_to_sdf(smiles_json: string): string;
985
+
450
986
  /**
451
987
  * Render a highlighted SVG from a SMILES string in one call.
452
988
  *
@@ -463,6 +999,14 @@ export function smiles_to_svg_highlighted(smiles: string, atoms: Uint32Array, bo
463
999
  */
464
1000
  export function smr_vsa_json(mol: MolHandle): string;
465
1001
 
1002
+ /**
1003
+ * Smallest Set of Smallest Rings (SSSR) as a JSON array of atom-index arrays.
1004
+ *
1005
+ * Example return value for naphthalene:
1006
+ * `[[0,1,2,3,4,5],[5,6,7,8,9,4]]`
1007
+ */
1008
+ export function sssr_rings_json(mol: MolHandle): string;
1009
+
466
1010
  export function start(): void;
467
1011
 
468
1012
  /**
@@ -475,11 +1019,26 @@ export function tanimoto_atom_pair(a: MolHandle, b: MolHandle): number;
475
1019
  */
476
1020
  export function tanimoto_ecfp4(a: MolHandle, b: MolHandle): number;
477
1021
 
1022
+ /**
1023
+ * Tanimoto similarity between `a` and `b` using ECFP6 fingerprints.
1024
+ */
1025
+ export function tanimoto_ecfp6(a: MolHandle, b: MolHandle): number;
1026
+
478
1027
  /**
479
1028
  * Tanimoto similarity between two molecules using FCFP4 fingerprints (pharmacophore-based).
480
1029
  */
481
1030
  export function tanimoto_fcfp4(a: MolHandle, b: MolHandle): number;
482
1031
 
1032
+ /**
1033
+ * Tanimoto similarity between `a` and `b` using FCFP6 (radius-3 pharmacophore) fingerprints.
1034
+ */
1035
+ export function tanimoto_fcfp6(a: MolHandle, b: MolHandle): number;
1036
+
1037
+ /**
1038
+ * Tanimoto similarity between `a` and `b` using MACCS 166-bit fingerprints.
1039
+ */
1040
+ export function tanimoto_maccs(a: MolHandle, b: MolHandle): number;
1041
+
483
1042
  /**
484
1043
  * Tanimoto similarity between two molecules given only SMILES strings (ECFP4).
485
1044
  *
@@ -498,23 +1057,76 @@ export function tanimoto_topo_path(a: MolHandle, b: MolHandle): number;
498
1057
  export function tanimoto_torsion(a: MolHandle, b: MolHandle): number;
499
1058
 
500
1059
  /**
501
- * Serialize a molecule to a MOL V2000 block.
1060
+ * Serialise a `MolHandle` to a CML string with 2D coordinates.
1061
+ *
1062
+ * Coordinates are generated using the same 2D layout engine as `to_mol_block`.
1063
+ */
1064
+ export function to_cml(mol: MolHandle): string;
1065
+
1066
+ /**
1067
+ * Serialize a molecule to a MOL V2000 block with 2D coordinates.
502
1068
  *
503
- * All atom coordinates are written as 0.0 (the `Molecule` type has no 2D
504
- * coordinate storage; real coordinates would require a separate layout pass).
1069
+ * Atom positions are computed via the same layout engine used for SVG depiction
1070
+ * and converted to Ångström units (`1.5 Å` per bond).
505
1071
  */
506
1072
  export function to_mol_block(mol: MolHandle): string;
507
1073
 
1074
+ /**
1075
+ * Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
1076
+ */
1077
+ export function to_mol_v3000_block(mol: MolHandle): string;
1078
+
1079
+ /**
1080
+ * Serialize a molecule to XYZ format.
1081
+ *
1082
+ * 3D coordinates are generated via distance-geometry placement.
1083
+ */
1084
+ export function to_xyz(mol: MolHandle): string;
1085
+
1086
+ /**
1087
+ * Torsion fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
1088
+ */
1089
+ export function torsion_bitvec(mol: MolHandle): Uint8Array;
1090
+
1091
+ /**
1092
+ * Non-canonical SMILES for `mol`.
1093
+ *
1094
+ * Unlike `canonical_smiles`, the output depends on the internal atom ordering
1095
+ * and is not normalised. Useful when round-trip fidelity (preserving atom
1096
+ * order) matters more than a canonical form.
1097
+ */
1098
+ export function write_smiles(mol: MolHandle): string;
1099
+
508
1100
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
509
1101
 
510
1102
  export interface InitOutput {
511
1103
  readonly memory: WebAssembly.Memory;
1104
+ readonly __wbg_conformerhandle_free: (a: number, b: number) => void;
512
1105
  readonly __wbg_depictoptions_free: (a: number, b: number) => void;
513
1106
  readonly __wbg_molhandle_free: (a: number, b: number) => void;
514
1107
  readonly add_hydrogens: (a: number) => number;
1108
+ readonly atom_pair_bitvec: (a: number) => [number, number];
515
1109
  readonly brics_fragment_count: (a: number) => number;
1110
+ readonly brics_fragments_json: (a: number) => [number, number];
1111
+ readonly butina_cluster_ecfp4_json: (a: number, b: number, c: number) => [number, number, number, number];
1112
+ readonly canonical_tautomer: (a: number) => number;
1113
+ readonly cdxml_to_smiles_json: (a: number, b: number) => [number, number, number, number];
1114
+ readonly cip_assignments_json: (a: number) => [number, number];
1115
+ readonly conformerhandle_add_generated_conformer: (a: number) => number;
1116
+ readonly conformerhandle_add_minimized_conformer: (a: number) => number;
1117
+ readonly conformerhandle_conformer_count: (a: number) => number;
1118
+ readonly conformerhandle_conformer_rmsd: (a: number, b: number, c: number) => number;
1119
+ readonly conformerhandle_conformer_rmsd_no_align: (a: number, b: number, c: number) => number;
1120
+ readonly conformerhandle_get_conformer_pdb: (a: number, b: number) => [number, number];
1121
+ readonly conformerhandle_mol: (a: number) => number;
1122
+ readonly conformerhandle_new: (a: number, b: number) => [number, number, number];
1123
+ readonly conformerhandle_remove_conformer: (a: number, b: number) => number;
1124
+ readonly cpk_color: (a: number, b: number) => [number, number];
1125
+ readonly depict_data_json: (a: number) => [number, number];
1126
+ readonly depict_data_with_coords_json: (a: number, b: number, c: number) => [number, number];
516
1127
  readonly depict_reaction_svg: (a: number, b: number) => [number, number, number, number];
517
1128
  readonly depict_svg_grid: (a: number, b: number, c: number) => [number, number];
1129
+ readonly depict_svg_grid_highlighted: (a: number, b: number, c: number, d: number, e: number) => [number, number];
518
1130
  readonly depictoptions_new: () => number;
519
1131
  readonly depictoptions_set_atom_color: (a: number, b: number, c: number, d: number) => void;
520
1132
  readonly depictoptions_set_atom_ids: (a: number, b: number) => void;
@@ -529,20 +1141,51 @@ export interface InitOutput {
529
1141
  readonly depictoptions_set_show_atom_indices: (a: number, b: number) => void;
530
1142
  readonly depictoptions_set_width: (a: number, b: number) => void;
531
1143
  readonly detect_functional_groups: (a: number) => [number, number];
1144
+ readonly dice_ecfp4: (a: number, b: number) => number;
1145
+ readonly dice_ecfp6: (a: number, b: number) => number;
1146
+ readonly dice_maccs: (a: number, b: number) => number;
532
1147
  readonly ecfp4_bitvec: (a: number) => [number, number];
1148
+ readonly ecfp6_bitvec: (a: number) => [number, number];
1149
+ readonly ecfp_bitvec_custom: (a: number, b: number, c: number) => [number, number];
1150
+ readonly enumerate_stereo_isomers_json: (a: number) => [number, number, number, number];
1151
+ readonly enumerate_tautomers_json: (a: number) => [number, number];
533
1152
  readonly estate_indices_json: (a: number) => [number, number];
1153
+ readonly fcfp4_bitvec: (a: number) => [number, number];
1154
+ readonly fcfp6_bitvec: (a: number) => [number, number];
534
1155
  readonly gasteiger_charges_json: (a: number) => [number, number];
1156
+ readonly generate_3d_minimized_pdb: (a: number) => [number, number];
535
1157
  readonly generate_3d_pdb: (a: number) => [number, number];
1158
+ readonly generic_murcko_scaffold: (a: number) => number;
536
1159
  readonly get_atom_info: (a: number, b: number) => [number, number];
537
1160
  readonly get_bond_between: (a: number, b: number, c: number) => [number, number];
538
1161
  readonly get_bond_info: (a: number, b: number) => [number, number];
1162
+ readonly get_descriptors_json: (a: number) => [number, number];
539
1163
  readonly identify_functional_groups: (a: number) => [number, number];
540
1164
  readonly is_valid_smiles: (a: number, b: number) => number;
1165
+ readonly labute_asa_per_atom_json: (a: number) => [number, number];
1166
+ readonly largest_fragment: (a: number) => number;
1167
+ readonly logp_per_atom_json: (a: number) => [number, number];
1168
+ readonly maccs_bitvec: (a: number) => [number, number];
541
1169
  readonly match_smarts_smiles: (a: number, b: number, c: number, d: number) => [number, number, number, number];
1170
+ readonly maxmin_picks_ecfp4_json: (a: number, b: number, c: number) => [number, number, number, number];
1171
+ readonly mcs_smiles_json: (a: number, b: number) => [number, number, number, number];
1172
+ readonly mmp_pairs_json: (a: number, b: number) => [number, number, number, number];
1173
+ readonly mol_block_coords_json: (a: number, b: number) => [number, number, number, number];
542
1174
  readonly mol_block_from_smiles: (a: number, b: number) => [number, number, number, number];
1175
+ readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
1176
+ readonly mol_from_cml: (a: number, b: number) => [number, number, number];
1177
+ readonly mol_from_pdb: (a: number, b: number) => number;
543
1178
  readonly mol_from_sdf_block: (a: number, b: number) => [number, number, number];
1179
+ readonly mol_from_v3000_block: (a: number, b: number) => [number, number, number];
1180
+ readonly mol_from_xyz: (a: number, b: number) => [number, number, number];
1181
+ readonly mol_next_atom_idx: (a: number) => number;
1182
+ readonly mol_with_atom_added: (a: number, b: number, c: number) => [number, number, number];
1183
+ readonly mol_with_atom_charge: (a: number, b: number, c: number) => [number, number, number];
1184
+ readonly mol_with_atom_element: (a: number, b: number, c: number, d: number) => [number, number, number];
1185
+ readonly mol_with_atom_removed: (a: number, b: number) => [number, number, number];
1186
+ readonly mol_with_bond_added: (a: number, b: number, c: number, d: number) => [number, number, number];
1187
+ readonly mol_with_bond_removed: (a: number, b: number) => [number, number, number];
544
1188
  readonly molhandle_aromatic_ring_count: (a: number) => number;
545
- readonly molhandle_atom_count: (a: number) => number;
546
1189
  readonly molhandle_bertz_ct: (a: number) => number;
547
1190
  readonly molhandle_bond_count: (a: number) => number;
548
1191
  readonly molhandle_canonical_smiles: (a: number) => [number, number];
@@ -579,12 +1222,15 @@ export interface InitOutput {
579
1222
  readonly molhandle_molecular_weight: (a: number) => number;
580
1223
  readonly molhandle_morgan_fp_counts_json: (a: number, b: number) => [number, number];
581
1224
  readonly molhandle_num_aliphatic_heterocycles: (a: number) => number;
1225
+ readonly molhandle_num_aliphatic_rings: (a: number) => number;
582
1226
  readonly molhandle_num_aromatic_heterocycles: (a: number) => number;
583
1227
  readonly molhandle_num_bridgehead_atoms: (a: number) => number;
584
1228
  readonly molhandle_num_heteroatoms: (a: number) => number;
585
1229
  readonly molhandle_num_saturated_heterocycles: (a: number) => number;
1230
+ readonly molhandle_num_saturated_rings: (a: number) => number;
586
1231
  readonly molhandle_num_spiro_atoms: (a: number) => number;
587
1232
  readonly molhandle_num_stereocenters: (a: number) => number;
1233
+ readonly molhandle_num_unspecified_stereocenters: (a: number) => number;
588
1234
  readonly molhandle_pains_passes: (a: number) => number;
589
1235
  readonly molhandle_qed: (a: number) => number;
590
1236
  readonly molhandle_reos_passes: (a: number) => number;
@@ -594,24 +1240,44 @@ export interface InitOutput {
594
1240
  readonly molhandle_tpsa: (a: number) => number;
595
1241
  readonly molhandle_veber_passes: (a: number) => number;
596
1242
  readonly molhandle_wiener_index: (a: number) => number;
1243
+ readonly mr_per_atom_json: (a: number) => [number, number];
1244
+ readonly murcko_scaffold: (a: number) => number;
1245
+ readonly neutralize_charges: (a: number) => number;
1246
+ readonly normalize_reaction_smiles: (a: number, b: number) => [number, number, number, number];
1247
+ readonly pains_matches_json: (a: number) => [number, number];
597
1248
  readonly parse_smiles: (a: number, b: number) => [number, number, number];
598
1249
  readonly peoe_vsa_json: (a: number) => [number, number];
599
1250
  readonly remove_hydrogens: (a: number) => number;
1251
+ readonly rgroup_decompose_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
600
1252
  readonly run_reactants: (a: number, b: number, c: number, d: number) => [number, number, number, number];
601
1253
  readonly sa_score: (a: number) => number;
1254
+ readonly sdf_from_records_json: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
1255
+ readonly sdf_to_records_json: (a: number, b: number) => [number, number];
602
1256
  readonly sdf_to_smiles_json: (a: number, b: number) => [number, number];
1257
+ readonly shape_descriptors_json: (a: number) => [number, number];
603
1258
  readonly slogp_vsa_json: (a: number) => [number, number];
604
1259
  readonly smarts_match_atoms: (a: number, b: number, c: number) => [number, number, number, number];
1260
+ readonly smiles_array_to_sdf: (a: number, b: number) => [number, number, number, number];
605
1261
  readonly smiles_to_svg_highlighted: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
606
1262
  readonly smr_vsa_json: (a: number) => [number, number];
1263
+ readonly sssr_rings_json: (a: number) => [number, number];
607
1264
  readonly tanimoto_atom_pair: (a: number, b: number) => number;
608
1265
  readonly tanimoto_ecfp4: (a: number, b: number) => number;
1266
+ readonly tanimoto_ecfp6: (a: number, b: number) => number;
609
1267
  readonly tanimoto_fcfp4: (a: number, b: number) => number;
1268
+ readonly tanimoto_fcfp6: (a: number, b: number) => number;
1269
+ readonly tanimoto_maccs: (a: number, b: number) => number;
610
1270
  readonly tanimoto_smiles: (a: number, b: number, c: number, d: number) => [number, number, number];
611
1271
  readonly tanimoto_topo_path: (a: number, b: number) => number;
612
1272
  readonly tanimoto_torsion: (a: number, b: number) => number;
1273
+ readonly to_cml: (a: number) => [number, number];
613
1274
  readonly to_mol_block: (a: number) => [number, number];
1275
+ readonly to_mol_v3000_block: (a: number) => [number, number];
1276
+ readonly to_xyz: (a: number) => [number, number];
1277
+ readonly torsion_bitvec: (a: number) => [number, number];
1278
+ readonly write_smiles: (a: number) => [number, number];
614
1279
  readonly start: () => void;
1280
+ readonly molhandle_atom_count: (a: number) => number;
615
1281
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
616
1282
  readonly __wbindgen_malloc: (a: number, b: number) => number;
617
1283
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;