Source profileQuality 93/100

K-Dense-AI/scientific-agent-skills/skills/molfeat/SKILL.md

molfeat

Molecular featurization for ML (100+ featurizers). ECFP, MACCS, descriptors, pretrained models (ChemBERTa), convert SMILES to features, for QSAR and molecular ML.

Source repository stars
31,966
Declared platforms
0
Static risk flags
0
Last source update
2026-07-28
Source checked
2026-07-28

Decision brief

What it does—and where it fits

Molecular featurization for ML (100+ featurizers). ECFP, MACCS, descriptors, pretrained models (ChemBERTa), convert SMILES to features, for QSAR and molecular ML.

Best for

  • Molecular machine learning: Building QSAR/QSPR models, property prediction
  • Virtual screening: Ranking compound libraries for biological activity
  • Similarity searching: Finding structurally similar molecules

Not for

  • Invalid Molecules
  • Memory Issues with Large Datasets

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill "skills/molfeat"
Safe inspection promptEditorial

Inspect the Agent Skill "molfeat" from https://github.com/K-Dense-AI/scientific-agent-skills/blob/e7ac42510774624f327003c95b6650e2883bc01d/skills/molfeat/SKILL.md at commit e7ac42510774624f327003c95b6650e2883bc01d. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Quick Start Workflow

    python import datamol as dm from molfeat.calc import FPCalculator from molfeat.trans import MoleculeTransformer

    python import datamol as dm from molfeat.calc import FPCalculator from molfeat.trans import MoleculeTransformer
  2. 02

    Process dataset with potentially invalid SMILES

    transformer = MoleculeTransformer( calc, njobs=-1, ignoreerrors=True, Continue on failures verbose=True Log error details )

    transformer = MoleculeTransformer( calc, njobs=-1, ignoreerrors=True, Continue on failures verbose=True Log error details )features = transformer(smileswitherrors)
  3. 03

    Get usage information

    modelcard = store.search(name="ChemBERTa-77M-MLM")[0] modelcard.usage() Display usage examples

    modelcard = store.search(name="ChemBERTa-77M-MLM")[0] modelcard.usage() Display usage examples
  4. 04

    When to Use This Skill

    This skill should be used when working with: - Molecular machine learning: Building QSAR/QSPR models, property prediction - Virtual screening: Ranking compound libraries for biological activity - Similarity searching: Finding structurally similar molecules - Chemical space analy…

    Molecular machine learning: Building QSAR/QSPR models, property predictionVirtual screening: Ranking compound libraries for biological activitySimilarity searching: Finding structurally similar molecules
  5. 05

    Installation

    Use a Python 3.9 or 3.10 environment (molfeat does not install on 3.11+ as of 0.11.0):

    Use a Python 3.9 or 3.10 environment (molfeat does not install on 3.11+ as of 0.11.0):bash uv pip install "molfeat==0.11.0"

Permission review

Static risk signals and limitations

No configured static risk pattern was detected

This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score93/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars31,966SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
K-Dense-AI/scientific-agent-skills
Skill path
skills/molfeat/SKILL.md
Commit
e7ac42510774624f327003c95b6650e2883bc01d
License
MIT
Collected
2026-07-28
Default branch
main
View the original SKILL.md

Molfeat - Molecular Featurization Hub

Overview

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.

Version note: Examples target molfeat 0.11.0 (PyPI stable, May 2025). Requires Python 3.9–3.10 (requires-python caps below 3.11). Depends on datamol ≥0.8.0 and PyTorch ≥1.13. Since 0.8.7, prefer datamol Mol objects over raw rdkit.Chem.Mol. Since 0.10.1, fingerprint calculators use RDKit's rdFingerprintGenerator API internally. Since 0.11.0, pretrained models load in memory and base models are set to PyTorch evaluation mode automatically.

When to Use This Skill

This skill should be used when working with:

  • Molecular machine learning: Building QSAR/QSPR models, property prediction
  • Virtual screening: Ranking compound libraries for biological activity
  • Similarity searching: Finding structurally similar molecules
  • Chemical space analysis: Clustering, visualization, dimensionality reduction
  • Deep learning: Training neural networks on molecular data
  • Featurization pipelines: Converting SMILES to ML-ready representations
  • Cheminformatics: Any task requiring molecular feature extraction

Installation

Use a Python 3.9 or 3.10 environment (molfeat does not install on 3.11+ as of 0.11.0):

uv pip install "molfeat==0.11.0"

# With all pip-installable optional dependencies
uv pip install "molfeat[all]==0.11.0"

Optional dependency extras (PyPI):

  • molfeat[dgl] — GNN models (GIN variants); upstream recommends dgl<=2.0 (graphbolt issues in newer DGL)
  • molfeat[graphormer] — Graphormer models
  • molfeat[transformer] — ChemBERTa, ChemGPT, MolT5
  • molfeat[fcd] — FCD descriptors
  • molfeat[pyg] — PyTorch Geometric featurizers
  • molfeat[viz] — NGLView visualization widgets

External featurizers: MAP4 is not bundled in molfeat extras — install from reymond-group/map4 separately. Some heavy deps (DGL, dgllife, graphormer-pretrained) are easier via conda-forge; see optional dependencies.

Core Concepts

Molfeat organizes featurization into three hierarchical classes:

1. Calculators (molfeat.calc)

Callable objects that convert individual molecules into feature vectors. Accept RDKit Chem.Mol objects or SMILES strings.

Use calculators for:

  • Single molecule featurization
  • Custom processing loops
  • Direct feature computation

Example:

from molfeat.calc import FPCalculator

calc = FPCalculator("ecfp", radius=3, fpSize=2048)
features = calc("CCO")  # Returns numpy array (2048,)

2. Transformers (molfeat.trans)

Scikit-learn compatible transformers that wrap calculators for batch processing with parallelization.

Use transformers for:

  • Batch featurization of molecular datasets
  • Integration with scikit-learn pipelines
  • Parallel processing (automatic CPU utilization)

Example:

from molfeat.trans import MoleculeTransformer
from molfeat.calc import FPCalculator

transformer = MoleculeTransformer(FPCalculator("ecfp"), n_jobs=-1)
features = transformer(smiles_list)  # Parallel processing

3. Pretrained Transformers (molfeat.trans.pretrained)

Specialized transformers for deep learning models with batched inference and caching.

Use pretrained transformers for:

  • State-of-the-art molecular embeddings
  • Transfer learning from large chemical datasets
  • Deep learning feature extraction

Example:

from molfeat.trans.pretrained import PretrainedMolTransformer

transformer = PretrainedMolTransformer("ChemBERTa-77M-MLM", n_jobs=-1)
embeddings = transformer(smiles_list)  # Deep learning embeddings

Quick Start Workflow

Basic Featurization

import datamol as dm
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
calc = FPCalculator("ecfp", radius=3)
transformer = MoleculeTransformer(calc, n_jobs=-1)

# Featurize molecules
features = transformer(smiles)
print(f"Shape: {features.shape}")  # (4, 2048)

Save and Load Configuration

# 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")

Handle Errors Gracefully

# Process dataset with potentially invalid SMILES
transformer = MoleculeTransformer(
    calc,
    n_jobs=-1,
    ignore_errors=True,  # Continue on failures
    verbose=True          # Log error details
)

features = transformer(smiles_with_errors)
# Returns None for failed molecules

Choosing a Featurizer and Common Workflows

Featurizer choice by task — traditional ML (RF, SVM, XGBoost), deep learning, similarity searching, and pharmacophore-based approaches — plus worked workflows for QSAR model building, virtual screening, similarity search, scikit-learn pipeline integration, and comparing multiple featurizers, are in references/choosing_a_featurizer.md.

The full featurizer list is in references/available_featurizers.md; more examples are in references/examples.md.

Discovering Available Featurizers

Use the ModelStore to explore all available featurizers:

from molfeat.store.modelstore import ModelStore

store = ModelStore()

# List all available models
all_models = store.available_models
print(f"Total featurizers: {len(all_models)}")

# Search for specific models
chemberta_models = store.search(name="ChemBERTa")
for model in chemberta_models:
    print(f"- {model.name}: {model.description}")

# Get usage information
model_card = store.search(name="ChemBERTa-77M-MLM")[0]
model_card.usage()  # Display usage examples

# Load model
transformer = store.load("ChemBERTa-77M-MLM")

Advanced Features

Custom Preprocessing

class CustomTransformer(MoleculeTransformer):
    def preprocess(self, mol):
        """Custom preprocessing pipeline"""
        if isinstance(mol, str):
            mol = dm.to_mol(mol)
        mol = dm.standardize_mol(mol)
        mol = dm.remove_salts(mol)
        return mol

transformer = CustomTransformer(FPCalculator("ecfp"), n_jobs=-1)

Batch Processing Large Datasets

import numpy as np

def featurize_in_chunks(smiles_list, transformer, chunk_size=10000):
    """Process large datasets in chunks to manage memory"""
    all_features = []
    for i in range(0, len(smiles_list), chunk_size):
        chunk = smiles_list[i:i+chunk_size]
        features = transformer(chunk)
        all_features.append(features)
    return np.vstack(all_features)

Caching Expensive Embeddings

Prefer molfeat's built-in pretrained-model cache when possible. For custom embedding caches, use NumPy arrays instead of pickle (pickle can execute arbitrary code when loading untrusted files):

import numpy as np
from pathlib import Path

cache_file = Path("embeddings_cache.npz")  # fixed path under your project
transformer = PretrainedMolTransformer("ChemBERTa-77M-MLM", n_jobs=-1)

if cache_file.exists():
    embeddings = np.load(cache_file)["embeddings"]
else:
    embeddings = transformer(smiles_list)
    np.savez(cache_file, embeddings=embeddings)

Performance Tips

  1. Use parallelization: Set n_jobs=-1 to utilize all CPU cores
  2. Batch processing: Process multiple molecules at once instead of loops
  3. Choose appropriate featurizers: Fingerprints are faster than deep learning models
  4. Cache pretrained models: Leverage built-in caching for repeated use
  5. Use float32: Set dtype=np.float32 when precision allows
  6. Handle errors efficiently: Use ignore_errors=True for large datasets

Common Featurizers Reference

Quick reference for frequently used featurizers:

FeaturizerTypeDimensionsSpeedUse Case
ecfpFingerprint2048FastGeneral purpose
maccsFingerprint167Very fastScaffold similarity
desc2DDescriptors200+FastInterpretable models
mordredDescriptors1800+MediumComprehensive features
map4Fingerprint1024FastLarge-scale screening
ChemBERTa-77M-MLMDeep learning768Slow*Transfer learning
gin-supervised-maskingGNNVariableSlow*Graph-based models

*First run is slow; subsequent runs benefit from caching

Resources

This skill includes comprehensive reference documentation:

references/api_reference.md

Complete API documentation covering:

  • molfeat.calc - All calculator classes and parameters
  • molfeat.trans - Transformer classes and methods
  • molfeat.store - ModelStore usage
  • Common patterns and integration examples
  • Performance optimization tips

When to load: Reference when implementing specific calculators, understanding transformer parameters, or integrating with scikit-learn/PyTorch.

references/available_featurizers.md

Comprehensive catalog of all 100+ featurizers organized by category:

  • Transformer-based language models (ChemBERTa, ChemGPT)
  • Graph neural networks (GIN, Graphormer)
  • Molecular descriptors (RDKit, Mordred)
  • Fingerprints (ECFP, MACCS, MAP4, and 15+ others)
  • Pharmacophore descriptors (CATS, Gobbi)
  • Shape descriptors (USR, ElectroShape)
  • Scaffold-based descriptors

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

references/examples.md

Practical code examples for common scenarios:

  • Installation and quick start
  • Calculator and transformer examples
  • Pretrained model usage
  • Scikit-learn and PyTorch integration
  • Virtual screening workflows
  • QSAR model building
  • Similarity searching
  • Troubleshooting and best practices

When to load: Reference when implementing specific workflows, troubleshooting issues, or learning molfeat patterns.

Troubleshooting

Invalid Molecules

Enable error handling to skip invalid SMILES:

transformer = MoleculeTransformer(
    calc,
    ignore_errors=True,
    verbose=True
)

Memory Issues with Large Datasets

Process in chunks or use streaming approaches for datasets > 100K molecules.

Pretrained Model Dependencies

Some models require additional packages. Install specific extras (pin version for reproducibility):

uv pip install "molfeat[transformer]==0.11.0"  # For ChemBERTa/ChemGPT
uv pip install "molfeat[dgl]==0.11.0"          # For GIN models
uv pip install "molfeat[graphormer]==0.11.0"   # For Graphormer

Reproducibility

Save exact configurations and document versions:

transformer.to_state_yaml_file("config.yml")
import molfeat
print(f"molfeat version: {molfeat.__version__}")

Additional Resources

Alternatives

Compare before choosing

Computed 9831,966

K-Dense-AI/scientific-agent-skills

dask

Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.

Computed 9831,966

K-Dense-AI/scientific-agent-skills

medchem

Medicinal chemistry filters for compound triage. Apply drug-likeness rules (Lipinski, Veber, CNS), structural alert catalogs (PAINS, NIBR, ChEMBL), complexity metrics, and the medchem query language for library filtering.

Computed 9831,966

K-Dense-AI/scientific-agent-skills

neurokit2

Use NeuroKit2 to build or audit reproducible research workflows for physiological time-series preprocessing, event/interval analysis, multimodal alignment, variability, and complexity. Trigger when code imports neurokit2 or needs its current APIs, schemas, and method-aware validation—not for diagnosis or device validation.

Computed 9731,966

K-Dense-AI/scientific-agent-skills

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.