cheminformatics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cheminformatics (RDKit) — Pipeline Skill (Thin Scaffold)

化学信息学(RDKit)— Pipeline Skill(轻量脚手架)

Overview

概述

Adds fingerprint selection logic, filter cascade ordering, and version-specific gotchas for RDKit workflows. The agent already knows RDKit syntax — this skill prevents parameter mismatches and deprecated API usage.
为 RDKit 工作流增加指纹选择逻辑、过滤器级联顺序以及特定版本的注意事项。Agent 已了解 RDKit 语法;此 skill 用于防止参数不匹配和弃用 API 的使用。

Usage

使用场景

  • Activate when filtering compound libraries (Lipinski/Veber/PAINS)
  • Activate for fingerprint similarity search or clustering
  • Activate for matched molecular pair (MMP) analysis with mmpdb
  • 过滤化合物库时启用(Lipinski/Veber/PAINS)
  • 进行指纹相似度搜索或聚类时启用
  • 使用 mmpdb 进行匹配分子对(MMP)分析时启用

Core Concepts

核心概念

Filter cascade order: Lipinski → Veber → PAINS → similarity (cheapest first, most expensive last).
Fingerprint API: Use
rdFingerprintGenerator
module exclusively (since RDKit 2024.03). The
AllChem.GetMorganFingerprintAsBitVect()
path is deprecated and will be removed.
SMILES validation: Always parse with
sanitize=False
then explicit
SanitizeMol()
in try/except. Default
MolFromSmiles
silently returns None on partial failures.
过滤器级联顺序: Lipinski → Veber → PAINS → 相似度(先执行成本最低的过滤器,最后执行成本最高的)。
指纹 API: 仅使用
rdFingerprintGenerator
模块(自 RDKit 2024.03 起)。
AllChem.GetMorganFingerprintAsBitVect()
路径已弃用,并将在未来版本中移除。
SMILES 验证: 始终先使用
sanitize=False
解析,再在 try/except 中显式调用
SanitizeMol()
。默认的
MolFromSmiles
在部分解析失败时会静默返回 None。

Decision Logic

决策逻辑

Fingerprint Selection

指纹选择

GoalFingerprintParametersTanimoto threshold
General similarityMorgan (ECFP4)radius=2, fpSize=2048≥ 0.7
High-specificity matchingMorgan (ECFP6)radius=3, fpSize=4096≥ 0.6
Substructure screeningMACCS 166 keys—≥ 0.8
Pharmacophore similarityFCFPradius=2,
GetMorganFeatureAtomInvGen()
≥ 0.6
Large-scale clusteringMorganradius=2, fpSize=1024Speed over precision
目标指纹参数Tanimoto 阈值
通用相似度Morgan (ECFP4)radius=2, fpSize=2048≥ 0.7
高特异性匹配Morgan (ECFP6)radius=3, fpSize=4096≥ 0.6
子结构筛选MACCS 166 keys—≥ 0.8
药效团相似度FCFPradius=2,
GetMorganFeatureAtomInvGen()
≥ 0.6
大规模聚类Morganradius=2, fpSize=1024速度优先于精度

Filter Thresholds

过滤阈值

FilterRuleThresholdNotes
Lipinski MW≤ 500 DaAllow ≤1 violation totalNot binary pass/fail
Lipinski LogP≤ 5——
Lipinski HBD≤ 5——
Lipinski HBA≤ 10——
Veber TPSA≤ 140 ŲHard cutoff—
Veber RotBonds≤ 10Hard cutoff—
PAINSA+B+C catalogsHTS triage onlyDon't apply to advanced compounds
过滤器规则阈值备注
Lipinski MW≤ 500 Da总计允许 ≤1 项违规不采用二元通过/失败判定
Lipinski LogP≤ 5——
Lipinski HBD≤ 5——
Lipinski HBA≤ 10——
Veber TPSA≤ 140 Ų硬性截止值—
Veber RotBonds≤ 10硬性截止值—
PAINSA+B+C catalogs仅用于 HTS 筛选分流不要应用于后期优化化合物

MMP Analysis Decision

MMP 分析决策

ScenarioToolKey parameter
SAR from compound pairsmmpdb fragment → index → transform
--min-pairs 3
Property predictionmmpdb predictRequires indexed DB with property data
Core identification
rdFMCS.FindMCS()
ringMatchesRingOnly=True, completeRingsOnly=True
Large libraries (>10K)mmpdb CLI
--max-variable-size 10
to limit fragmentation
场景工具关键参数
基于化合物对进行 SAR 分析mmpdb fragment → index → transform
--min-pairs 3
性质预测mmpdb predict需要包含性质数据的已索引数据库
核心结构鉴定
rdFMCS.FindMCS()
ringMatchesRingOnly=True, completeRingsOnly=True
大型化合物库(>10K)mmpdb CLI使用
--max-variable-size 10
限制片段化

Critical Parameters

关键参数

ParameterValueWhen to change
Morgan radius2 (ECFP4)3 for higher specificity
fpSize20481024 for speed; 4096 for precision
includeChiralityFalseTrue for stereo-sensitive applications
Lipinski max_violations10 for strict; exempt biologics entirely
mmpdb --min-pairs3Lower for sparse datasets
mmpdb --max-variable-size10Increase for macrocycle transformations
PAINS catalogsA+B+C (all three)Never use partial sets
参数值何时调整
Morgan radius2 (ECFP4)需要更高特异性时改为 3
fpSize2048追求速度时设为 1024;追求精度时设为 4096
includeChiralityFalse对立体化学敏感的应用设为 True
Lipinski max_violations1严格模式设为 0;生物制剂完全豁免
mmpdb --min-pairs3稀疏数据集时调低
mmpdb --max-variable-size10大环转化时调高
PAINS catalogsA+B+C(三者全部使用)绝不使用部分集合

Common Mistakes

常见错误

  • Wrong:
    AllChem.GetMorganFingerprintAsBitVect()
    → Right:
    rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048).GetFingerprint(mol)
    → Why: AllChem FP functions deprecated since RDKit 2024.03, will be removed
  • Wrong: Default
    MolFromSmiles(smi)
    without error handling → Right:
    MolFromSmiles(smi, sanitize=False)
    +
    SanitizeMol()
    in try/except → Why: Default silently returns None; explicit sanitize catches partial failures
  • Wrong: Lipinski as hard binary filter → Right: Allow ≤1 violation → Why: Many approved drugs violate one rule; binary filtering rejects valid candidates
  • Wrong: PAINS on clinical candidates → Right: PAINS only for HTS library triage → Why: Designed for screening artifacts; flags valid advanced compounds
  • Wrong: Morgan radius=1 → Right: radius=2 minimum (ECFP4) → Why: Radius 1 loses structural information; too many false-positive similarities
  • Wrong: Comparing FPs with different radius or nBits → Right: Identical parameters for both FPs → Why: Tanimoto only meaningful in same parameter space
  • Wrong: Ignoring stereochemistry for chiral compounds → Right:
    includeChirality=True
    in generator → Why: Default treats enantiomers as identical
  • Wrong: Fixed 0.7 threshold for all FP types → Right: Validate threshold per fingerprint type and chemical series → Why: 0.7 convention is ECFP4-specific; other types need different cutoffs
  • Wrong: Raw SMILES into mmpdb → Right: Pre-canonicalize with
    MolToSmiles(MolFromSmiles(smi))
    → Why: mmpdb expects canonical SMILES; non-canonical causes fragmentation errors
  • Wrong: Confusing LogP with LogD → Right: Use LogD at pH 7.4 for ionizable compounds; RDKit computes LogP only → Why: LogP overestimates lipophilicity for ionizable molecules at physiological pH
  • 错误:
    AllChem.GetMorganFingerprintAsBitVect()
    → 正确:
    rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048).GetFingerprint(mol)
    → 原因: AllChem FP 函数自 RDKit 2024.03 起已弃用,并将在未来版本中移除
  • 错误: 默认使用
    MolFromSmiles(smi)
    而不进行错误处理 → 正确:
    MolFromSmiles(smi, sanitize=False)
    + 在 try/except 中调用
    SanitizeMol()
    → 原因: 默认行为会静默返回 None;显式 sanitize 可以捕获部分解析失败
  • 错误: 将 Lipinski 作为硬性二元过滤器 → 正确: 允许 ≤1 项违规 → 原因: 许多已批准药物会违反其中一项规则;二元过滤会排除有效候选物
  • 错误: 对临床候选物使用 PAINS → 正确: PAINS 仅用于 HTS 化合物库筛选分流 → 原因: PAINS 旨在识别筛选伪影;它会误报有效的后期优化化合物
  • 错误: Morgan radius=1 → 正确: radius 最低为 2(ECFP4) → 原因: 半径 1 会丢失结构信息,并造成过多假阳性相似结果
  • 错误: 比较具有不同 radius 或 nBits 的 FP → 正确: 两个 FP 使用完全相同的参数 → 原因: 只有在相同参数空间内,Tanimoto 相似度才有意义
  • 错误: 对手性化合物忽略立体化学 → 正确: 在 generator 中设置
    includeChirality=True
    → 原因: 默认设置会将对映异构体视为相同
  • 错误: 对所有 FP 类型使用固定的 0.7 阈值 → 正确: 根据指纹类型和化学系列验证阈值 → 原因: 0.7 是 ECFP4 特有的惯例;其他类型需要不同的截止值
  • 错误: 将原始 SMILES 直接传入 mmpdb → 正确: 先使用
    MolToSmiles(MolFromSmiles(smi))
    转换为 canonical SMILES → 原因: mmpdb 预期接收 canonical SMILES;非 canonical 输入会导致片段化错误
  • 错误: 混淆 LogP 与 LogD → 正确: 对可电离化合物使用 pH 7.4 下的 LogD;RDKit 仅计算 LogP → 原因: 在生理 pH 下,LogP 会高估可电离分子的亲脂性

Response Format

响应格式

  • Lead with the command or code the user needs — explain after
  • Structure as: confirm inputs → working code → key parameters explained → gotchas
  • One complete working example per task; do not show every alternative
  • Keep code comments minimal and functional
  • Target: 50-100 lines of code with brief surrounding explanation
  • 先给出用户需要的命令或代码——之后再进行解释
  • 结构:确认输入 → 可运行代码 → 关键参数说明 → 注意事项
  • 每项任务提供一个完整可运行示例;不要展示所有替代方案
  • 保持代码注释精简且实用
  • 目标:提供 50-100 行代码,并附上简要说明