Expand description
chematic-wasm — WebAssembly bindings for the chematic cheminformatics library.
Exposes a small, ergonomic API for parsing SMILES and computing molecular
descriptors from JavaScript/TypeScript via wasm-bindgen.
Modules§
- workflow
- High-level workflow APIs for WASM.
Structs§
- Conformer
Handle - A conformer ensemble: one molecule geometry with multiple 3D coordinate sets.
- Depict
Options - Style options for
MolHandle::depict_svg_opts. - Mhfp
LshHandle - MolHandle
- A handle to a parsed molecule. Owns the molecule behind an
Rcso that it can be cheaply cloned on the JS side without copying atom/bond data.
Functions§
- add_
hydrogens - Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
- admet_
profile_ json - Compute a full ADMET property profile for a molecule.
- atom_
pair_ bitvec - AtomPair fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
- autocorr_
2d_ json - AutoCorr2D descriptor (7 values: topological distance lags 1-7).
- autocorr_
3d_ json - AutoCorr3D descriptor (8 values: Euclidean distance bins 1-8 Å). Requires 3D coordinates (generated automatically).
- balance_
check_ json - Check whether a reaction SMILES is atom-balanced.
- batch_
report_ html - MinHash LSH index: insert MHFP fingerprints and query by approximate similarity.
- boiled_
egg_ json - Predict GI absorption and BBB penetration using the BOILED-Egg method (Daina & Zoete 2016).
- brics_
fragment_ count - Number of BRICS fragments produced by fragmenting the molecule.
- brics_
fragments_ json - BRICS fragment SMILES as a JSON array.
- butina_
cluster_ ecfp4_ json - Cluster molecules by structural similarity (Butina algorithm, ECFP4 Tanimoto).
- canonical_
tautomer - Canonical tautomer of
mol. - canonical_
tautomer_ with_ blocked_ atoms_ json - Compute the canonical tautomer with specific atoms blocked from H-transfer.
- cdxml_
to_ smiles_ json - Parse all molecular fragments from a CDXML string.
- cip_
assignments_ json - CIP stereo assignments as a JSON array of
{atomIdx, cipCode}objects. - conformer_
ensemble_ json - Generate multiple conformers with RMSD-based pruning.
Returns JSON:
{"conformers": [[[x,y,z],...], ...], "count": int}. - cpk_
color - Return the CPK color (CSS hex string) for the given element symbol.
- depict_
data_ json - Compute structured depiction data for
molas a JSON object. - depict_
data_ with_ coords_ json - Compute structured depiction data using caller-supplied 2D coordinates.
- depict_
reaction_ svg - Render a reaction SMILES string (e.g.
"CC(=O)O.CCO>>CC(=O)OCC.O") as a single SVG showing reactants → products with+separators. - depict_
svg_ grid - Render a grid SVG from newline-separated SMILES (one per line).
- depict_
svg_ grid_ highlighted - Render a molecule grid with SMARTS-based atom highlighting.
- detect_
functional_ groups - Detect named functional groups in
mol. - dice_
ecfp4 - Dice similarity between
aandbusing ECFP4 fingerprints. - dice_
ecfp6 - Dice similarity between
aandbusing ECFP6 fingerprints. - dice_
maccs - Dice similarity between
aandbusing MACCS 166-bit fingerprints. - ecfp4_
bitvec - Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
- ecfp4_
bitvec_ with_ chirality - Like
ecfp4_bitvecbut with explicit chirality control. - ecfp6_
bitvec - ECFP6 (radius-3) fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
- ecfp6_
bitvec_ with_ chirality - Like
ecfp6_bitvecbut with explicit chirality control. - ecfp_
bitvec_ custom - Compute a fingerprint bit-vector with configurable ECFP radius and bit width.
- enumerate_
library_ 2way - Enumerate a combinatorial library from a SMIRKS template and two fragment sets.
- enumerate_
stereo_ isomers_ json - Enumerate all stereoisomers arising from unspecified tetrahedral stereocenters.
- enumerate_
tautomers_ json - All enumerated tautomers of
molas a JSON array of canonical SMILES strings. - erg_
vec_ json - Compute ERG-style 315-element float histogram fingerprint.
Returns JSON: {“len”:315,“values”:[f64,…]} or {“error”:“…”}.
Format: 21 pharmacophore-feature-pair × 15 distance bins with Gaussian fuzzing.
See
chematic_fp::erg_vecfor details. - estate_
indices_ json - Per-atom EState values as a JSON array of f64.
- fcfp4_
bitvec - FCFP4 (pharmacophore, radius-2) fingerprint as a bit-packed byte vector (256 bytes).
- fcfp6_
bitvec - FCFP6 (pharmacophore, radius-3) fingerprint as a bit-packed byte vector (256 bytes).
- find_
reaction_ center_ json - Analyze a reaction SMILES and return the reaction center as JSON.
- gasteiger_
charges_ json - Gasteiger-Marsili PEOE partial charges as a JSON array of f64.
- generate_
3d_ coords_ json - Generate 3D coordinates as raw JSON array [[x,y,z], …].
- generate_
3d_ etkdg_ coords_ json - Generate 3D coordinates using ETKDG as raw JSON array [[x,y,z], …].
- generate_
3d_ etkdg_ minimized_ pdb - Generate 3D coordinates using ETKDG and minimize with DREIDING force field.
- generate_
3d_ etkdg_ pdb - Generate 3D coordinates using ETKDG (torsion angle preferences) and return PDB block. ETKDG produces higher-quality conformations than rule-based DG by applying experimental torsion angle preferences to common structural patterns.
- generate_
3d_ minimized_ pdb - Generate energy-minimized 3D coordinates and return a PDB string.
- generate_
3d_ pdb - Generate 3D coordinates for the molecule and return a PDB string.
- generic_
murcko_ scaffold - Generic (atom-type-erased) Murcko scaffold of
mol. - get_
atom_ info - Return information about a single atom as a JSON object.
- get_
bond_ between - Return bond information as a JSON object, looked up by the two bonded atom indices.
- get_
bond_ info - Return bond information as a JSON object, looked up by bond index.
- get_
bond_ length_ json - Get bond length in Ångströms between two atoms from a SMILES string. Returns -1.0 if parsing fails or atom indices are out of range.
- get_
descriptors_ json - All scalar molecular descriptors as a single JSON object.
- get_
dihedral_ json - Get dihedral angle A—B—C—D in degrees from a SMILES string. Returns null (JSON null) if any atom index is out of range or atoms are collinear.
- getaway_
descriptors_ json - Compute GETAWAY descriptors (GEometry, Topology and Atom-Weights AssemblY) from 3D coords.
- hdf_
json - Parse a ChemDraw XML (CDXML) string into a
MolHandle. - identify_
functional_ groups - Identify functional groups. Returns a JSON array of objects:
[{"atoms":[0,2,3],"type":"C,N,O"}, …] - inchi_
from_ smiles - Generate InChI string from SMILES.
- inchikey_
from_ smiles - Generate InChIKey from SMILES (27-character identifier).
- invert_
stereocenter_ at - Invert the stereochemistry of a tetrahedral stereocenter (U/D wedge bonds).
- is_
valid_ smiles - Returns
trueif the SMILES string can be parsed without error. - labute_
asa_ per_ atom_ json - Per-atom Labute approximate surface area contributions as a JSON array of f64.
- largest_
fragment - Return the largest fragment of
mol(salt/solvent stripping). - logp_
per_ atom_ json - Per-atom Crippen LogP contributions as a JSON array of f64.
- maccs_
bitvec - MACCS 166-bit structural keys fingerprint as a byte array (21 bytes, LSB-first).
- match_
smarts_ smiles - Find all SMARTS matches in a molecule given only SMILES strings.
- maxmin_
picks_ ecfp4_ json - Select
nmaximally-diverse molecules (MaxMin algorithm, ECFP4 Tanimoto). - mcs_
smiles_ json - Maximum Common Substructure of a set of molecules, returned as a canonical SMILES string.
- mcs_
smiles_ json_ with_ ring_ config - MCS with ring-awareness constraints.
- mhfp_
hashes_ json - MinHash fingerprint (128 hashes) as JSON.
- minimize_
dreiding_ json - Optimize molecular geometry using DREIDING force field.
- minimize_
mmff94_ json - Minimize geometry using MMFF94 steepest descent (Halgren 1996 full parameters). Generates 3D coords internally if needed. Returns JSON: {“energy”:E,“rmsd”:R,“converged”:true,“iterations”:N} or {“error”:“…”}.
- minimize_
mmff94_ lbfgs_ json - Minimize geometry using MMFF94 L-BFGS (faster convergence than steepest descent). Returns JSON: {“energy”:E,“rmsd”:R,“converged”:true,“iterations”:N} or {“error”:“…”}.
- minimize_
uff_ json - Minimise a molecule’s geometry using the Universal Force Field (UFF).
- mmff94_
charges_ json - MMFF94 partial charges (BCI table, ±0.1e accuracy) as a JSON array of f64.
- mmff94_
charges_ typed_ json - Compute MMFF94-style atom-typed partial charges (improved over element-pair BCI).
Returns JSON: {“charges”:[f64,…]} or {“error”:“…”}.
Uses atom-type classification (Csp3/Ccarbonyl/Ohydroxyl/Oester/Nar/NarH etc.)
for better accuracy (
±0.02e) vs element-pair BCI (±0.05e). - mmff94_
energy_ breakdown_ json - Compute MMFF94 energy breakdown for current rule-based 3D geometry. Returns JSON: {“bond”:B,“angle”:A,“torsion”:T,“vdw”:V,“elec”:E,“total”:X} or {“error”:“…”}.
- mmff94_
partial_ charges_ json - Compute MMFF94 partial charges using numeric atom types (Halgren 1996 eq. 15). Returns JSON: {“charges”:[-0.28,0.15,…]} or {“error”:“…”}.
- mmp_
pairs_ json - Find matched molecular pairs in a set of molecules as JSON.
- mol2_
to_ smiles - Parse a Tripos MOL2 string and return SMILES.
- mol_
block_ coords_ json - Parse a MOL V2000 string and return 2D coordinates as a JSON array.
- mol_
block_ from_ smiles - Serialize a SMILES string directly to a MOL V2000 block with 2D coordinates.
- mol_
from_ cdxml - Only the first molecular fragment in the document is returned. Returns a JS error if the document cannot be parsed.
- mol_
from_ cml - Parse a CML string into a
MolHandle. - mol_
from_ moljson - Parse a MolJSON string into a
MolHandle. - mol_
from_ pdb - Parse a PDB file and return a
MolHandle(topology only; coordinates are discarded). - mol_
from_ sdf_ block - Parse a MOL V2000 block and return a
MolHandle. - mol_
from_ v3000_ block - Parse a MOL V3000 block and return a
MolHandle. - mol_
from_ xyz - Parse an XYZ file and return a
MolHandle(topology only; coordinates are discarded). - mol_
next_ atom_ idx - Return the index that would be assigned to an atom appended to
mol. - mol_
with_ atom_ added - Return a new
MolHandlewith one atom appended. - mol_
with_ atom_ charge - Return a new
MolHandlewith the formal charge of atomidxchanged. - mol_
with_ atom_ element - Return a new
MolHandlewith the element of atomidxchanged. - mol_
with_ atom_ removed - Return a new
MolHandlewith atomidxand all its bonds removed. - mol_
with_ bond_ added - Return a new
MolHandlewith one bond added betweenaandb. - mol_
with_ bond_ removed - Return a new
MolHandlewith bondidxremoved. - mqn_
json - MQN descriptor (42 integer values: Molecular Quantum Numbers).
- mr_
per_ atom_ json - Per-atom molar refractivity contributions as a JSON array of f64.
- murcko_
scaffold - Murcko scaffold of
mol— the ring system plus linkers, side-chains removed. - nearest_
neighbors_ json - Find the k nearest neighbours of a query SMILES in a list of db SMILES.
- neutralize_
charges - Neutralize formal charges on
molby proton addition/removal. - normalize_
cxsmiles - Parse and re-serialize CXSMILES, preserving supported CX metadata. Returns error if atom count exceeds 10,000.
- normalize_
reaction_ smiles - Parse and re-serialise a reaction SMILES string, returning the normalised form.
- pains_
matches_ json - PAINS structural alert names matched by
molas a JSON array. - parse_
cxsmarts_ json - Parse CXSMARTS and return preserved metadata as JSON. Returns error if atom count exceeds 10,000.
- parse_
cxsmiles_ json - Parse CXSMILES and return preserved metadata as JSON.
- parse_
smiles - Parse a SMILES string into a
MolHandle. - peoe_
vsa_ json - PEOE_VSA descriptors (14 bins) as a JSON array.
- pharmacophore_
features_ json - Detect pharmacophore features for virtual screening and lead optimization. Returns JSON array of features: [{type, atom_idx, neighbor_count}, …]
- pharmacophore_
fp_ 2d_ summary - Compute 2D pharmacophore fingerprint (2048 bits) as a JSON feature count summary. Returns simplified JSON with feature type counts: {Donor, Acceptor, Aromatic, Hydrophobic, Positive, Negative}
- pharmacophore_
fp_ 3d_ summary - Compute 3D pharmacophore fingerprint from generated 3D coordinates. Returns simplified JSON with feature type counts (3D-aware version).
- predict_
pka_ json - Predict pKa for all ionizable sites in a molecule.
- random_
smiles_ json - Generate
countrandom SMILES from a SMILES string using the given seed. Atoms are permuted based on xorshift64 RNG. Each variant should parse back to the same molecule. Returns a JSON array of SMILES strings. - remove_
hydrogens - Return a copy of the molecule with all explicit hydrogen atoms removed.
- rgroup_
decompose_ json - Decompose a set of molecules against a core SMARTS, returning R-group SMILES.
- ring_
families_ json - Ring family classification and detection as JSON. Returns an array of ring families with their atoms, ring indices, and topology kind.
- run_
reactants - Apply a SMIRKS reaction template and return product SMILES as a JSON string.
- sa_
score - Synthetic Accessibility Score (1 = easy, 10 = hard).
- sdf_
from_ records_ json - Serialize multiple molecules with properties to an SDF string.
- sdf_
to_ records_ json - Parse an SDF string and return a JSON array of record objects.
- sdf_
to_ smiles_ json - Parse an SDF string and return a JSON array of canonical SMILES strings.
- set_
dihedral_ json - Set dihedral angle A—B—C—D and return PDB block with modified coordinates. Rotates the D-side subtree around the B—C bond. Returns a JS error if parsing fails or atom indices are invalid.
- shape_
descriptors_ json - 3D shape descriptors as a JSON object.
- slogp_
vsa_ json - SlogP_VSA descriptors (12 bins) as a JSON array.
- smarts_
match_ atoms - Find all substructure matches of a SMARTS pattern in
mol. - smarts_
match_ atoms_ with_ chirality - Like
smarts_match_atomsbut with explicit chirality matching control. - smiles_
array_ to_ sdf - Serialise a JSON array of SMILES to an SDF string.
- smiles_
to_ mol2 - Convert a SMILES to a minimal Tripos MOL2 string (no 3D coordinates).
- smiles_
to_ pdbqt - Write a molecule to AutoDock PDBQT format.
- smiles_
to_ svg_ highlighted - Render a highlighted SVG from a SMILES string in one call.
- smr_
vsa_ json - SMR_VSA descriptors (10 bins) as a JSON array.
- sssr_
rings_ json - Smallest Set of Smallest Rings (SSSR) as a JSON array of atom-index arrays.
- standardize_
smiles - Standardize a SMILES string and return the canonical SMILES of the result.
- standardize_
smiles_ report_ json - Standardize a SMILES string and return result SMILES plus an audit report as JSON.
- start
- tanimoto_
atom_ pair - Tanimoto similarity between two molecules using AtomPair fingerprints.
- tanimoto_
ecfp4 - Tanimoto similarity between two molecules using ECFP4 fingerprints.
- tanimoto_
ecfp6 - Tanimoto similarity between
aandbusing ECFP6 fingerprints. - tanimoto_
fcfp4 - Tanimoto similarity between two molecules using FCFP4 fingerprints (pharmacophore-based).
- tanimoto_
fcfp6 - Tanimoto similarity between
aandbusing FCFP6 (radius-3 pharmacophore) fingerprints. - tanimoto_
maccs - Tanimoto similarity between
aandbusing MACCS 166-bit fingerprints. - tanimoto_
mhfp_ smiles - Tanimoto-like similarity between two SMILES via MHFP (MinHash Jaccard approximation).
- tanimoto_
row_ json - Compute ECFP4 Tanimoto similarity from one query SMILES to all db SMILES (dense output).
- tanimoto_
smiles - Tanimoto similarity between two molecules given only SMILES strings (ECFP4).
- tanimoto_
topo_ path - Tanimoto similarity between two molecules using topological path fingerprints.
- tanimoto_
torsion - Tanimoto similarity between two molecules using Topological Torsion fingerprints.
- to_cml
- Serialise a
MolHandleto a CML string with 2D coordinates. - to_
mol_ block - Serialize a molecule to a MOL V2000 block with 2D coordinates.
- to_
mol_ v3000_ block - Serialise a
MolHandleto MOL V3000 format with 2D coordinates. - to_
moljson - Serialise a
MolHandleto a MolJSON string (pretty-printed). - to_xyz
- Serialize a molecule to XYZ format.
- torsion_
bitvec - Torsion fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
- virtual_
screen_ ecfp4_ json - Virtual screen a query SMILES against a database of SMILES using ECFP4 Tanimoto.
- whim_
descriptors_ json - Compute WHIM descriptors (Weighted Holistic Invariant Molecular) from 3D coordinates. Returns JSON array of 22 values: 11 unit-weight descriptors followed by 11 mass-weight descriptors. Each 11-element block is [λ₁, λ₂, λ₃, ν₁, ν₂, ν₃, T, A, V, K, D].
- whim_
getaway_ combined_ json - Compute combined WHIM + GETAWAY descriptors (41 values total) as JSON array.
- write_
smiles - Non-canonical SMILES for
mol. - xlogp3_
json - XLogP3 partition coefficient (alternative to Crippen LogP).
Returns JSON:
{"xlogp3": float}. - xlogp3_
per_ atom_ json - Per-atom XLogP3 contributions. Returns JSON array of floats (one per heavy atom).