Skip to main content

Crate chematic_wasm

Crate chematic_wasm 

Source
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§

ConformerHandle
A conformer ensemble: one molecule geometry with multiple 3D coordinate sets.
DepictOptions
Style options for MolHandle::depict_svg_opts.
MhfpLshHandle
MolHandle
A handle to a parsed molecule. Owns the molecule behind an Rc so 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 mol as 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 a and b using ECFP4 fingerprints.
dice_ecfp6
Dice similarity between a and b using ECFP6 fingerprints.
dice_maccs
Dice similarity between a and b using 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_bitvec but 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_bitvec but 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 mol as 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_vec for 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 true if 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 n maximally-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 MolHandle with one atom appended.
mol_with_atom_charge
Return a new MolHandle with the formal charge of atom idx changed.
mol_with_atom_element
Return a new MolHandle with the element of atom idx changed.
mol_with_atom_removed
Return a new MolHandle with atom idx and all its bonds removed.
mol_with_bond_added
Return a new MolHandle with one bond added between a and b.
mol_with_bond_removed
Return a new MolHandle with bond idx removed.
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 mol by 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 mol as 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 count random 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_atoms but 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 a and b using ECFP6 fingerprints.
tanimoto_fcfp4
Tanimoto similarity between two molecules using FCFP4 fingerprints (pharmacophore-based).
tanimoto_fcfp6
Tanimoto similarity between a and b using FCFP6 (radius-3 pharmacophore) fingerprints.
tanimoto_maccs
Tanimoto similarity between a and b using 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 MolHandle to 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 MolHandle to MOL V3000 format with 2D coordinates.
to_moljson
Serialise a MolHandle to 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).