@kent-tokyo/chematic 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chematic_wasm.d.ts +624 -6
- package/chematic_wasm.js +1491 -159
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/chematic_wasm.js
CHANGED
|
@@ -1,5 +1,126 @@
|
|
|
1
1
|
/* @ts-self-types="./chematic_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A conformer ensemble: one molecule geometry with multiple 3D coordinate sets.
|
|
5
|
+
*
|
|
6
|
+
* Create with `new(smiles)`, then add conformers with `add_generated_conformer`
|
|
7
|
+
* or `add_minimized_conformer`. Retrieve coordinates as PDB strings via
|
|
8
|
+
* `get_conformer_pdb(idx)`. Compare conformers with `conformer_rmsd`.
|
|
9
|
+
*/
|
|
10
|
+
export class ConformerHandle {
|
|
11
|
+
__destroy_into_raw() {
|
|
12
|
+
const ptr = this.__wbg_ptr;
|
|
13
|
+
this.__wbg_ptr = 0;
|
|
14
|
+
ConformerHandleFinalization.unregister(this);
|
|
15
|
+
return ptr;
|
|
16
|
+
}
|
|
17
|
+
free() {
|
|
18
|
+
const ptr = this.__destroy_into_raw();
|
|
19
|
+
wasm.__wbg_conformerhandle_free(ptr, 0);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate a new 3D conformer using distance-geometry and add it to the ensemble.
|
|
23
|
+
*
|
|
24
|
+
* Returns the index of the newly added conformer.
|
|
25
|
+
* @returns {number}
|
|
26
|
+
*/
|
|
27
|
+
add_generated_conformer() {
|
|
28
|
+
const ret = wasm.conformerhandle_add_generated_conformer(this.__wbg_ptr);
|
|
29
|
+
return ret >>> 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate a new 3D conformer, run force-field minimization, and add it.
|
|
33
|
+
*
|
|
34
|
+
* Returns the index of the newly added conformer.
|
|
35
|
+
* @returns {number}
|
|
36
|
+
*/
|
|
37
|
+
add_minimized_conformer() {
|
|
38
|
+
const ret = wasm.conformerhandle_add_minimized_conformer(this.__wbg_ptr);
|
|
39
|
+
return ret >>> 0;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Number of conformers currently stored.
|
|
43
|
+
* @returns {number}
|
|
44
|
+
*/
|
|
45
|
+
conformer_count() {
|
|
46
|
+
const ret = wasm.conformerhandle_conformer_count(this.__wbg_ptr);
|
|
47
|
+
return ret >>> 0;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Kabsch-aligned RMSD (Å) between conformers `a` and `b`.
|
|
51
|
+
*
|
|
52
|
+
* Returns `NaN` if either index is out of range.
|
|
53
|
+
* @param {number} a
|
|
54
|
+
* @param {number} b
|
|
55
|
+
* @returns {number}
|
|
56
|
+
*/
|
|
57
|
+
conformer_rmsd(a, b) {
|
|
58
|
+
const ret = wasm.conformerhandle_conformer_rmsd(this.__wbg_ptr, a, b);
|
|
59
|
+
return ret;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Un-aligned (translation + rotation NOT removed) RMSD (Å) between conformers `a` and `b`.
|
|
63
|
+
*
|
|
64
|
+
* Returns `NaN` if either index is out of range.
|
|
65
|
+
* @param {number} a
|
|
66
|
+
* @param {number} b
|
|
67
|
+
* @returns {number}
|
|
68
|
+
*/
|
|
69
|
+
conformer_rmsd_no_align(a, b) {
|
|
70
|
+
const ret = wasm.conformerhandle_conformer_rmsd_no_align(this.__wbg_ptr, a, b);
|
|
71
|
+
return ret;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Return conformer `idx` as a PDB string, or `null` if `idx` is out of range.
|
|
75
|
+
* @param {number} idx
|
|
76
|
+
* @returns {string | undefined}
|
|
77
|
+
*/
|
|
78
|
+
get_conformer_pdb(idx) {
|
|
79
|
+
const ret = wasm.conformerhandle_get_conformer_pdb(this.__wbg_ptr, idx);
|
|
80
|
+
let v1;
|
|
81
|
+
if (ret[0] !== 0) {
|
|
82
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
83
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
84
|
+
}
|
|
85
|
+
return v1;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The ensemble's molecule as a `MolHandle`.
|
|
89
|
+
* @returns {MolHandle}
|
|
90
|
+
*/
|
|
91
|
+
mol() {
|
|
92
|
+
const ret = wasm.conformerhandle_mol(this.__wbg_ptr);
|
|
93
|
+
return MolHandle.__wrap(ret);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a new empty ensemble for the molecule given by `smiles`.
|
|
97
|
+
*
|
|
98
|
+
* Returns a JS error on SMILES parse failure.
|
|
99
|
+
* @param {string} smiles
|
|
100
|
+
*/
|
|
101
|
+
constructor(smiles) {
|
|
102
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
103
|
+
const len0 = WASM_VECTOR_LEN;
|
|
104
|
+
const ret = wasm.conformerhandle_new(ptr0, len0);
|
|
105
|
+
if (ret[2]) {
|
|
106
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
107
|
+
}
|
|
108
|
+
this.__wbg_ptr = ret[0];
|
|
109
|
+
ConformerHandleFinalization.register(this, this.__wbg_ptr, this);
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Remove conformer `idx` and return `true`, or `false` if `idx` is out of range.
|
|
114
|
+
* @param {number} idx
|
|
115
|
+
* @returns {boolean}
|
|
116
|
+
*/
|
|
117
|
+
remove_conformer(idx) {
|
|
118
|
+
const ret = wasm.conformerhandle_remove_conformer(this.__wbg_ptr, idx);
|
|
119
|
+
return ret !== 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (Symbol.dispose) ConformerHandle.prototype[Symbol.dispose] = ConformerHandle.prototype.free;
|
|
123
|
+
|
|
3
124
|
/**
|
|
4
125
|
* Style options for [`MolHandle::depict_svg_opts`].
|
|
5
126
|
*
|
|
@@ -490,6 +611,14 @@ export class MolHandle {
|
|
|
490
611
|
const ret = wasm.molhandle_num_aliphatic_heterocycles(this.__wbg_ptr);
|
|
491
612
|
return ret >>> 0;
|
|
492
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* Count of aliphatic (non-aromatic) rings in the SSSR.
|
|
616
|
+
* @returns {number}
|
|
617
|
+
*/
|
|
618
|
+
num_aliphatic_rings() {
|
|
619
|
+
const ret = wasm.molhandle_num_aliphatic_rings(this.__wbg_ptr);
|
|
620
|
+
return ret >>> 0;
|
|
621
|
+
}
|
|
493
622
|
/**
|
|
494
623
|
* Number of aromatic rings containing at least one heteroatom (N, O, S, …).
|
|
495
624
|
* @returns {number}
|
|
@@ -522,6 +651,14 @@ export class MolHandle {
|
|
|
522
651
|
const ret = wasm.molhandle_num_saturated_heterocycles(this.__wbg_ptr);
|
|
523
652
|
return ret >>> 0;
|
|
524
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* Count of fully saturated rings in the SSSR.
|
|
656
|
+
* @returns {number}
|
|
657
|
+
*/
|
|
658
|
+
num_saturated_rings() {
|
|
659
|
+
const ret = wasm.molhandle_num_saturated_rings(this.__wbg_ptr);
|
|
660
|
+
return ret >>> 0;
|
|
661
|
+
}
|
|
525
662
|
/**
|
|
526
663
|
* Number of spiro atoms (sole shared atom between exactly 2 rings).
|
|
527
664
|
* @returns {number}
|
|
@@ -538,6 +675,14 @@ export class MolHandle {
|
|
|
538
675
|
const ret = wasm.molhandle_num_stereocenters(this.__wbg_ptr);
|
|
539
676
|
return ret >>> 0;
|
|
540
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Count of tetrahedral stereocenters with unspecified configuration.
|
|
680
|
+
* @returns {number}
|
|
681
|
+
*/
|
|
682
|
+
num_unspecified_stereocenters() {
|
|
683
|
+
const ret = wasm.molhandle_num_unspecified_stereocenters(this.__wbg_ptr);
|
|
684
|
+
return ret >>> 0;
|
|
685
|
+
}
|
|
541
686
|
/**
|
|
542
687
|
* Returns `true` if the molecule has no PAINS structural alerts.
|
|
543
688
|
* @returns {boolean}
|
|
@@ -625,6 +770,19 @@ export function add_hydrogens(mol) {
|
|
|
625
770
|
return MolHandle.__wrap(ret);
|
|
626
771
|
}
|
|
627
772
|
|
|
773
|
+
/**
|
|
774
|
+
* AtomPair fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
775
|
+
* @param {MolHandle} mol
|
|
776
|
+
* @returns {Uint8Array}
|
|
777
|
+
*/
|
|
778
|
+
export function atom_pair_bitvec(mol) {
|
|
779
|
+
_assertClass(mol, MolHandle);
|
|
780
|
+
const ret = wasm.atom_pair_bitvec(mol.__wbg_ptr);
|
|
781
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
782
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
783
|
+
return v1;
|
|
784
|
+
}
|
|
785
|
+
|
|
628
786
|
/**
|
|
629
787
|
* Number of BRICS fragments produced by fragmenting the molecule.
|
|
630
788
|
*
|
|
@@ -639,20 +797,49 @@ export function brics_fragment_count(mol) {
|
|
|
639
797
|
}
|
|
640
798
|
|
|
641
799
|
/**
|
|
642
|
-
*
|
|
643
|
-
* single SVG showing reactants → products with `+` separators.
|
|
800
|
+
* BRICS fragment SMILES as a JSON array.
|
|
644
801
|
*
|
|
645
|
-
*
|
|
646
|
-
*
|
|
802
|
+
* Applies the BRICS fragmentation rules and returns the canonical SMILES of
|
|
803
|
+
* every resulting fragment. Returns `[]` for molecules with no BRICS-breakable
|
|
804
|
+
* bonds (e.g. benzene).
|
|
805
|
+
*
|
|
806
|
+
* The count of fragments equals `brics_fragment_count`.
|
|
807
|
+
* @param {MolHandle} mol
|
|
647
808
|
* @returns {string}
|
|
648
809
|
*/
|
|
649
|
-
export function
|
|
810
|
+
export function brics_fragments_json(mol) {
|
|
811
|
+
let deferred1_0;
|
|
812
|
+
let deferred1_1;
|
|
813
|
+
try {
|
|
814
|
+
_assertClass(mol, MolHandle);
|
|
815
|
+
const ret = wasm.brics_fragments_json(mol.__wbg_ptr);
|
|
816
|
+
deferred1_0 = ret[0];
|
|
817
|
+
deferred1_1 = ret[1];
|
|
818
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
819
|
+
} finally {
|
|
820
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Cluster molecules by structural similarity (Butina algorithm, ECFP4 Tanimoto).
|
|
826
|
+
*
|
|
827
|
+
* `smiles_json` — a JSON array of SMILES strings.
|
|
828
|
+
* `cutoff` — Tanimoto similarity threshold (0.0–1.0); molecules within this
|
|
829
|
+
* distance of a cluster centre are assigned to that cluster.
|
|
830
|
+
* Returns a JSON array of clusters, each cluster being an array of 0-based input indices.
|
|
831
|
+
* Returns a JS error if any SMILES fails to parse.
|
|
832
|
+
* @param {string} smiles_json
|
|
833
|
+
* @param {number} cutoff
|
|
834
|
+
* @returns {string}
|
|
835
|
+
*/
|
|
836
|
+
export function butina_cluster_ecfp4_json(smiles_json, cutoff) {
|
|
650
837
|
let deferred3_0;
|
|
651
838
|
let deferred3_1;
|
|
652
839
|
try {
|
|
653
|
-
const ptr0 = passStringToWasm0(
|
|
840
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
654
841
|
const len0 = WASM_VECTOR_LEN;
|
|
655
|
-
const ret = wasm.
|
|
842
|
+
const ret = wasm.butina_cluster_ecfp4_json(ptr0, len0, cutoff);
|
|
656
843
|
var ptr2 = ret[0];
|
|
657
844
|
var len2 = ret[1];
|
|
658
845
|
if (ret[3]) {
|
|
@@ -668,45 +855,33 @@ export function depict_reaction_svg(rxn_smiles) {
|
|
|
668
855
|
}
|
|
669
856
|
|
|
670
857
|
/**
|
|
671
|
-
*
|
|
858
|
+
* Canonical tautomer of `mol`.
|
|
672
859
|
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
* @param {
|
|
676
|
-
* @
|
|
677
|
-
* @returns {string}
|
|
860
|
+
* Applies a rule-based tautomer normalisation and returns the canonical form
|
|
861
|
+
* as a new `MolHandle`.
|
|
862
|
+
* @param {MolHandle} mol
|
|
863
|
+
* @returns {MolHandle}
|
|
678
864
|
*/
|
|
679
|
-
export function
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
const ptr0 = passStringToWasm0(smiles_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
684
|
-
const len0 = WASM_VECTOR_LEN;
|
|
685
|
-
const ret = wasm.depict_svg_grid(ptr0, len0, cols);
|
|
686
|
-
deferred2_0 = ret[0];
|
|
687
|
-
deferred2_1 = ret[1];
|
|
688
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
689
|
-
} finally {
|
|
690
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
691
|
-
}
|
|
865
|
+
export function canonical_tautomer(mol) {
|
|
866
|
+
_assertClass(mol, MolHandle);
|
|
867
|
+
const ret = wasm.canonical_tautomer(mol.__wbg_ptr);
|
|
868
|
+
return MolHandle.__wrap(ret);
|
|
692
869
|
}
|
|
693
870
|
|
|
694
871
|
/**
|
|
695
|
-
*
|
|
872
|
+
* CIP stereo assignments as a JSON array of `{atomIdx, cipCode}` objects.
|
|
696
873
|
*
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
* as a separate entry. Overlapping groups (carboxylic acid → "carboxyl" +
|
|
700
|
-
* "hydroxyl" + "carbonyl") are all returned.
|
|
874
|
+
* `cipCode` is one of `"R"`, `"S"`, `"E"`, or `"Z"`.
|
|
875
|
+
* Returns `[]` for molecules with no specified stereocenters.
|
|
701
876
|
* @param {MolHandle} mol
|
|
702
877
|
* @returns {string}
|
|
703
878
|
*/
|
|
704
|
-
export function
|
|
879
|
+
export function cip_assignments_json(mol) {
|
|
705
880
|
let deferred1_0;
|
|
706
881
|
let deferred1_1;
|
|
707
882
|
try {
|
|
708
883
|
_assertClass(mol, MolHandle);
|
|
709
|
-
const ret = wasm.
|
|
884
|
+
const ret = wasm.cip_assignments_json(mol.__wbg_ptr);
|
|
710
885
|
deferred1_0 = ret[0];
|
|
711
886
|
deferred1_1 = ret[1];
|
|
712
887
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -716,31 +891,56 @@ export function detect_functional_groups(mol) {
|
|
|
716
891
|
}
|
|
717
892
|
|
|
718
893
|
/**
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
894
|
+
* Return the CPK color (CSS hex string) for the given element symbol.
|
|
895
|
+
*
|
|
896
|
+
* Returns `"#000000"` (black) for carbon and unknown elements.
|
|
897
|
+
* @param {string} element_symbol
|
|
898
|
+
* @returns {string}
|
|
722
899
|
*/
|
|
723
|
-
export function
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
900
|
+
export function cpk_color(element_symbol) {
|
|
901
|
+
let deferred2_0;
|
|
902
|
+
let deferred2_1;
|
|
903
|
+
try {
|
|
904
|
+
const ptr0 = passStringToWasm0(element_symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
905
|
+
const len0 = WASM_VECTOR_LEN;
|
|
906
|
+
const ret = wasm.cpk_color(ptr0, len0);
|
|
907
|
+
deferred2_0 = ret[0];
|
|
908
|
+
deferred2_1 = ret[1];
|
|
909
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
910
|
+
} finally {
|
|
911
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
912
|
+
}
|
|
729
913
|
}
|
|
730
914
|
|
|
731
915
|
/**
|
|
732
|
-
*
|
|
916
|
+
* Compute structured depiction data for `mol` as a JSON object.
|
|
733
917
|
*
|
|
734
|
-
*
|
|
918
|
+
* Returns:
|
|
919
|
+
* ```json
|
|
920
|
+
* {
|
|
921
|
+
* "atoms": [
|
|
922
|
+
* {"idx": 0, "element": "C", "x": 1.5, "y": 0.0, "charge": 0,
|
|
923
|
+
* "label": null, "color": "#000000"},
|
|
924
|
+
* ...
|
|
925
|
+
* ],
|
|
926
|
+
* "bonds": [
|
|
927
|
+
* {"idx": 0, "atom1": 0, "atom2": 1, "kind": "Single"},
|
|
928
|
+
* ...
|
|
929
|
+
* ]
|
|
930
|
+
* }
|
|
931
|
+
* ```
|
|
932
|
+
*
|
|
933
|
+
* `label` is `null` for carbon atoms in skeletal structures (label suppressed).
|
|
934
|
+
* `kind` is one of `"Single"`, `"Double"`, `"Triple"`, `"Aromatic"`, `"Up"`, `"Down"`.
|
|
735
935
|
* @param {MolHandle} mol
|
|
736
936
|
* @returns {string}
|
|
737
937
|
*/
|
|
738
|
-
export function
|
|
938
|
+
export function depict_data_json(mol) {
|
|
739
939
|
let deferred1_0;
|
|
740
940
|
let deferred1_1;
|
|
741
941
|
try {
|
|
742
942
|
_assertClass(mol, MolHandle);
|
|
743
|
-
const ret = wasm.
|
|
943
|
+
const ret = wasm.depict_data_json(mol.__wbg_ptr);
|
|
744
944
|
deferred1_0 = ret[0];
|
|
745
945
|
deferred1_1 = ret[1];
|
|
746
946
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -750,92 +950,247 @@ export function estate_indices_json(mol) {
|
|
|
750
950
|
}
|
|
751
951
|
|
|
752
952
|
/**
|
|
753
|
-
*
|
|
754
|
-
*
|
|
953
|
+
* Render a reaction SMILES string (e.g. `"CC(=O)O.CCO>>CC(=O)OCC.O"`) as a
|
|
954
|
+
* single SVG showing reactants → products with `+` separators.
|
|
955
|
+
*
|
|
956
|
+
* Returns a self-contained SVG string. Returns a JS error on invalid input.
|
|
957
|
+
* @param {string} rxn_smiles
|
|
755
958
|
* @returns {string}
|
|
756
959
|
*/
|
|
757
|
-
export function
|
|
758
|
-
let
|
|
759
|
-
let
|
|
960
|
+
export function depict_reaction_svg(rxn_smiles) {
|
|
961
|
+
let deferred3_0;
|
|
962
|
+
let deferred3_1;
|
|
760
963
|
try {
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
964
|
+
const ptr0 = passStringToWasm0(rxn_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
965
|
+
const len0 = WASM_VECTOR_LEN;
|
|
966
|
+
const ret = wasm.depict_reaction_svg(ptr0, len0);
|
|
967
|
+
var ptr2 = ret[0];
|
|
968
|
+
var len2 = ret[1];
|
|
969
|
+
if (ret[3]) {
|
|
970
|
+
ptr2 = 0; len2 = 0;
|
|
971
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
972
|
+
}
|
|
973
|
+
deferred3_0 = ptr2;
|
|
974
|
+
deferred3_1 = len2;
|
|
975
|
+
return getStringFromWasm0(ptr2, len2);
|
|
766
976
|
} finally {
|
|
767
|
-
wasm.__wbindgen_free(
|
|
977
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
768
978
|
}
|
|
769
979
|
}
|
|
770
980
|
|
|
771
981
|
/**
|
|
772
|
-
*
|
|
982
|
+
* Render a grid SVG from newline-separated SMILES (one per line).
|
|
773
983
|
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
776
|
-
* @param {
|
|
984
|
+
* Lines that fail to parse are silently skipped.
|
|
985
|
+
* `cols` controls the number of columns (each cell is 200×200 px).
|
|
986
|
+
* @param {string} smiles_block
|
|
987
|
+
* @param {number} cols
|
|
777
988
|
* @returns {string}
|
|
778
989
|
*/
|
|
779
|
-
export function
|
|
780
|
-
let
|
|
781
|
-
let
|
|
990
|
+
export function depict_svg_grid(smiles_block, cols) {
|
|
991
|
+
let deferred2_0;
|
|
992
|
+
let deferred2_1;
|
|
782
993
|
try {
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
994
|
+
const ptr0 = passStringToWasm0(smiles_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
995
|
+
const len0 = WASM_VECTOR_LEN;
|
|
996
|
+
const ret = wasm.depict_svg_grid(ptr0, len0, cols);
|
|
997
|
+
deferred2_0 = ret[0];
|
|
998
|
+
deferred2_1 = ret[1];
|
|
787
999
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
788
1000
|
} finally {
|
|
789
|
-
wasm.__wbindgen_free(
|
|
1001
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
790
1002
|
}
|
|
791
1003
|
}
|
|
792
1004
|
|
|
793
1005
|
/**
|
|
794
|
-
*
|
|
1006
|
+
* Render a molecule grid with SMARTS-based atom highlighting.
|
|
795
1007
|
*
|
|
796
|
-
* `
|
|
797
|
-
*
|
|
1008
|
+
* `smiles_block` — newline-separated SMILES strings (same format as `depict_svg_grid`).
|
|
1009
|
+
* `cols` — number of grid columns.
|
|
1010
|
+
* `match_smarts` — SMARTS pattern; matched atoms in each molecule are highlighted.
|
|
1011
|
+
* Pass an empty string `""` to render without any highlighting.
|
|
798
1012
|
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
* @param {
|
|
804
|
-
* @param {number} idx
|
|
1013
|
+
* Invalid SMILES are rendered as empty cells; SMARTS parse failure returns an
|
|
1014
|
+
* unhighlighted grid (the SMARTS is silently ignored).
|
|
1015
|
+
* @param {string} smiles_block
|
|
1016
|
+
* @param {number} cols
|
|
1017
|
+
* @param {string} match_smarts
|
|
805
1018
|
* @returns {string}
|
|
806
1019
|
*/
|
|
807
|
-
export function
|
|
808
|
-
let
|
|
809
|
-
let
|
|
1020
|
+
export function depict_svg_grid_highlighted(smiles_block, cols, match_smarts) {
|
|
1021
|
+
let deferred3_0;
|
|
1022
|
+
let deferred3_1;
|
|
810
1023
|
try {
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
1024
|
+
const ptr0 = passStringToWasm0(smiles_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1025
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1026
|
+
const ptr1 = passStringToWasm0(match_smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1027
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1028
|
+
const ret = wasm.depict_svg_grid_highlighted(ptr0, len0, cols, ptr1, len1);
|
|
1029
|
+
deferred3_0 = ret[0];
|
|
1030
|
+
deferred3_1 = ret[1];
|
|
815
1031
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
816
1032
|
} finally {
|
|
817
|
-
wasm.__wbindgen_free(
|
|
1033
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
818
1034
|
}
|
|
819
1035
|
}
|
|
820
1036
|
|
|
821
1037
|
/**
|
|
822
|
-
*
|
|
1038
|
+
* Detect named functional groups in `mol`.
|
|
823
1039
|
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
1040
|
+
* Returns a JSON array of `{"name":"hydroxyl","atoms":[3]}` objects.
|
|
1041
|
+
* Multiple matches of the same group (e.g. two hydroxyl groups) each appear
|
|
1042
|
+
* as a separate entry. Overlapping groups (carboxylic acid → "carboxyl" +
|
|
1043
|
+
* "hydroxyl" + "carbonyl") are all returned.
|
|
1044
|
+
* @param {MolHandle} mol
|
|
1045
|
+
* @returns {string}
|
|
1046
|
+
*/
|
|
1047
|
+
export function detect_functional_groups(mol) {
|
|
1048
|
+
let deferred1_0;
|
|
1049
|
+
let deferred1_1;
|
|
1050
|
+
try {
|
|
1051
|
+
_assertClass(mol, MolHandle);
|
|
1052
|
+
const ret = wasm.detect_functional_groups(mol.__wbg_ptr);
|
|
1053
|
+
deferred1_0 = ret[0];
|
|
1054
|
+
deferred1_1 = ret[1];
|
|
1055
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1056
|
+
} finally {
|
|
1057
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Dice similarity between `a` and `b` using ECFP4 fingerprints.
|
|
1063
|
+
* @param {MolHandle} a
|
|
1064
|
+
* @param {MolHandle} b
|
|
1065
|
+
* @returns {number}
|
|
1066
|
+
*/
|
|
1067
|
+
export function dice_ecfp4(a, b) {
|
|
1068
|
+
_assertClass(a, MolHandle);
|
|
1069
|
+
_assertClass(b, MolHandle);
|
|
1070
|
+
const ret = wasm.dice_ecfp4(a.__wbg_ptr, b.__wbg_ptr);
|
|
1071
|
+
return ret;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Dice similarity between `a` and `b` using ECFP6 fingerprints.
|
|
1076
|
+
* @param {MolHandle} a
|
|
1077
|
+
* @param {MolHandle} b
|
|
1078
|
+
* @returns {number}
|
|
1079
|
+
*/
|
|
1080
|
+
export function dice_ecfp6(a, b) {
|
|
1081
|
+
_assertClass(a, MolHandle);
|
|
1082
|
+
_assertClass(b, MolHandle);
|
|
1083
|
+
const ret = wasm.dice_ecfp6(a.__wbg_ptr, b.__wbg_ptr);
|
|
1084
|
+
return ret;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Dice similarity between `a` and `b` using MACCS 166-bit fingerprints.
|
|
1089
|
+
* @param {MolHandle} a
|
|
1090
|
+
* @param {MolHandle} b
|
|
1091
|
+
* @returns {number}
|
|
1092
|
+
*/
|
|
1093
|
+
export function dice_maccs(a, b) {
|
|
1094
|
+
_assertClass(a, MolHandle);
|
|
1095
|
+
_assertClass(b, MolHandle);
|
|
1096
|
+
const ret = wasm.dice_maccs(a.__wbg_ptr, b.__wbg_ptr);
|
|
1097
|
+
return ret;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
1102
|
+
* @param {MolHandle} mol
|
|
1103
|
+
* @returns {Uint8Array}
|
|
1104
|
+
*/
|
|
1105
|
+
export function ecfp4_bitvec(mol) {
|
|
1106
|
+
_assertClass(mol, MolHandle);
|
|
1107
|
+
const ret = wasm.ecfp4_bitvec(mol.__wbg_ptr);
|
|
1108
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1109
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1110
|
+
return v1;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* ECFP6 (radius-3) fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
1115
|
+
* @param {MolHandle} mol
|
|
1116
|
+
* @returns {Uint8Array}
|
|
1117
|
+
*/
|
|
1118
|
+
export function ecfp6_bitvec(mol) {
|
|
1119
|
+
_assertClass(mol, MolHandle);
|
|
1120
|
+
const ret = wasm.ecfp6_bitvec(mol.__wbg_ptr);
|
|
1121
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1122
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1123
|
+
return v1;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Compute a fingerprint bit-vector with configurable ECFP radius and bit width.
|
|
826
1128
|
*
|
|
827
|
-
*
|
|
1129
|
+
* `radius` — Morgan radius (1 = ECFP2, 2 = ECFP4, 3 = ECFP6).
|
|
1130
|
+
* `nbits` — bit width; must be one of 256, 512, 1024, or 2048.
|
|
1131
|
+
* Returns a `Uint8Array` of `nbits/8` bytes.
|
|
1132
|
+
*
|
|
1133
|
+
* The hash modulo is applied at fingerprint-generation time (`id % nbits`),
|
|
1134
|
+
* so no post-processing fold is needed.
|
|
1135
|
+
* @param {MolHandle} mol
|
|
1136
|
+
* @param {number} radius
|
|
1137
|
+
* @param {number} nbits
|
|
1138
|
+
* @returns {Uint8Array}
|
|
1139
|
+
*/
|
|
1140
|
+
export function ecfp_bitvec_custom(mol, radius, nbits) {
|
|
1141
|
+
_assertClass(mol, MolHandle);
|
|
1142
|
+
const ret = wasm.ecfp_bitvec_custom(mol.__wbg_ptr, radius, nbits);
|
|
1143
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1144
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1145
|
+
return v1;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Enumerate all stereoisomers arising from unspecified tetrahedral stereocenters.
|
|
1150
|
+
*
|
|
1151
|
+
* Only considers carbon stereocenters without explicit `@`/`@@` annotation.
|
|
1152
|
+
* Already-specified centers and E/Z double-bond geometry are unchanged.
|
|
1153
|
+
* Returns a JSON array of canonical SMILES strings.
|
|
1154
|
+
*
|
|
1155
|
+
* At most 2^6 = 64 combinations are enumerated; if more than 6 unspecified
|
|
1156
|
+
* centers are present this function returns a JS error to avoid combinatorial
|
|
1157
|
+
* explosion.
|
|
828
1158
|
* @param {MolHandle} mol
|
|
829
|
-
* @param {number} atom1
|
|
830
|
-
* @param {number} atom2
|
|
831
1159
|
* @returns {string}
|
|
832
1160
|
*/
|
|
833
|
-
export function
|
|
1161
|
+
export function enumerate_stereo_isomers_json(mol) {
|
|
1162
|
+
let deferred2_0;
|
|
1163
|
+
let deferred2_1;
|
|
1164
|
+
try {
|
|
1165
|
+
_assertClass(mol, MolHandle);
|
|
1166
|
+
const ret = wasm.enumerate_stereo_isomers_json(mol.__wbg_ptr);
|
|
1167
|
+
var ptr1 = ret[0];
|
|
1168
|
+
var len1 = ret[1];
|
|
1169
|
+
if (ret[3]) {
|
|
1170
|
+
ptr1 = 0; len1 = 0;
|
|
1171
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1172
|
+
}
|
|
1173
|
+
deferred2_0 = ptr1;
|
|
1174
|
+
deferred2_1 = len1;
|
|
1175
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1176
|
+
} finally {
|
|
1177
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* All enumerated tautomers of `mol` as a JSON array of canonical SMILES strings.
|
|
1183
|
+
*
|
|
1184
|
+
* Example return value: `["Oc1cccc2ccccc12","O=C1C=CC=Cc2ccccc21"]`
|
|
1185
|
+
* @param {MolHandle} mol
|
|
1186
|
+
* @returns {string}
|
|
1187
|
+
*/
|
|
1188
|
+
export function enumerate_tautomers_json(mol) {
|
|
834
1189
|
let deferred1_0;
|
|
835
1190
|
let deferred1_1;
|
|
836
1191
|
try {
|
|
837
1192
|
_assertClass(mol, MolHandle);
|
|
838
|
-
const ret = wasm.
|
|
1193
|
+
const ret = wasm.enumerate_tautomers_json(mol.__wbg_ptr);
|
|
839
1194
|
deferred1_0 = ret[0];
|
|
840
1195
|
deferred1_1 = ret[1];
|
|
841
1196
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -845,23 +1200,86 @@ export function get_bond_between(mol, atom1, atom2) {
|
|
|
845
1200
|
}
|
|
846
1201
|
|
|
847
1202
|
/**
|
|
848
|
-
*
|
|
1203
|
+
* Per-atom EState values as a JSON array of f64.
|
|
849
1204
|
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
1205
|
+
* Indices match `mol.atoms()` order. Hydrogen atoms get 0.0.
|
|
1206
|
+
* @param {MolHandle} mol
|
|
1207
|
+
* @returns {string}
|
|
1208
|
+
*/
|
|
1209
|
+
export function estate_indices_json(mol) {
|
|
1210
|
+
let deferred1_0;
|
|
1211
|
+
let deferred1_1;
|
|
1212
|
+
try {
|
|
1213
|
+
_assertClass(mol, MolHandle);
|
|
1214
|
+
const ret = wasm.estate_indices_json(mol.__wbg_ptr);
|
|
1215
|
+
deferred1_0 = ret[0];
|
|
1216
|
+
deferred1_1 = ret[1];
|
|
1217
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1218
|
+
} finally {
|
|
1219
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* FCFP4 (pharmacophore, radius-2) fingerprint as a bit-packed byte vector (256 bytes).
|
|
1225
|
+
* @param {MolHandle} mol
|
|
1226
|
+
* @returns {Uint8Array}
|
|
1227
|
+
*/
|
|
1228
|
+
export function fcfp4_bitvec(mol) {
|
|
1229
|
+
_assertClass(mol, MolHandle);
|
|
1230
|
+
const ret = wasm.fcfp4_bitvec(mol.__wbg_ptr);
|
|
1231
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1232
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1233
|
+
return v1;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* FCFP6 (pharmacophore, radius-3) fingerprint as a bit-packed byte vector (256 bytes).
|
|
1238
|
+
* @param {MolHandle} mol
|
|
1239
|
+
* @returns {Uint8Array}
|
|
1240
|
+
*/
|
|
1241
|
+
export function fcfp6_bitvec(mol) {
|
|
1242
|
+
_assertClass(mol, MolHandle);
|
|
1243
|
+
const ret = wasm.fcfp6_bitvec(mol.__wbg_ptr);
|
|
1244
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1245
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1246
|
+
return v1;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* Gasteiger-Marsili PEOE partial charges as a JSON array of f64.
|
|
1251
|
+
* @param {MolHandle} mol
|
|
1252
|
+
* @returns {string}
|
|
1253
|
+
*/
|
|
1254
|
+
export function gasteiger_charges_json(mol) {
|
|
1255
|
+
let deferred1_0;
|
|
1256
|
+
let deferred1_1;
|
|
1257
|
+
try {
|
|
1258
|
+
_assertClass(mol, MolHandle);
|
|
1259
|
+
const ret = wasm.gasteiger_charges_json(mol.__wbg_ptr);
|
|
1260
|
+
deferred1_0 = ret[0];
|
|
1261
|
+
deferred1_1 = ret[1];
|
|
1262
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1263
|
+
} finally {
|
|
1264
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Generate energy-minimized 3D coordinates and return a PDB string.
|
|
852
1270
|
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
1271
|
+
* Runs distance-geometry placement followed by gradient-descent force-field
|
|
1272
|
+
* minimization. Geometry quality is better than `generate_3d_pdb` for
|
|
1273
|
+
* flexible molecules; the force field is approximate (not MMFF94/UFF).
|
|
855
1274
|
* @param {MolHandle} mol
|
|
856
|
-
* @param {number} idx
|
|
857
1275
|
* @returns {string}
|
|
858
1276
|
*/
|
|
859
|
-
export function
|
|
1277
|
+
export function generate_3d_minimized_pdb(mol) {
|
|
860
1278
|
let deferred1_0;
|
|
861
1279
|
let deferred1_1;
|
|
862
1280
|
try {
|
|
863
1281
|
_assertClass(mol, MolHandle);
|
|
864
|
-
const ret = wasm.
|
|
1282
|
+
const ret = wasm.generate_3d_minimized_pdb(mol.__wbg_ptr);
|
|
865
1283
|
deferred1_0 = ret[0];
|
|
866
1284
|
deferred1_1 = ret[1];
|
|
867
1285
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -871,17 +1289,19 @@ export function get_bond_info(mol, idx) {
|
|
|
871
1289
|
}
|
|
872
1290
|
|
|
873
1291
|
/**
|
|
874
|
-
*
|
|
875
|
-
*
|
|
1292
|
+
* Generate 3D coordinates for the molecule and return a PDB string.
|
|
1293
|
+
*
|
|
1294
|
+
* Coordinates are generated using distance-geometry placement with ring templates.
|
|
1295
|
+
* Returns heavy-atom PDB (HETATM records, no explicit H).
|
|
876
1296
|
* @param {MolHandle} mol
|
|
877
1297
|
* @returns {string}
|
|
878
1298
|
*/
|
|
879
|
-
export function
|
|
1299
|
+
export function generate_3d_pdb(mol) {
|
|
880
1300
|
let deferred1_0;
|
|
881
1301
|
let deferred1_1;
|
|
882
1302
|
try {
|
|
883
1303
|
_assertClass(mol, MolHandle);
|
|
884
|
-
const ret = wasm.
|
|
1304
|
+
const ret = wasm.generate_3d_pdb(mol.__wbg_ptr);
|
|
885
1305
|
deferred1_0 = ret[0];
|
|
886
1306
|
deferred1_1 = ret[1];
|
|
887
1307
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -891,65 +1311,639 @@ export function identify_functional_groups(mol) {
|
|
|
891
1311
|
}
|
|
892
1312
|
|
|
893
1313
|
/**
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
*
|
|
1314
|
+
* Generic (atom-type-erased) Murcko scaffold of `mol`.
|
|
1315
|
+
*
|
|
1316
|
+
* All atoms become carbon and all bonds become single bonds, giving the pure
|
|
1317
|
+
* graph topology of the scaffold.
|
|
1318
|
+
* @param {MolHandle} mol
|
|
1319
|
+
* @returns {MolHandle}
|
|
897
1320
|
*/
|
|
898
|
-
export function
|
|
899
|
-
|
|
900
|
-
const
|
|
901
|
-
|
|
902
|
-
return ret !== 0;
|
|
1321
|
+
export function generic_murcko_scaffold(mol) {
|
|
1322
|
+
_assertClass(mol, MolHandle);
|
|
1323
|
+
const ret = wasm.generic_murcko_scaffold(mol.__wbg_ptr);
|
|
1324
|
+
return MolHandle.__wrap(ret);
|
|
903
1325
|
}
|
|
904
1326
|
|
|
905
1327
|
/**
|
|
906
|
-
*
|
|
1328
|
+
* Return information about a single atom as a JSON object.
|
|
907
1329
|
*
|
|
908
|
-
*
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
1330
|
+
* `idx` is the 0-based atom index (matching `atoms()` order).
|
|
1331
|
+
* Returns `"null"` if `idx` is out of range.
|
|
1332
|
+
*
|
|
1333
|
+
* Fields: `element` (symbol), `hybridization` ("sp"/"sp2"/"sp3"),
|
|
1334
|
+
* `charge` (formal charge integer), `isAromatic` (bool),
|
|
1335
|
+
* `totalHydrogens` (explicit + implicit H count, integer).
|
|
1336
|
+
* sp3d/sp3d2 (hypervalent P/S) are not distinguished from sp3/sp2.
|
|
1337
|
+
* @param {MolHandle} mol
|
|
1338
|
+
* @param {number} idx
|
|
913
1339
|
* @returns {string}
|
|
914
1340
|
*/
|
|
915
|
-
export function
|
|
916
|
-
let
|
|
917
|
-
let
|
|
1341
|
+
export function get_atom_info(mol, idx) {
|
|
1342
|
+
let deferred1_0;
|
|
1343
|
+
let deferred1_1;
|
|
918
1344
|
try {
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
var ptr3 = ret[0];
|
|
925
|
-
var len3 = ret[1];
|
|
926
|
-
if (ret[3]) {
|
|
927
|
-
ptr3 = 0; len3 = 0;
|
|
928
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
929
|
-
}
|
|
930
|
-
deferred4_0 = ptr3;
|
|
931
|
-
deferred4_1 = len3;
|
|
932
|
-
return getStringFromWasm0(ptr3, len3);
|
|
1345
|
+
_assertClass(mol, MolHandle);
|
|
1346
|
+
const ret = wasm.get_atom_info(mol.__wbg_ptr, idx);
|
|
1347
|
+
deferred1_0 = ret[0];
|
|
1348
|
+
deferred1_1 = ret[1];
|
|
1349
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
933
1350
|
} finally {
|
|
934
|
-
wasm.__wbindgen_free(
|
|
1351
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
935
1352
|
}
|
|
936
1353
|
}
|
|
937
1354
|
|
|
938
1355
|
/**
|
|
939
|
-
*
|
|
1356
|
+
* Return bond information as a JSON object, looked up by the two bonded atom indices.
|
|
940
1357
|
*
|
|
941
|
-
*
|
|
942
|
-
* Returns
|
|
943
|
-
*
|
|
1358
|
+
* Useful when you know the atom indices from SMARTS matching or `data-atom-idx` SVG
|
|
1359
|
+
* attributes but not the bond index. Returns `"null"` if no bond exists between them.
|
|
1360
|
+
*
|
|
1361
|
+
* Fields: same as `get_bond_info` plus `bondIdx` (u32).
|
|
1362
|
+
* @param {MolHandle} mol
|
|
1363
|
+
* @param {number} atom1
|
|
1364
|
+
* @param {number} atom2
|
|
1365
|
+
* @returns {string}
|
|
1366
|
+
*/
|
|
1367
|
+
export function get_bond_between(mol, atom1, atom2) {
|
|
1368
|
+
let deferred1_0;
|
|
1369
|
+
let deferred1_1;
|
|
1370
|
+
try {
|
|
1371
|
+
_assertClass(mol, MolHandle);
|
|
1372
|
+
const ret = wasm.get_bond_between(mol.__wbg_ptr, atom1, atom2);
|
|
1373
|
+
deferred1_0 = ret[0];
|
|
1374
|
+
deferred1_1 = ret[1];
|
|
1375
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1376
|
+
} finally {
|
|
1377
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Return bond information as a JSON object, looked up by bond index.
|
|
1383
|
+
*
|
|
1384
|
+
* `idx` is the 0-based bond index (order matches `mol.bonds()` iteration).
|
|
1385
|
+
* Returns `"null"` if `idx` is out of range.
|
|
1386
|
+
*
|
|
1387
|
+
* Fields: `bondOrder` (1.0/1.5/2.0/3.0), `isAromatic` (bool),
|
|
1388
|
+
* `isInRing` (bool), `atomFrom` (u32), `atomTo` (u32).
|
|
1389
|
+
* @param {MolHandle} mol
|
|
1390
|
+
* @param {number} idx
|
|
1391
|
+
* @returns {string}
|
|
1392
|
+
*/
|
|
1393
|
+
export function get_bond_info(mol, idx) {
|
|
1394
|
+
let deferred1_0;
|
|
1395
|
+
let deferred1_1;
|
|
1396
|
+
try {
|
|
1397
|
+
_assertClass(mol, MolHandle);
|
|
1398
|
+
const ret = wasm.get_bond_info(mol.__wbg_ptr, idx);
|
|
1399
|
+
deferred1_0 = ret[0];
|
|
1400
|
+
deferred1_1 = ret[1];
|
|
1401
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1402
|
+
} finally {
|
|
1403
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/**
|
|
1408
|
+
* All scalar molecular descriptors as a single JSON object.
|
|
1409
|
+
*
|
|
1410
|
+
* Keys use camelCase and match the individual `MolHandle` method names.
|
|
1411
|
+
* Drug-likeness rule outcomes are included as boolean fields.
|
|
1412
|
+
* @param {MolHandle} mol
|
|
1413
|
+
* @returns {string}
|
|
1414
|
+
*/
|
|
1415
|
+
export function get_descriptors_json(mol) {
|
|
1416
|
+
let deferred1_0;
|
|
1417
|
+
let deferred1_1;
|
|
1418
|
+
try {
|
|
1419
|
+
_assertClass(mol, MolHandle);
|
|
1420
|
+
const ret = wasm.get_descriptors_json(mol.__wbg_ptr);
|
|
1421
|
+
deferred1_0 = ret[0];
|
|
1422
|
+
deferred1_1 = ret[1];
|
|
1423
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1424
|
+
} finally {
|
|
1425
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Identify functional groups. Returns a JSON array of objects:
|
|
1431
|
+
* `[{"atoms":[0,2,3],"type":"C,N,O"}, …]`
|
|
1432
|
+
* @param {MolHandle} mol
|
|
1433
|
+
* @returns {string}
|
|
1434
|
+
*/
|
|
1435
|
+
export function identify_functional_groups(mol) {
|
|
1436
|
+
let deferred1_0;
|
|
1437
|
+
let deferred1_1;
|
|
1438
|
+
try {
|
|
1439
|
+
_assertClass(mol, MolHandle);
|
|
1440
|
+
const ret = wasm.identify_functional_groups(mol.__wbg_ptr);
|
|
1441
|
+
deferred1_0 = ret[0];
|
|
1442
|
+
deferred1_1 = ret[1];
|
|
1443
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1444
|
+
} finally {
|
|
1445
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* Returns `true` if the SMILES string can be parsed without error.
|
|
1451
|
+
* @param {string} s
|
|
1452
|
+
* @returns {boolean}
|
|
1453
|
+
*/
|
|
1454
|
+
export function is_valid_smiles(s) {
|
|
1455
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1456
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1457
|
+
const ret = wasm.is_valid_smiles(ptr0, len0);
|
|
1458
|
+
return ret !== 0;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Per-atom Labute approximate surface area contributions as a JSON array of f64.
|
|
1463
|
+
*
|
|
1464
|
+
* Non-finite values (single-atom molecules etc.) are emitted as JSON `null`.
|
|
1465
|
+
* @param {MolHandle} mol
|
|
1466
|
+
* @returns {string}
|
|
1467
|
+
*/
|
|
1468
|
+
export function labute_asa_per_atom_json(mol) {
|
|
1469
|
+
let deferred1_0;
|
|
1470
|
+
let deferred1_1;
|
|
1471
|
+
try {
|
|
1472
|
+
_assertClass(mol, MolHandle);
|
|
1473
|
+
const ret = wasm.labute_asa_per_atom_json(mol.__wbg_ptr);
|
|
1474
|
+
deferred1_0 = ret[0];
|
|
1475
|
+
deferred1_1 = ret[1];
|
|
1476
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1477
|
+
} finally {
|
|
1478
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Return the largest fragment of `mol` (salt/solvent stripping).
|
|
1484
|
+
*
|
|
1485
|
+
* For single-component molecules returns a copy of the same molecule.
|
|
1486
|
+
* @param {MolHandle} mol
|
|
1487
|
+
* @returns {MolHandle}
|
|
1488
|
+
*/
|
|
1489
|
+
export function largest_fragment(mol) {
|
|
1490
|
+
_assertClass(mol, MolHandle);
|
|
1491
|
+
const ret = wasm.largest_fragment(mol.__wbg_ptr);
|
|
1492
|
+
return MolHandle.__wrap(ret);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Per-atom Crippen LogP contributions as a JSON array of f64.
|
|
1497
|
+
*
|
|
1498
|
+
* Index `i` corresponds to atom `i` in `mol.atoms()` order.
|
|
1499
|
+
* @param {MolHandle} mol
|
|
1500
|
+
* @returns {string}
|
|
1501
|
+
*/
|
|
1502
|
+
export function logp_per_atom_json(mol) {
|
|
1503
|
+
let deferred1_0;
|
|
1504
|
+
let deferred1_1;
|
|
1505
|
+
try {
|
|
1506
|
+
_assertClass(mol, MolHandle);
|
|
1507
|
+
const ret = wasm.logp_per_atom_json(mol.__wbg_ptr);
|
|
1508
|
+
deferred1_0 = ret[0];
|
|
1509
|
+
deferred1_1 = ret[1];
|
|
1510
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1511
|
+
} finally {
|
|
1512
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* MACCS 166-bit structural keys fingerprint as a byte array (21 bytes, LSB-first).
|
|
1518
|
+
*
|
|
1519
|
+
* Bit `i` (0-indexed) corresponds to MACCS key `i+1`.
|
|
1520
|
+
* @param {MolHandle} mol
|
|
1521
|
+
* @returns {Uint8Array}
|
|
1522
|
+
*/
|
|
1523
|
+
export function maccs_bitvec(mol) {
|
|
1524
|
+
_assertClass(mol, MolHandle);
|
|
1525
|
+
const ret = wasm.maccs_bitvec(mol.__wbg_ptr);
|
|
1526
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1527
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1528
|
+
return v1;
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* Find all SMARTS matches in a molecule given only SMILES strings.
|
|
1533
|
+
*
|
|
1534
|
+
* Convenience wrapper around `smarts_match_atoms` that accepts raw SMILES
|
|
1535
|
+
* instead of a `MolHandle`. Returns the same JSON format: `[[0,1],[3,4]]`.
|
|
1536
|
+
* Returns a JS error on SMILES or SMARTS parse failure.
|
|
1537
|
+
* @param {string} smiles
|
|
1538
|
+
* @param {string} smarts
|
|
1539
|
+
* @returns {string}
|
|
1540
|
+
*/
|
|
1541
|
+
export function match_smarts_smiles(smiles, smarts) {
|
|
1542
|
+
let deferred4_0;
|
|
1543
|
+
let deferred4_1;
|
|
1544
|
+
try {
|
|
1545
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1546
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1547
|
+
const ptr1 = passStringToWasm0(smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1548
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1549
|
+
const ret = wasm.match_smarts_smiles(ptr0, len0, ptr1, len1);
|
|
1550
|
+
var ptr3 = ret[0];
|
|
1551
|
+
var len3 = ret[1];
|
|
1552
|
+
if (ret[3]) {
|
|
1553
|
+
ptr3 = 0; len3 = 0;
|
|
1554
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1555
|
+
}
|
|
1556
|
+
deferred4_0 = ptr3;
|
|
1557
|
+
deferred4_1 = len3;
|
|
1558
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1559
|
+
} finally {
|
|
1560
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Select `n` maximally-diverse molecules (MaxMin algorithm, ECFP4 Tanimoto).
|
|
1566
|
+
*
|
|
1567
|
+
* `smiles_json` — a JSON array of SMILES strings, e.g. `["CC","c1ccccc1","CCO"]`.
|
|
1568
|
+
* Returns a JSON array of 0-based indices into the input array.
|
|
1569
|
+
* Returns a JS error if any SMILES fails to parse (indices would otherwise shift).
|
|
1570
|
+
* @param {string} smiles_json
|
|
1571
|
+
* @param {number} n
|
|
1572
|
+
* @returns {string}
|
|
1573
|
+
*/
|
|
1574
|
+
export function maxmin_picks_ecfp4_json(smiles_json, n) {
|
|
1575
|
+
let deferred3_0;
|
|
1576
|
+
let deferred3_1;
|
|
1577
|
+
try {
|
|
1578
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1579
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1580
|
+
const ret = wasm.maxmin_picks_ecfp4_json(ptr0, len0, n);
|
|
1581
|
+
var ptr2 = ret[0];
|
|
1582
|
+
var len2 = ret[1];
|
|
1583
|
+
if (ret[3]) {
|
|
1584
|
+
ptr2 = 0; len2 = 0;
|
|
1585
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1586
|
+
}
|
|
1587
|
+
deferred3_0 = ptr2;
|
|
1588
|
+
deferred3_1 = len2;
|
|
1589
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1590
|
+
} finally {
|
|
1591
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Maximum Common Substructure of a set of molecules, returned as a canonical SMILES string.
|
|
1597
|
+
*
|
|
1598
|
+
* `smiles_json` — a JSON array of at least 2 SMILES strings.
|
|
1599
|
+
* Returns the MCS SMILES, or `"null"` when no common substructure was found.
|
|
1600
|
+
* Returns a JS error on SMILES parse failure.
|
|
1601
|
+
* @param {string} smiles_json
|
|
1602
|
+
* @returns {string}
|
|
1603
|
+
*/
|
|
1604
|
+
export function mcs_smiles_json(smiles_json) {
|
|
1605
|
+
let deferred3_0;
|
|
1606
|
+
let deferred3_1;
|
|
1607
|
+
try {
|
|
1608
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1609
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1610
|
+
const ret = wasm.mcs_smiles_json(ptr0, len0);
|
|
1611
|
+
var ptr2 = ret[0];
|
|
1612
|
+
var len2 = ret[1];
|
|
1613
|
+
if (ret[3]) {
|
|
1614
|
+
ptr2 = 0; len2 = 0;
|
|
1615
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1616
|
+
}
|
|
1617
|
+
deferred3_0 = ptr2;
|
|
1618
|
+
deferred3_1 = len2;
|
|
1619
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1620
|
+
} finally {
|
|
1621
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* Find matched molecular pairs in a set of molecules as JSON.
|
|
1627
|
+
*
|
|
1628
|
+
* `smiles_json` — JSON array of SMILES strings to analyze.
|
|
1629
|
+
*
|
|
1630
|
+
* Returns a JSON array of matched pairs:
|
|
1631
|
+
* ```json
|
|
1632
|
+
* [
|
|
1633
|
+
* {
|
|
1634
|
+
* "mol_a": "CC(=O)Oc1ccccc1",
|
|
1635
|
+
* "mol_b": "CC(=O)Nc1ccccc1",
|
|
1636
|
+
* "core": "c1ccccc1[*]",
|
|
1637
|
+
* "fragment_a": "[*]OC(C)=O",
|
|
1638
|
+
* "fragment_b": "[*]NC(C)=O"
|
|
1639
|
+
* }
|
|
1640
|
+
* ]
|
|
1641
|
+
* ```
|
|
1642
|
+
*
|
|
1643
|
+
* Each pair represents molecules that share a common core scaffold but differ
|
|
1644
|
+
* by exactly one structural fragment at a single BRICS-breakable bond cut.
|
|
1645
|
+
*
|
|
1646
|
+
* Returns a JS error if any SMILES fails to parse.
|
|
1647
|
+
* @param {string} smiles_json
|
|
1648
|
+
* @returns {string}
|
|
1649
|
+
*/
|
|
1650
|
+
export function mmp_pairs_json(smiles_json) {
|
|
1651
|
+
let deferred3_0;
|
|
1652
|
+
let deferred3_1;
|
|
1653
|
+
try {
|
|
1654
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1655
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1656
|
+
const ret = wasm.mmp_pairs_json(ptr0, len0);
|
|
1657
|
+
var ptr2 = ret[0];
|
|
1658
|
+
var len2 = ret[1];
|
|
1659
|
+
if (ret[3]) {
|
|
1660
|
+
ptr2 = 0; len2 = 0;
|
|
1661
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1662
|
+
}
|
|
1663
|
+
deferred3_0 = ptr2;
|
|
1664
|
+
deferred3_1 = len2;
|
|
1665
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1666
|
+
} finally {
|
|
1667
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* Serialize a SMILES string directly to a MOL V2000 block with 2D coordinates.
|
|
1673
|
+
*
|
|
1674
|
+
* Returns a JS error on SMILES parse failure.
|
|
1675
|
+
* @param {string} smiles
|
|
1676
|
+
* @returns {string}
|
|
1677
|
+
*/
|
|
1678
|
+
export function mol_block_from_smiles(smiles) {
|
|
1679
|
+
let deferred3_0;
|
|
1680
|
+
let deferred3_1;
|
|
1681
|
+
try {
|
|
1682
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1683
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1684
|
+
const ret = wasm.mol_block_from_smiles(ptr0, len0);
|
|
1685
|
+
var ptr2 = ret[0];
|
|
1686
|
+
var len2 = ret[1];
|
|
1687
|
+
if (ret[3]) {
|
|
1688
|
+
ptr2 = 0; len2 = 0;
|
|
1689
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1690
|
+
}
|
|
1691
|
+
deferred3_0 = ptr2;
|
|
1692
|
+
deferred3_1 = len2;
|
|
1693
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1694
|
+
} finally {
|
|
1695
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Parse a ChemDraw XML (CDXML) string into a `MolHandle`.
|
|
1701
|
+
*
|
|
1702
|
+
* Only the first molecular fragment in the document is returned.
|
|
1703
|
+
* Returns a JS error if the document cannot be parsed.
|
|
1704
|
+
* @param {string} cdxml
|
|
1705
|
+
* @returns {MolHandle}
|
|
1706
|
+
*/
|
|
1707
|
+
export function mol_from_cdxml(cdxml) {
|
|
1708
|
+
const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1709
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1710
|
+
const ret = wasm.mol_from_cdxml(ptr0, len0);
|
|
1711
|
+
if (ret[2]) {
|
|
1712
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1713
|
+
}
|
|
1714
|
+
return MolHandle.__wrap(ret[0]);
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/**
|
|
1718
|
+
* Parse a CML string into a `MolHandle`.
|
|
1719
|
+
*
|
|
1720
|
+
* Returns a JS error if the CML is invalid (unknown element, bad bond, etc.).
|
|
1721
|
+
* @param {string} cml
|
|
1722
|
+
* @returns {MolHandle}
|
|
1723
|
+
*/
|
|
1724
|
+
export function mol_from_cml(cml) {
|
|
1725
|
+
const ptr0 = passStringToWasm0(cml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1726
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1727
|
+
const ret = wasm.mol_from_cml(ptr0, len0);
|
|
1728
|
+
if (ret[2]) {
|
|
1729
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1730
|
+
}
|
|
1731
|
+
return MolHandle.__wrap(ret[0]);
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Parse a PDB file and return a `MolHandle` (topology only; coordinates are discarded).
|
|
1736
|
+
*
|
|
1737
|
+
* Uses CONECT records for connectivity if present; otherwise infers bonds from
|
|
1738
|
+
* atom distances (the same heuristic as the internal `pdb_to_molecule` function).
|
|
1739
|
+
* @param {string} pdb
|
|
1740
|
+
* @returns {MolHandle}
|
|
1741
|
+
*/
|
|
1742
|
+
export function mol_from_pdb(pdb) {
|
|
1743
|
+
const ptr0 = passStringToWasm0(pdb, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1744
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1745
|
+
const ret = wasm.mol_from_pdb(ptr0, len0);
|
|
1746
|
+
return MolHandle.__wrap(ret);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* Parse a MOL V2000 block and return a `MolHandle`.
|
|
1751
|
+
*
|
|
1752
|
+
* Returns a JS error string on parse failure.
|
|
1753
|
+
* @param {string} block
|
|
1754
|
+
* @returns {MolHandle}
|
|
1755
|
+
*/
|
|
1756
|
+
export function mol_from_sdf_block(block) {
|
|
1757
|
+
const ptr0 = passStringToWasm0(block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1758
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1759
|
+
const ret = wasm.mol_from_sdf_block(ptr0, len0);
|
|
1760
|
+
if (ret[2]) {
|
|
1761
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1762
|
+
}
|
|
1763
|
+
return MolHandle.__wrap(ret[0]);
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* Parse a MOL V3000 block and return a `MolHandle`.
|
|
1768
|
+
*
|
|
1769
|
+
* Returns a JS error string on parse failure.
|
|
1770
|
+
* @param {string} block
|
|
1771
|
+
* @returns {MolHandle}
|
|
1772
|
+
*/
|
|
1773
|
+
export function mol_from_v3000_block(block) {
|
|
1774
|
+
const ptr0 = passStringToWasm0(block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1776
|
+
const ret = wasm.mol_from_v3000_block(ptr0, len0);
|
|
1777
|
+
if (ret[2]) {
|
|
1778
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1779
|
+
}
|
|
1780
|
+
return MolHandle.__wrap(ret[0]);
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Parse an XYZ file and return a `MolHandle` (topology only; coordinates are discarded).
|
|
1785
|
+
*
|
|
1786
|
+
* Returns a JS error on parse failure.
|
|
1787
|
+
* @param {string} xyz
|
|
1788
|
+
* @returns {MolHandle}
|
|
1789
|
+
*/
|
|
1790
|
+
export function mol_from_xyz(xyz) {
|
|
1791
|
+
const ptr0 = passStringToWasm0(xyz, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1792
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1793
|
+
const ret = wasm.mol_from_xyz(ptr0, len0);
|
|
1794
|
+
if (ret[2]) {
|
|
1795
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1796
|
+
}
|
|
1797
|
+
return MolHandle.__wrap(ret[0]);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* Return the index that would be assigned to an atom appended to `mol`.
|
|
1802
|
+
* @param {MolHandle} mol
|
|
1803
|
+
* @returns {number}
|
|
1804
|
+
*/
|
|
1805
|
+
export function mol_next_atom_idx(mol) {
|
|
1806
|
+
_assertClass(mol, MolHandle);
|
|
1807
|
+
const ret = wasm.mol_next_atom_idx(mol.__wbg_ptr);
|
|
1808
|
+
return ret >>> 0;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
/**
|
|
1812
|
+
* Return a new `MolHandle` with one atom appended.
|
|
1813
|
+
*
|
|
1814
|
+
* The second return value is the new atom's index (as a JS number).
|
|
1815
|
+
* Use `with_atom_added_idx` to retrieve the index.
|
|
1816
|
+
* @param {MolHandle} mol
|
|
1817
|
+
* @param {string} element_symbol
|
|
1818
|
+
* @returns {MolHandle}
|
|
1819
|
+
*/
|
|
1820
|
+
export function mol_with_atom_added(mol, element_symbol) {
|
|
1821
|
+
_assertClass(mol, MolHandle);
|
|
1822
|
+
const ptr0 = passStringToWasm0(element_symbol, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1823
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1824
|
+
const ret = wasm.mol_with_atom_added(mol.__wbg_ptr, ptr0, len0);
|
|
1825
|
+
if (ret[2]) {
|
|
1826
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1827
|
+
}
|
|
1828
|
+
return MolHandle.__wrap(ret[0]);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* Return a new `MolHandle` with atom `idx` and all its bonds removed.
|
|
1833
|
+
*
|
|
1834
|
+
* Atom indices above `idx` shift down by 1. Returns a JS error if `idx`
|
|
1835
|
+
* is out of range.
|
|
1836
|
+
* @param {MolHandle} mol
|
|
1837
|
+
* @param {number} idx
|
|
1838
|
+
* @returns {MolHandle}
|
|
1839
|
+
*/
|
|
1840
|
+
export function mol_with_atom_removed(mol, idx) {
|
|
1841
|
+
_assertClass(mol, MolHandle);
|
|
1842
|
+
const ret = wasm.mol_with_atom_removed(mol.__wbg_ptr, idx);
|
|
1843
|
+
if (ret[2]) {
|
|
1844
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1845
|
+
}
|
|
1846
|
+
return MolHandle.__wrap(ret[0]);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Return a new `MolHandle` with one bond added between `a` and `b`.
|
|
1851
|
+
*
|
|
1852
|
+
* `order` — 1 = single, 2 = double, 3 = triple.
|
|
1853
|
+
* Returns a JS error if the bond already exists or `a == b`.
|
|
1854
|
+
* @param {MolHandle} mol
|
|
1855
|
+
* @param {number} a
|
|
1856
|
+
* @param {number} b
|
|
1857
|
+
* @param {number} order
|
|
1858
|
+
* @returns {MolHandle}
|
|
1859
|
+
*/
|
|
1860
|
+
export function mol_with_bond_added(mol, a, b, order) {
|
|
1861
|
+
_assertClass(mol, MolHandle);
|
|
1862
|
+
const ret = wasm.mol_with_bond_added(mol.__wbg_ptr, a, b, order);
|
|
1863
|
+
if (ret[2]) {
|
|
1864
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1865
|
+
}
|
|
1866
|
+
return MolHandle.__wrap(ret[0]);
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Return a new `MolHandle` with bond `idx` removed.
|
|
1871
|
+
*
|
|
1872
|
+
* Atom indices are unchanged; bond indices above `idx` shift down.
|
|
1873
|
+
* Returns a JS error if `idx` is out of range.
|
|
1874
|
+
* @param {MolHandle} mol
|
|
1875
|
+
* @param {number} idx
|
|
1876
|
+
* @returns {MolHandle}
|
|
1877
|
+
*/
|
|
1878
|
+
export function mol_with_bond_removed(mol, idx) {
|
|
1879
|
+
_assertClass(mol, MolHandle);
|
|
1880
|
+
const ret = wasm.mol_with_bond_removed(mol.__wbg_ptr, idx);
|
|
1881
|
+
if (ret[2]) {
|
|
1882
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1883
|
+
}
|
|
1884
|
+
return MolHandle.__wrap(ret[0]);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* Per-atom molar refractivity contributions as a JSON array of f64.
|
|
1889
|
+
* @param {MolHandle} mol
|
|
1890
|
+
* @returns {string}
|
|
1891
|
+
*/
|
|
1892
|
+
export function mr_per_atom_json(mol) {
|
|
1893
|
+
let deferred1_0;
|
|
1894
|
+
let deferred1_1;
|
|
1895
|
+
try {
|
|
1896
|
+
_assertClass(mol, MolHandle);
|
|
1897
|
+
const ret = wasm.mr_per_atom_json(mol.__wbg_ptr);
|
|
1898
|
+
deferred1_0 = ret[0];
|
|
1899
|
+
deferred1_1 = ret[1];
|
|
1900
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1901
|
+
} finally {
|
|
1902
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* Murcko scaffold of `mol` — the ring system plus linkers, side-chains removed.
|
|
1908
|
+
*
|
|
1909
|
+
* Returns a new `MolHandle`. For acyclic molecules returns an empty molecule.
|
|
1910
|
+
* @param {MolHandle} mol
|
|
1911
|
+
* @returns {MolHandle}
|
|
1912
|
+
*/
|
|
1913
|
+
export function murcko_scaffold(mol) {
|
|
1914
|
+
_assertClass(mol, MolHandle);
|
|
1915
|
+
const ret = wasm.murcko_scaffold(mol.__wbg_ptr);
|
|
1916
|
+
return MolHandle.__wrap(ret);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* Neutralize formal charges on `mol` by proton addition/removal.
|
|
1921
|
+
*
|
|
1922
|
+
* Returns a new `MolHandle` with all formal charges set to zero where possible.
|
|
1923
|
+
* @param {MolHandle} mol
|
|
1924
|
+
* @returns {MolHandle}
|
|
1925
|
+
*/
|
|
1926
|
+
export function neutralize_charges(mol) {
|
|
1927
|
+
_assertClass(mol, MolHandle);
|
|
1928
|
+
const ret = wasm.neutralize_charges(mol.__wbg_ptr);
|
|
1929
|
+
return MolHandle.__wrap(ret);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* Parse and re-serialise a reaction SMILES string, returning the normalised form.
|
|
1934
|
+
*
|
|
1935
|
+
* Useful for validating reaction SMILES and obtaining a canonical representation.
|
|
1936
|
+
* Returns a JS error on parse failure.
|
|
1937
|
+
* @param {string} rxn_smiles
|
|
944
1938
|
* @returns {string}
|
|
945
1939
|
*/
|
|
946
|
-
export function
|
|
1940
|
+
export function normalize_reaction_smiles(rxn_smiles) {
|
|
947
1941
|
let deferred3_0;
|
|
948
1942
|
let deferred3_1;
|
|
949
1943
|
try {
|
|
950
|
-
const ptr0 = passStringToWasm0(
|
|
1944
|
+
const ptr0 = passStringToWasm0(rxn_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
951
1945
|
const len0 = WASM_VECTOR_LEN;
|
|
952
|
-
const ret = wasm.
|
|
1946
|
+
const ret = wasm.normalize_reaction_smiles(ptr0, len0);
|
|
953
1947
|
var ptr2 = ret[0];
|
|
954
1948
|
var len2 = ret[1];
|
|
955
1949
|
if (ret[3]) {
|
|
@@ -965,20 +1959,25 @@ export function mol_block_from_smiles(smiles) {
|
|
|
965
1959
|
}
|
|
966
1960
|
|
|
967
1961
|
/**
|
|
968
|
-
*
|
|
1962
|
+
* PAINS structural alert names matched by `mol` as a JSON array.
|
|
969
1963
|
*
|
|
970
|
-
* Returns
|
|
971
|
-
*
|
|
972
|
-
* @
|
|
1964
|
+
* Returns `[]` when no alerts fire, or e.g. `["ene_six_het_A(483)"]`.
|
|
1965
|
+
* Use alongside `pains_passes()` to know *which* alerts triggered.
|
|
1966
|
+
* @param {MolHandle} mol
|
|
1967
|
+
* @returns {string}
|
|
973
1968
|
*/
|
|
974
|
-
export function
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1969
|
+
export function pains_matches_json(mol) {
|
|
1970
|
+
let deferred1_0;
|
|
1971
|
+
let deferred1_1;
|
|
1972
|
+
try {
|
|
1973
|
+
_assertClass(mol, MolHandle);
|
|
1974
|
+
const ret = wasm.pains_matches_json(mol.__wbg_ptr);
|
|
1975
|
+
deferred1_0 = ret[0];
|
|
1976
|
+
deferred1_1 = ret[1];
|
|
1977
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1978
|
+
} finally {
|
|
1979
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
980
1980
|
}
|
|
981
|
-
return MolHandle.__wrap(ret[0]);
|
|
982
1981
|
}
|
|
983
1982
|
|
|
984
1983
|
/**
|
|
@@ -1028,6 +2027,53 @@ export function remove_hydrogens(mol) {
|
|
|
1028
2027
|
return MolHandle.__wrap(ret);
|
|
1029
2028
|
}
|
|
1030
2029
|
|
|
2030
|
+
/**
|
|
2031
|
+
* Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
|
|
2032
|
+
*
|
|
2033
|
+
* `smiles_json` — JSON array of SMILES strings.
|
|
2034
|
+
* `core_smarts` — SMARTS pattern with `*` (wildcard) atoms marking R-group
|
|
2035
|
+
* attachment points. For example `c1ccc(*)cc1` for para-substituted benzene.
|
|
2036
|
+
*
|
|
2037
|
+
* Returns a JSON array with one entry per input molecule:
|
|
2038
|
+
* ```json
|
|
2039
|
+
* [
|
|
2040
|
+
* {"matched":true, "r1":"C"},
|
|
2041
|
+
* {"matched":true, "r1":"CC"},
|
|
2042
|
+
* {"matched":false}
|
|
2043
|
+
* ]
|
|
2044
|
+
* ```
|
|
2045
|
+
* R-group keys are `"r1"`, `"r2"`, … in the order the `*` atoms appear in
|
|
2046
|
+
* the SMARTS pattern. A molecule that does not contain the core gets
|
|
2047
|
+
* `"matched": false` and no R-group keys.
|
|
2048
|
+
*
|
|
2049
|
+
* Returns a JS error if the SMARTS fails to parse or any SMILES is invalid.
|
|
2050
|
+
* @param {string} smiles_json
|
|
2051
|
+
* @param {string} core_smarts
|
|
2052
|
+
* @returns {string}
|
|
2053
|
+
*/
|
|
2054
|
+
export function rgroup_decompose_json(smiles_json, core_smarts) {
|
|
2055
|
+
let deferred4_0;
|
|
2056
|
+
let deferred4_1;
|
|
2057
|
+
try {
|
|
2058
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2059
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2060
|
+
const ptr1 = passStringToWasm0(core_smarts, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2061
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2062
|
+
const ret = wasm.rgroup_decompose_json(ptr0, len0, ptr1, len1);
|
|
2063
|
+
var ptr3 = ret[0];
|
|
2064
|
+
var len3 = ret[1];
|
|
2065
|
+
if (ret[3]) {
|
|
2066
|
+
ptr3 = 0; len3 = 0;
|
|
2067
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2068
|
+
}
|
|
2069
|
+
deferred4_0 = ptr3;
|
|
2070
|
+
deferred4_1 = len3;
|
|
2071
|
+
return getStringFromWasm0(ptr3, len3);
|
|
2072
|
+
} finally {
|
|
2073
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
|
|
1031
2077
|
/**
|
|
1032
2078
|
* Apply a SMIRKS reaction template and return product SMILES as a JSON string.
|
|
1033
2079
|
*
|
|
@@ -1072,6 +2118,79 @@ export function sa_score(mol) {
|
|
|
1072
2118
|
return ret;
|
|
1073
2119
|
}
|
|
1074
2120
|
|
|
2121
|
+
/**
|
|
2122
|
+
* Serialize multiple molecules with properties to an SDF string.
|
|
2123
|
+
*
|
|
2124
|
+
* # Arguments
|
|
2125
|
+
* * `smiles_json` — JSON array of SMILES strings, e.g. `["CC(=O)O","c1ccccc1"]`
|
|
2126
|
+
* * `names_json` — JSON array of molecule names (same length as `smiles_json`)
|
|
2127
|
+
* * `props_json` — JSON array where each element encodes one molecule's SD data fields
|
|
2128
|
+
* as `"key1\tvalue1\nkey2\tvalue2"` (tab-separated key/value, `\n`-separated pairs;
|
|
2129
|
+
* pass `""` for a molecule with no properties)
|
|
2130
|
+
*
|
|
2131
|
+
* Returns the SDF string, or a JS error if any SMILES fails to parse or the
|
|
2132
|
+
* arrays have mismatched lengths.
|
|
2133
|
+
*
|
|
2134
|
+
* The `\n` and `\t` sequences in `props_json` are JSON-escaped — they are
|
|
2135
|
+
* decoded to the actual characters before SDF formatting.
|
|
2136
|
+
* @param {string} smiles_json
|
|
2137
|
+
* @param {string} names_json
|
|
2138
|
+
* @param {string} props_json
|
|
2139
|
+
* @returns {string}
|
|
2140
|
+
*/
|
|
2141
|
+
export function sdf_from_records_json(smiles_json, names_json, props_json) {
|
|
2142
|
+
let deferred5_0;
|
|
2143
|
+
let deferred5_1;
|
|
2144
|
+
try {
|
|
2145
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2146
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2147
|
+
const ptr1 = passStringToWasm0(names_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2148
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2149
|
+
const ptr2 = passStringToWasm0(props_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2150
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2151
|
+
const ret = wasm.sdf_from_records_json(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2152
|
+
var ptr4 = ret[0];
|
|
2153
|
+
var len4 = ret[1];
|
|
2154
|
+
if (ret[3]) {
|
|
2155
|
+
ptr4 = 0; len4 = 0;
|
|
2156
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2157
|
+
}
|
|
2158
|
+
deferred5_0 = ptr4;
|
|
2159
|
+
deferred5_1 = len4;
|
|
2160
|
+
return getStringFromWasm0(ptr4, len4);
|
|
2161
|
+
} finally {
|
|
2162
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
/**
|
|
2167
|
+
* Parse an SDF string and return a JSON array of record objects.
|
|
2168
|
+
*
|
|
2169
|
+
* Each record has the shape:
|
|
2170
|
+
* ```json
|
|
2171
|
+
* {"smiles":"CC(=O)O","name":"aspirin","properties":{"MW":"180.2","Activity":"high"}}
|
|
2172
|
+
* ```
|
|
2173
|
+
*
|
|
2174
|
+
* Invalid records are represented as `null`. SD data fields are included in
|
|
2175
|
+
* `properties`; multi-line values are joined with `\n`.
|
|
2176
|
+
* @param {string} sdf
|
|
2177
|
+
* @returns {string}
|
|
2178
|
+
*/
|
|
2179
|
+
export function sdf_to_records_json(sdf) {
|
|
2180
|
+
let deferred2_0;
|
|
2181
|
+
let deferred2_1;
|
|
2182
|
+
try {
|
|
2183
|
+
const ptr0 = passStringToWasm0(sdf, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2184
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2185
|
+
const ret = wasm.sdf_to_records_json(ptr0, len0);
|
|
2186
|
+
deferred2_0 = ret[0];
|
|
2187
|
+
deferred2_1 = ret[1];
|
|
2188
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2189
|
+
} finally {
|
|
2190
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
|
|
1075
2194
|
/**
|
|
1076
2195
|
* Parse an SDF string and return a JSON array of canonical SMILES strings.
|
|
1077
2196
|
*
|
|
@@ -1094,6 +2213,29 @@ export function sdf_to_smiles_json(sdf) {
|
|
|
1094
2213
|
}
|
|
1095
2214
|
}
|
|
1096
2215
|
|
|
2216
|
+
/**
|
|
2217
|
+
* 3D shape descriptors as a JSON object.
|
|
2218
|
+
*
|
|
2219
|
+
* Keys: `pmi1`, `pmi2`, `pmi3`, `npr1`, `npr2`, `asphericity`, `eccentricity`,
|
|
2220
|
+
* `radiusOfGyration`, `planeOfBestFit`. Non-finite values (e.g. single-atom
|
|
2221
|
+
* molecules where pmi3 = 0) are serialised as JSON `null`.
|
|
2222
|
+
* @param {MolHandle} mol
|
|
2223
|
+
* @returns {string}
|
|
2224
|
+
*/
|
|
2225
|
+
export function shape_descriptors_json(mol) {
|
|
2226
|
+
let deferred1_0;
|
|
2227
|
+
let deferred1_1;
|
|
2228
|
+
try {
|
|
2229
|
+
_assertClass(mol, MolHandle);
|
|
2230
|
+
const ret = wasm.shape_descriptors_json(mol.__wbg_ptr);
|
|
2231
|
+
deferred1_0 = ret[0];
|
|
2232
|
+
deferred1_1 = ret[1];
|
|
2233
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2234
|
+
} finally {
|
|
2235
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
|
|
1097
2239
|
/**
|
|
1098
2240
|
* SlogP_VSA descriptors (12 bins) as a JSON array.
|
|
1099
2241
|
* @param {MolHandle} mol
|
|
@@ -1145,6 +2287,35 @@ export function smarts_match_atoms(smarts, mol) {
|
|
|
1145
2287
|
}
|
|
1146
2288
|
}
|
|
1147
2289
|
|
|
2290
|
+
/**
|
|
2291
|
+
* Serialise a JSON array of SMILES to an SDF string.
|
|
2292
|
+
*
|
|
2293
|
+
* Generates 2D coordinates for each molecule. Property data can be
|
|
2294
|
+
* included by using `sdf_from_records_json` instead.
|
|
2295
|
+
* @param {string} smiles_json
|
|
2296
|
+
* @returns {string}
|
|
2297
|
+
*/
|
|
2298
|
+
export function smiles_array_to_sdf(smiles_json) {
|
|
2299
|
+
let deferred3_0;
|
|
2300
|
+
let deferred3_1;
|
|
2301
|
+
try {
|
|
2302
|
+
const ptr0 = passStringToWasm0(smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2304
|
+
const ret = wasm.smiles_array_to_sdf(ptr0, len0);
|
|
2305
|
+
var ptr2 = ret[0];
|
|
2306
|
+
var len2 = ret[1];
|
|
2307
|
+
if (ret[3]) {
|
|
2308
|
+
ptr2 = 0; len2 = 0;
|
|
2309
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2310
|
+
}
|
|
2311
|
+
deferred3_0 = ptr2;
|
|
2312
|
+
deferred3_1 = len2;
|
|
2313
|
+
return getStringFromWasm0(ptr2, len2);
|
|
2314
|
+
} finally {
|
|
2315
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
|
|
1148
2319
|
/**
|
|
1149
2320
|
* Render a highlighted SVG from a SMILES string in one call.
|
|
1150
2321
|
*
|
|
@@ -1205,6 +2376,28 @@ export function smr_vsa_json(mol) {
|
|
|
1205
2376
|
}
|
|
1206
2377
|
}
|
|
1207
2378
|
|
|
2379
|
+
/**
|
|
2380
|
+
* Smallest Set of Smallest Rings (SSSR) as a JSON array of atom-index arrays.
|
|
2381
|
+
*
|
|
2382
|
+
* Example return value for naphthalene:
|
|
2383
|
+
* `[[0,1,2,3,4,5],[5,6,7,8,9,4]]`
|
|
2384
|
+
* @param {MolHandle} mol
|
|
2385
|
+
* @returns {string}
|
|
2386
|
+
*/
|
|
2387
|
+
export function sssr_rings_json(mol) {
|
|
2388
|
+
let deferred1_0;
|
|
2389
|
+
let deferred1_1;
|
|
2390
|
+
try {
|
|
2391
|
+
_assertClass(mol, MolHandle);
|
|
2392
|
+
const ret = wasm.sssr_rings_json(mol.__wbg_ptr);
|
|
2393
|
+
deferred1_0 = ret[0];
|
|
2394
|
+
deferred1_1 = ret[1];
|
|
2395
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2396
|
+
} finally {
|
|
2397
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
|
|
1208
2401
|
export function start() {
|
|
1209
2402
|
wasm.start();
|
|
1210
2403
|
}
|
|
@@ -1235,6 +2428,19 @@ export function tanimoto_ecfp4(a, b) {
|
|
|
1235
2428
|
return ret;
|
|
1236
2429
|
}
|
|
1237
2430
|
|
|
2431
|
+
/**
|
|
2432
|
+
* Tanimoto similarity between `a` and `b` using ECFP6 fingerprints.
|
|
2433
|
+
* @param {MolHandle} a
|
|
2434
|
+
* @param {MolHandle} b
|
|
2435
|
+
* @returns {number}
|
|
2436
|
+
*/
|
|
2437
|
+
export function tanimoto_ecfp6(a, b) {
|
|
2438
|
+
_assertClass(a, MolHandle);
|
|
2439
|
+
_assertClass(b, MolHandle);
|
|
2440
|
+
const ret = wasm.tanimoto_ecfp6(a.__wbg_ptr, b.__wbg_ptr);
|
|
2441
|
+
return ret;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
1238
2444
|
/**
|
|
1239
2445
|
* Tanimoto similarity between two molecules using FCFP4 fingerprints (pharmacophore-based).
|
|
1240
2446
|
* @param {MolHandle} a
|
|
@@ -1248,6 +2454,32 @@ export function tanimoto_fcfp4(a, b) {
|
|
|
1248
2454
|
return ret;
|
|
1249
2455
|
}
|
|
1250
2456
|
|
|
2457
|
+
/**
|
|
2458
|
+
* Tanimoto similarity between `a` and `b` using FCFP6 (radius-3 pharmacophore) fingerprints.
|
|
2459
|
+
* @param {MolHandle} a
|
|
2460
|
+
* @param {MolHandle} b
|
|
2461
|
+
* @returns {number}
|
|
2462
|
+
*/
|
|
2463
|
+
export function tanimoto_fcfp6(a, b) {
|
|
2464
|
+
_assertClass(a, MolHandle);
|
|
2465
|
+
_assertClass(b, MolHandle);
|
|
2466
|
+
const ret = wasm.tanimoto_fcfp6(a.__wbg_ptr, b.__wbg_ptr);
|
|
2467
|
+
return ret;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
/**
|
|
2471
|
+
* Tanimoto similarity between `a` and `b` using MACCS 166-bit fingerprints.
|
|
2472
|
+
* @param {MolHandle} a
|
|
2473
|
+
* @param {MolHandle} b
|
|
2474
|
+
* @returns {number}
|
|
2475
|
+
*/
|
|
2476
|
+
export function tanimoto_maccs(a, b) {
|
|
2477
|
+
_assertClass(a, MolHandle);
|
|
2478
|
+
_assertClass(b, MolHandle);
|
|
2479
|
+
const ret = wasm.tanimoto_maccs(a.__wbg_ptr, b.__wbg_ptr);
|
|
2480
|
+
return ret;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
1251
2483
|
/**
|
|
1252
2484
|
* Tanimoto similarity between two molecules given only SMILES strings (ECFP4).
|
|
1253
2485
|
*
|
|
@@ -1295,10 +2527,31 @@ export function tanimoto_torsion(a, b) {
|
|
|
1295
2527
|
}
|
|
1296
2528
|
|
|
1297
2529
|
/**
|
|
1298
|
-
*
|
|
2530
|
+
* Serialise a `MolHandle` to a CML string with 2D coordinates.
|
|
2531
|
+
*
|
|
2532
|
+
* Coordinates are generated using the same 2D layout engine as `to_mol_block`.
|
|
2533
|
+
* @param {MolHandle} mol
|
|
2534
|
+
* @returns {string}
|
|
2535
|
+
*/
|
|
2536
|
+
export function to_cml(mol) {
|
|
2537
|
+
let deferred1_0;
|
|
2538
|
+
let deferred1_1;
|
|
2539
|
+
try {
|
|
2540
|
+
_assertClass(mol, MolHandle);
|
|
2541
|
+
const ret = wasm.to_cml(mol.__wbg_ptr);
|
|
2542
|
+
deferred1_0 = ret[0];
|
|
2543
|
+
deferred1_1 = ret[1];
|
|
2544
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2545
|
+
} finally {
|
|
2546
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* Serialize a molecule to a MOL V2000 block with 2D coordinates.
|
|
1299
2552
|
*
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
2553
|
+
* Atom positions are computed via the same layout engine used for SVG depiction
|
|
2554
|
+
* and converted to Ångström units (`1.5 Å` per bond).
|
|
1302
2555
|
* @param {MolHandle} mol
|
|
1303
2556
|
* @returns {string}
|
|
1304
2557
|
*/
|
|
@@ -1315,6 +2568,82 @@ export function to_mol_block(mol) {
|
|
|
1315
2568
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1316
2569
|
}
|
|
1317
2570
|
}
|
|
2571
|
+
|
|
2572
|
+
/**
|
|
2573
|
+
* Serialise a `MolHandle` to MOL V3000 format with 2D coordinates.
|
|
2574
|
+
* @param {MolHandle} mol
|
|
2575
|
+
* @returns {string}
|
|
2576
|
+
*/
|
|
2577
|
+
export function to_mol_v3000_block(mol) {
|
|
2578
|
+
let deferred1_0;
|
|
2579
|
+
let deferred1_1;
|
|
2580
|
+
try {
|
|
2581
|
+
_assertClass(mol, MolHandle);
|
|
2582
|
+
const ret = wasm.to_mol_v3000_block(mol.__wbg_ptr);
|
|
2583
|
+
deferred1_0 = ret[0];
|
|
2584
|
+
deferred1_1 = ret[1];
|
|
2585
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2586
|
+
} finally {
|
|
2587
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* Serialize a molecule to XYZ format.
|
|
2593
|
+
*
|
|
2594
|
+
* 3D coordinates are generated via distance-geometry placement.
|
|
2595
|
+
* @param {MolHandle} mol
|
|
2596
|
+
* @returns {string}
|
|
2597
|
+
*/
|
|
2598
|
+
export function to_xyz(mol) {
|
|
2599
|
+
let deferred1_0;
|
|
2600
|
+
let deferred1_1;
|
|
2601
|
+
try {
|
|
2602
|
+
_assertClass(mol, MolHandle);
|
|
2603
|
+
const ret = wasm.to_xyz(mol.__wbg_ptr);
|
|
2604
|
+
deferred1_0 = ret[0];
|
|
2605
|
+
deferred1_1 = ret[1];
|
|
2606
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2607
|
+
} finally {
|
|
2608
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
/**
|
|
2613
|
+
* Torsion fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
2614
|
+
* @param {MolHandle} mol
|
|
2615
|
+
* @returns {Uint8Array}
|
|
2616
|
+
*/
|
|
2617
|
+
export function torsion_bitvec(mol) {
|
|
2618
|
+
_assertClass(mol, MolHandle);
|
|
2619
|
+
const ret = wasm.torsion_bitvec(mol.__wbg_ptr);
|
|
2620
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
2621
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
2622
|
+
return v1;
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2625
|
+
/**
|
|
2626
|
+
* Non-canonical SMILES for `mol`.
|
|
2627
|
+
*
|
|
2628
|
+
* Unlike `canonical_smiles`, the output depends on the internal atom ordering
|
|
2629
|
+
* and is not normalised. Useful when round-trip fidelity (preserving atom
|
|
2630
|
+
* order) matters more than a canonical form.
|
|
2631
|
+
* @param {MolHandle} mol
|
|
2632
|
+
* @returns {string}
|
|
2633
|
+
*/
|
|
2634
|
+
export function write_smiles(mol) {
|
|
2635
|
+
let deferred1_0;
|
|
2636
|
+
let deferred1_1;
|
|
2637
|
+
try {
|
|
2638
|
+
_assertClass(mol, MolHandle);
|
|
2639
|
+
const ret = wasm.write_smiles(mol.__wbg_ptr);
|
|
2640
|
+
deferred1_0 = ret[0];
|
|
2641
|
+
deferred1_1 = ret[1];
|
|
2642
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2643
|
+
} finally {
|
|
2644
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
1318
2647
|
function __wbg_get_imports() {
|
|
1319
2648
|
const import0 = {
|
|
1320
2649
|
__proto__: null,
|
|
@@ -1364,6 +2693,9 @@ function __wbg_get_imports() {
|
|
|
1364
2693
|
};
|
|
1365
2694
|
}
|
|
1366
2695
|
|
|
2696
|
+
const ConformerHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2697
|
+
? { register: () => {}, unregister: () => {} }
|
|
2698
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_conformerhandle_free(ptr, 1));
|
|
1367
2699
|
const DepictOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1368
2700
|
? { register: () => {}, unregister: () => {} }
|
|
1369
2701
|
: new FinalizationRegistry(ptr => wasm.__wbg_depictoptions_free(ptr, 1));
|