Featurizes molecules for ML with molfeat — ECFP/MACCS/MAP4 fingerprints, RDKit/Mordred descriptors, pharmacophore/shape descriptors, and pretrained embeddings (ChemBERTa, ChemGPT, CheMeleon) as scikit-learn transformers. For QSAR/QSPR, virtual screening, or benchmarking representations.
Ships in alterlab-cheminformatics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Molfeat is a comprehensive Python library for molecular featurization that unifies 100+ pre-trained embeddings and hand-crafted featurizers. Convert chemical structures (SMILES strings or RDKit molecules) into numerical representations for machine learning tasks including QSAR modeling, virtual screening, similarity searching, and deep learning applications. Features fast parallel processing, scikit-learn compatible transformers, and built-in caching.
This skill should be used when working with:
| Scenario | Use Instead |
|---|---|
| Training/evaluating models end-to-end on MoleculeNet benchmarks with built-in loaders and GNNs | alterlab-deepchem |
| Sourcing a labeled benchmark dataset with scaffold/cold splits | alterlab-pytdc |
| Low-level fingerprint or descriptor primitives, custom sanitization, SMARTS | alterlab-rdkit |
| Standardizing and cleaning molecule tables before featurization | alterlab-datamol |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-deepchem) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
uv pip install molfeat # molfeat 1.0.0 (current as of 2026-09); Python >= 3.11, pulls torch + datamol
# Optional extras (molfeat 1.x)
uv pip install "molfeat[transformer]" # Hugging Face models: ChemBERTa, ChemGPT, MolT5, ...
uv pip install "molfeat[mordred]" # Mordred descriptors (mordredcommunity)
uv pip install "molfeat[fcd]" # FCD / ChemNet embeddings
uv pip install "molfeat[pyg]" # PyTorch Geometric (used by Mol-JEPA)
uv pip install "molfeat[all]"
molfeat 1.0 breaking changes. The DGL-based pretrained GNNs (gin_supervised_*, jtvae_zinc_no_kl), Graphormer, and the protein featurizers were removed, along with the dgl and graphormer extras (there has never been a map4 extra); loading those model-store entries now fails. New foundation-model featurizers are CheMeleonTransformer (2,048-d, weights fetched from Zenodo and checksum-verified) and MolJEPATransformer (CC BY-NC 4.0; requires trust_remote_code=True and accept_noncommercial_license=True). If you must reproduce legacy GIN/Graphormer embeddings, pin molfeat<1 (0.11.x requires Python ≤ 3.10) in a separate environment. MAP4 needs the map4 package from https://github.com/reymond-group/map4 (not on PyPI).
Molfeat organizes featurization into three hierarchical classes:
molfeat.calc)Callable objects that convert individual molecules into feature vectors. Accept RDKit Chem.Mol objects or SMILES strings.
Use calculators for:
Example:
from molfeat.calc import FPCalculator
calc = FPCalculator("ecfp", radius=3, fpSize=2048)
features = calc("CCO") # Returns numpy array (2048,)
molfeat.trans)Scikit-learn compatible transformers that wrap calculators for batch processing with parallelization.
Use transformers for:
Example:
import numpy as np
from molfeat.trans import MoleculeTransformer
from molfeat.calc import FPCalculator
transformer = MoleculeTransformer(FPCalculator("ecfp"), n_jobs=-1, dtype=np.float32)
features = transformer(smiles_list) # (n_mols, 2048) array; without dtype you get a list of arrays
molfeat.trans.pretrained)Specialized transformers for deep learning models with batched inference and caching.
Use pretrained transformers for:
Example (PretrainedMolTransformer is the abstract base class — instantiate a concrete subclass):
import numpy as np
from molfeat.trans.pretrained import PretrainedHFTransformer
transformer = PretrainedHFTransformer(kind="ChemBERTa-77M-MLM", notation="smiles", dtype=np.float32)
embeddings = transformer(smiles_list) # (n_mols, 384) mean-pooled embeddings
import numpy as np
from molfeat.calc import FPCalculator
from molfeat.trans import MoleculeTransformer
# Load molecular data
smiles = ["CCO", "CC(=O)O", "c1ccccc1", "CC(C)O"]
# Create calculator and transformer (dtype makes the output a single array)
calc = FPCalculator("ecfp", radius=3)
transformer = MoleculeTransformer(calc, n_jobs=-1, dtype=np.float32)
# Featurize molecules
features = transformer(smiles)
print(f"Shape: {features.shape}") # (4, 2048)
# Save featurizer configuration for reproducibility
transformer.to_state_yaml_file("featurizer_config.yml")
# Reload exact configuration
loaded = MoleculeTransformer.from_state_yaml_file("featurizer_config.yml")
# ignore_errors is an argument of the CALL, not the constructor
# (a constructor kwarg is silently swallowed and the call still raises)
transformer = MoleculeTransformer(calc, n_jobs=-1, dtype=np.float32, verbose=True)
features, valid_ids = transformer(smiles_with_errors, ignore_errors=True)
# features: rows for the molecules that featurized; valid_ids: their input positions
# transformer.transform(smiles_with_errors, ignore_errors=True) instead keeps None placeholders
Start with fingerprints:
# ECFP - Most popular, general-purpose
FPCalculator("ecfp", radius=3, fpSize=2048)
# MACCS - Fast, good for scaffold hopping
FPCalculator("maccs")
# MAP4 - Efficient for large-scale screening (needs the map4 package from GitHub)
FPCalculator("map4")
For interpretable models:
# RDKit 2D descriptors (200+ named properties)
from molfeat.calc import RDKitDescriptors2D
RDKitDescriptors2D()
# Mordred (1800+ comprehensive descriptors)
from molfeat.calc import MordredDescriptors
MordredDescriptors()
Combine multiple featurizers (FeatConcat takes fingerprint names or FPVecTransformer objects, not FPCalculators):
from molfeat.trans import FeatConcat
concat = FeatConcat(
["maccs", "ecfp"], # 167 + 2048 dimensions
params={"ecfp": {"length": 2048}}, # FPVecTransformer's ecfp default length is 2000
dtype=np.float32,
)
X = concat(smiles) # (n_mols, 2215); concat.length == 2215
Transformer-based embeddings:
# ChemBERTa - Pre-trained on 77M PubChem compounds
PretrainedHFTransformer(kind="ChemBERTa-77M-MLM", notation="smiles")
# ChemGPT - Autoregressive language model (SELFIES input)
PretrainedHFTransformer(kind="ChemGPT-1.2B", notation="selfies")
Foundation-model embeddings (molfeat 1.x):
from molfeat.trans.pretrained import CheMeleonTransformer, MolJEPATransformer
CheMeleonTransformer() # 2,048-d descriptor-foundation-model fingerprints
MolJEPATransformer(trust_remote_code=True,
accept_noncommercial_license=True) # CC BY-NC 4.0 weights
The legacy DGL GIN (gin_supervised_*) and Graphormer models were removed in molfeat 1.0.
# ECFP - General purpose, most widely used
FPCalculator("ecfp")
# MACCS - Fast, scaffold-based similarity
FPCalculator("maccs")
# MAP4 - Efficient for large databases
FPCalculator("map4")
# USR/USRCAT - 3D shape similarity
from molfeat.calc import USRDescriptors
USRDescriptors()
# FCFP - Functional group based
FPCalculator("fcfp")
# CATS - Pharmacophore pair distributions (189-d in 2D)
from molfeat.calc import CATS
CATS() # CATS(use_3d_distances=True) for the 3D variant
# Gobbi - Explicit 2D pharmacophore features
from molfeat.calc import Pharmacophore2D
Pharmacophore2D(factory="gobbi")
End-to-end recipes (QSAR model building, virtual screening, similarity search, scikit-learn pipeline integration, comparing featurizers), ModelStore discovery, and advanced usage (custom preprocessing, chunked batch processing, caching expensive embeddings) have moved to keep this body lean.
Full copy-ready workflow and advanced-pattern recipes: see references/workflows_and_patterns.md. Additional runnable examples (PyTorch training, grid search, 3D conformers) live in references/examples.md.
n_jobs=-1 to utilize all CPU coresdtype=np.float32 when precision allowsignore_errors=True for large datasetsQuick reference for frequently used featurizers:
| Featurizer | Type | Dimensions | Speed | Use Case |
|---|---|---|---|---|
ecfp | Fingerprint | 2048 | Fast | General purpose |
maccs | Fingerprint | 167 | Very fast | Scaffold similarity |
desc2D | Descriptors | 223 | Fast | Interpretable models |
mordred | Descriptors | 1800+ | Medium | Comprehensive features |
map4 | Fingerprint | 2048 | Fast | Large-scale screening |
ChemBERTa-77M-MLM | Deep learning | 384 | Slow* | Transfer learning |
CheMeleonTransformer | Foundation model | 2048 | Slow* | Descriptor-pretrained embeddings |
*First run is slow; subsequent runs benefit from caching
This skill includes comprehensive reference documentation:
Complete API documentation covering:
molfeat.calc - All calculator classes and parametersmolfeat.trans - Transformer classes and methodsmolfeat.store - ModelStore usageWhen to load: Reference when implementing specific calculators, understanding transformer parameters, or integrating with scikit-learn/PyTorch.
Comprehensive catalog of all 100+ featurizers organized by category:
When to load: Reference when selecting the optimal featurizer for a specific task, exploring available options, or understanding featurizer characteristics.
Search tip: Use grep to find specific featurizer types:
grep -i "chembert" references/available_featurizers.md
grep -i "pharmacophore" references/available_featurizers.md
Practical code examples for common scenarios:
When to load: Reference when implementing specific workflows, troubleshooting issues, or learning molfeat patterns.
Enable error handling to skip invalid SMILES:
transformer = MoleculeTransformer(
calc,
ignore_errors=True,
verbose=True
)
Process in chunks or use streaming approaches for datasets > 100K molecules.
Some models require additional packages. Install specific extras:
uv pip install "molfeat[transformer]" # For ChemBERTa/ChemGPT/MolT5
uv pip install "molfeat[pyg]" # For Mol-JEPA (with the transformer extra)
There is no dgl extra in molfeat 1.x — the DGL GIN models were removed.
Save exact configurations and document versions:
transformer.to_state_yaml_file("config.yml")
import molfeat
print(f"molfeat version: {molfeat.__version__}")
Part of the AlterLab Academic Skills suite.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-cheminformatics:alterlab-molfeatfrom alterlab-cheminformatics
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-cheminformatics12 skills in this plugin
/alterlab-datamolWraps RDKit in a high-level, pandas-friendly datamol interface with sensible defaults for everyday drug discovery — SMILES/SDF loading into DataFrames, molecule standardization, descriptors, fingerprints, Butina clustering, 3D conformer generation, scaffold analysis, and parallel batch processing, returning native rdkit.Chem.Mol objects. Use when running standard cheminformatics pipelines on molecule tables with minimal boilerplate; for low-level control, custom sanitization, or specialized algorithms prefer alterlab-rdkit. Part of the AlterLab Academic Skills suite./alterlab-deepchemRuns molecular machine learning with DeepChem — diverse featurizers, pre-built MoleculeNet benchmark datasets, and pre-trained models (ChemBERTa, GROVER) for property prediction (ADMET, toxicity, solubility) via traditional ML or graph neural networks. Use when running end-to-end molecular ML experiments that need MoleculeNet benchmarks, scaffold splitting, or ready-made models with minimal setup; for building custom PyTorch graph architectures prefer alterlab-torch-geometric, and for standalone molecule-to-feature-vector generation prefer alterlab-molfeat. Part of the AlterLab Academic Skills suite./alterlab-diffdockPredicts protein-ligand binding poses with DiffDock diffusion-based molecular docking from PDB structures and SMILES, producing pose confidence scores for virtual screening and structure-based drug design. Use when docking ligands into a protein, generating binding poses, or screening compounds against a target; not for binding affinity prediction. Part of the AlterLab Academic Skills suite./alterlab-matchmsComputes mass-spectral similarity and identifies compounds for metabolomics with matchms — comparing mass spectra, scoring similarity (cosine, modified cosine), and searching spectral libraries to annotate unknowns. Use when matching MS/MS spectra, identifying metabolites, or library searching; for full LC-MS/MS proteomics pipelines use alterlab-pyopenms. Part of the AlterLab Academic Skills suite./alterlab-medchemApplies medicinal-chemistry filters with the medchem library — drug-likeness rules (Lipinski, Veber), PAINS filters, structural alerts, and molecular complexity metrics for compound prioritization and library cleanup. Use when filtering or triaging a compound library, flagging PAINS or reactive groups, or assessing drug-likeness of candidate molecules. Part of the AlterLab Academic Skills suite./alterlab-molecular-dynamicsRuns and analyzes molecular dynamics simulations with OpenMM and MDAnalysis — setting up protein and small-molecule systems, assigning force fields, running energy minimization and production MD, and analyzing trajectories (RMSD, RMSF, contact maps, free energy surfaces). Use when simulating protein or ligand dynamics, equilibrating a system, or computing trajectory metrics for structural biology, drug binding, or biophysics. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job