agentsclimarketplace

Molecular descriptor calculation via rdkit

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/molecular-descriptor-calculation-via-rdkit

Use when when you have a set of SMILES strings representing small molecules and need to generate a unified descriptor feature matrix for downstream machine learning (e.g., retention time prediction, property regression).From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill molecular-descriptor-calculation-via-rdkit

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

8.4 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it

molecular-descriptor-calculation-via-rdkit

License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->

Summary

Compute molecular descriptors from SMILES strings using RDKit and mordred libraries, deduplicate descriptors across both libraries, and export unified feature matrices in compressed NumPy format. This skill enables rapid featurization of chemical structures for machine learning on retention times and other physicochemical properties.

When to use

When you have a set of SMILES strings representing small molecules and need to generate a unified descriptor feature matrix for downstream machine learning (e.g., retention time prediction, property regression). Use this skill if you require both RDKit's fast, standard descriptors and mordred's extended descriptor set, without redundancy between libraries.

When NOT to use

  • Input is already a preprocessed feature table or descriptor matrix — skip to model training.
  • Your molecules are too large or contain structures not well-supported by RDKit/mordred (e.g., metals, exotic scaffolds) — descriptor calculation may fail or produce NaN values.
  • You require only a small, curated set of domain-specific descriptors; computing the full RDKit + mordred set will introduce unnecessary dimensionality and compute overhead.

Inputs

  • SMILES strings (text)
  • RDKit molecule objects (converted from SMILES)
  • List of RDKit descriptor names
  • List of mordred descriptor names

Outputs

  • Unified descriptor feature matrix (NumPy array)
  • Compressed NumPy file (.npz)
  • Optional CSV, .npy, or .pkl serializations
  • List of deduplicated descriptor names

How to apply

Parse input SMILES strings into RDKit molecule objects; calculate RDKit descriptors using RDKit's descriptor module. In parallel, calculate mordred descriptors using the full descriptor set from the mordred Calculator. Remove mordred descriptors that duplicate RDKit descriptors using the remove_mordred_duplicates function (keeping RDKit versions to avoid redundancy). Optionally normalize numerical descriptor features by division (e.g., dividing by domain-specific scaling factors). Concatenate the deduplicated descriptor arrays into a single NumPy feature matrix. Save the resulting matrix in compressed .npz format for efficient storage and downstream model training.

Related tools

  • RDKit (Fast, standard molecular descriptor computation from SMILES and molecule objects)
  • mordred (Extended molecular descriptor calculator; run in parallel with RDKit to populate additional descriptor features)
  • NumPy (Array operations, concatenation, and compressed serialization (.npz) of descriptor matrices)
  • pandas (Optional CSV export and tabular inspection of descriptor features)

Examples

from rdkit import Chem; from mordred import Calculator, descriptors; import numpy as np; mols = [Chem.MolFromSmiles(smi) for smi in smiles_list]; rdkit_descriptors = [Chem.Descriptors.CalcMolWt(m) for m in mols]; calc = Calculator(descriptors, ignore_3D=True); mordred_descriptors = [calc(m) for m in mols]; cleared_mordred_descriptors, _ = remove_mordred_duplicates(mordred_descriptors, rdkit_descriptors); features = np.concatenate([rdkit_descriptors, cleared_mordred_descriptors], axis=1); np.savez_compressed('descriptors.npz', features=features)

Evaluation signals

  • Verify that the output descriptor matrix has correct shape (n_molecules × n_unique_descriptors) with no NaN or inf values exceeding a pre-defined tolerance threshold.
  • Confirm that duplicate descriptors have been removed by checking that descriptor names from mordred do not overlap with RDKit names after deduplication.
  • Validate that all SMILES strings successfully converted to valid RDKit molecule objects and that descriptor calculation did not fail on any molecule.
  • Compare .npz file size and descriptor count against a baseline calculation to ensure deduplication reduced redundancy as expected.
  • Spot-check descriptor ranges and distributions (e.g., molecular weight, logP) against known chemical property ranges to detect outliers or calculation failures.

Limitations

  • Molecules with invalid SMILES strings or structures not recognizable by RDKit will fail to generate descriptors; incomplete SMILES or exotic atoms may produce NaN values.
  • Descriptor calculation is compute-intensive for large datasets; processing time scales roughly linearly with molecule count.
  • Some mordred descriptors may be computationally expensive or numerically unstable; optional tolerance thresholds should be applied to remove descriptors with excessive broken or missing values.
  • The deduplication step assumes RDKit and mordred compute the same descriptor using identical formulas; minor numerical differences between implementations are not detected.
  • No built-in handling of stereochemistry or isotopic labeling variants; SMILES canonicalization must be performed upstream if required.

Evidence

  • [other] The Calc_Descriptors routine retrieves descriptor names from both RDKit and mordred libraries, removes duplicate descriptors that exist in both libraries (keeping RDKit versions), and combines them with extra custom headers to create a unified descriptor feature set: "retrieves descriptor names from both RDKit and mordred libraries, removes duplicate descriptors that exist in both libraries (keeping RDKit versions), and combines them with extra custom headers to"
  • [other] Parse input SMILES strings and convert to RDKit molecule objects. Calculate RDKit descriptors using RDKit's descriptor module. Calculate mordred descriptors using the mordred Calculator with the full descriptor set.: "Parse input SMILES strings and convert to RDKit molecule objects. 2. Calculate RDKit descriptors using RDKit's descriptor module. 3. Calculate mordred descriptors using the mordred Calculator with"
  • [other] Remove mordred descriptors that duplicate RDKit descriptors using remove_mordred_duplicates function. Optionally normalize numerical descriptor features by division: "Remove mordred descriptors that duplicate RDKit descriptors using remove_mordred_duplicates function. 5. Optionally normalize numerical descriptor features by division"
  • [other] Concatenate RDKit and deduplicated mordred descriptor arrays into a single feature matrix. Save the resulting descriptor matrix in compressed NumPy format (.npz): "Concatenate RDKit and deduplicated mordred descriptor arrays into a single feature matrix. 7. Save the resulting descriptor matrix in compressed NumPy format (.npz)"
  • [results] cleared_mordred_descriptors, duplicate_indeces = remove_mordred_duplicates(cleared_mordred_descriptors, rdkit_descriptors): "cleared_mordred_descriptors, duplicate_indeces = remove_mordred_duplicates(cleared_mordred_descriptors, rdkit_descriptors)"
  • [results] def save_features(path: str, features: List[np.ndarray]): np.savez_compressed(path, features=features): "def save_features(path: str, features: List[np.ndarray]): np.savez_compressed(path, features=features)"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.