Index of every page on this site: llms.txt
All skills
k-dense-ai avatar

/molfeat

@ec59a29
Run it yourself

Featurizes small molecules with Molfeat for QSAR/QSPR, chemical similarity, virtual screening, and molecular ML. Covers ECFP/MACCS fingerprints, RDKit descriptors, pharmacophores, pretrained embeddings, configuration persistence, and molecule-to-label alignment.

Use this Skill: https://skilld.dev/gh/k-dense-ai/scientific-agent-skills/molfeat

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceschoosing_a_featurizer.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Choosing representations and evaluating molecular models

Start with ECFP and a simple estimator. Choose descriptors for interpretability, pharmacophores for a stated interaction hypothesis, and 3D features only when the conformer protocol is justified. Pretrained embeddings are candidates to evaluate; model size or pretraining volume does not establish task performance.

Use identical splits, assay endpoints, and molecule policies across representations. Keep close analogues, duplicate structures, and repeated measurements together when they would otherwise leak information. A scaffold split is useful for testing novel cores; temporal splitting may better approximate future screening. Record which scientific generalization question the split addresses.

Toy grouped QSAR pipeline

Executed on synthetic data to check API behavior only; its score has no scientific meaning. Replace inputs, labels, and group assignments with curated assay records. All preprocessing that learns from data stays inside the cross-validation pipeline.

import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.impute import SimpleImputer
from sklearn.linear_model import Ridge
from sklearn.model_selection import GroupKFold, cross_val_score
from molfeat.calc import RDKitDescriptors2D
from molfeat.trans import MoleculeTransformer

smiles = ["CCO", "CCCO", "CCCCO", "CCCCCO",
          "CCN", "CCCN", "CCCCN", "CCCCCN"]
y = np.arange(8, dtype=float)  # artificial labels
groups = np.array([0, 0, 1, 1, 2, 2, 3, 3])  # artificial groups
pipeline = Pipeline([
    ("features", MoleculeTransformer(RDKitDescriptors2D(), dtype=np.float64)),
    ("impute", SimpleImputer(strategy="median")),
    ("scale", StandardScaler()),
    ("regress", Ridge(alpha=1.0)),
])
scores = cross_val_score(
    pipeline, smiles, y, groups=groups, cv=GroupKFold(4),
    scoring="neg_mean_absolute_error", error_score="raise",
)
assert np.isfinite(scores).all()

Validate molecular inputs before splitting while preserving labels/IDs. Do not drop rows inside a scikit-learn transformer without also handling the target vector. MoleculeTransformer.fit can remove training columns containing NaN; keep feature names after fitting. Imputers do not automatically handle Inf, and missing validation descriptors still need a declared policy. Tune representations/hyperparameters in an inner split and reserve an untouched evaluation set.

Classification requires class-aware metrics and sufficient positive/negative examples in each fold. ROC AUC alone can obscure poor precision in sparse screening libraries; report PR metrics and enrichment at a prespecified screening budget when applicable. Confirm activity units, assay comparability, censoring, and target transforms before regression; raw IC50 values are not interchangeable with pIC50.

Bounded-memory virtual screening

Illustrative: classifier is fitted and its training featurizer is supplied. Invalid inputs must be reported, and output rows carry their original positions. This example retains only a chunk's feature matrix and immediately emits scores.

import numpy as np

def scored_chunks(smiles, transformer, classifier, active_label=1, chunk_size=1000):
    if chunk_size <= 0:
        raise ValueError("chunk_size must be positive")
    matches = np.flatnonzero(np.asarray(classifier.classes_) == active_label)
    if len(matches) != 1:
        raise ValueError("active_label must identify one fitted classifier class")
    column = int(matches[0])
    for start in range(0, len(smiles), chunk_size):
        chunk = smiles[start:start + chunk_size]
        X, valid_ids = transformer(chunk, ignore_errors=True)
        rejected = sorted(set(range(len(chunk))) - set(valid_ids))
        original_positions = np.asarray(valid_ids, dtype=int) + start
        if len(valid_ids):
            if not np.isfinite(X).all():
                raise ValueError("nonfinite screening features require an explicit policy")
            probabilities = classifier.predict_proba(X)[:, column]
        else:
            probabilities = np.empty(0)
        yield original_positions, probabilities, [start + i for i in rejected]

Write results per chunk, or maintain a bounded top-k heap. Avoid featurizing a million molecules at once or accumulating every chunk before vstack. A probability from an uncalibrated classifier is a ranking score, not established biological confidence. Check chemical applicability and validate prioritized compounds experimentally.

Compare featurizers without mixing interfaces

Use MoleculeTransformer(FPCalculator(...)) for a calculator, FeatConcat directly for an FPVecTransformer container, and PretrainedHFTransformer directly for embeddings. Wrapping either of the latter as a single-molecule calculator changes the expected batch interface. Fix seeds and use paired evaluation on the same folds. See API contracts and examples for executable patterns.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts27d4 checks · Risk SAFE
  • Gen Agent Trust Hub27d

    The Molfeat skill is a legitimate scientific tool for molecular featurization. It facilitates chemical informatics workflows by integrating with established libraries like RDKit and Hugging Face. The skill includes appropriate security warnings regarding the ingestion of serialized models and configuration files, and it correctly identifies standard risks associated with remote code execution in specific machine learning models. No malicious patterns or unauthorized behaviors were detected.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at ec59a29. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 2 months ago
All 1 allowed tools
Read Write Edit Bash
Other metadata
compatibility
Requires Python 3.11+ and molfeat 1.0.0 (RDKit, datamol, PyTorch). macOS Intel needs Python 3.11–3.12 and upstream platform-specific dependency pins. Optional extras and network access are needed for pretrained models; core fingerprints run offline.
metadata
{
  "version": "2.0",
  "skill-author": "K-Dense Inc.",
  "last-reviewed": "2026-10-01",
  "upstream-version": "1.0.0"
}

README badge

README badge for k-dense-ai/scientific-agent-skills/molfeat