datamol – skill Khác cho agent AI
Wrapper Python bao quanh RDKit với giao diện đơn giản và mặc định hợp lý. Ưu tiên cho khám phá thuốc thông thường gồm phân tích SMILES, chuẩn hóa, descriptor, fingerprint, phân cụm, conformer 3D, xử lý song song. Trả về đối tượng rdkit.Chem.Mol gốc. Với kiểm soát nâng cao hoặc tham số tùy chỉnh, dùng
Cài skill datamol bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/datamol-fea26.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /datamol – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/datamol-fea26.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $datamol – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/datamol-fea26.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /datamol – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/datamol-fea26.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /datamol – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Datamol Cheminformatics Skill
Overview
Datamol is a Python library that provides a lightweight, Pythonic abstraction layer over RDKit for molecular cheminformatics. Simplify complex molecular operations with sensible defaults, efficient parallelization, and modern I/O capabilities. All molecular objects are native rdkit.Chem.Mol instances, ensuring full compatibility with the RDKit ecosystem.
Verified target: datamol 0.13.0, released September 9, 2026. Local checks used
Python 3.13 and RDKit 2026.03.6. Python 3.11+ and RDKit 2024.09+ are required.
The 0.13 distribution includes SELFIES, visualization, cloud, Excel and Parquet
runtime dependencies. Current API examples and verification limits are recorded in
[references/review.md](references/review.md). Pin the environment: RDKit upgrades can
change canonical representations and retained conformers. Compare chemical invariants,
not a fixed conformer count or an exact version-dependent canonical string.
Key capabilities:
- Molecular format conversion (SMILES, SELFIES, InChI)
- Structure standardization and sanitization
- Molecular descriptors and fingerprints
- 3D conformer generation and analysis
- Clustering and diversity selection
- Scaffold and fragment analysis
- Chemical reaction application
- Visualization and alignment
- Batch processing with parallelization
- Cloud storage support via fsspec
Installation and Setup
Guide users to install datamol:
uv pip install "datamol==0.13.0"RDKit and the S3/GCS, Excel/Parquet, visualization and SELFIES dependencies are
installed by the current distribution; separate feature extras are not required.
Use an isolated environment to avoid conflicting scientific-package requirements.
Import convention:
import datamol as dmCore Workflows
Ten workflow areas, each with worked code, are documented in
[references/core_workflows.md](references/core_workflows.md):
| # | Area | Covers |
| --- | --- | --- |
| 1 | Basic molecule handling | to_mol, batch conversion, error handling, canonical and isomeric SMILES, sanitization and full standardization |
| 2 | Reading and writing files | SDF, SMILES, CSV, Excel with rendered structures, the universal reader/writer, and cloud or HTTPS paths |
| 3 | Descriptors and properties | the standard descriptor set, parallel computation, aromaticity, stereochemistry, flexibility, and filtering |
| 4 | Fingerprints and similarity | ECFP4 and other types, pairwise and cross-set distances, nearest-neighbour lookup (Tanimoto distance = 1 − similarity) |
| 5 | Clustering and diversity | similarity clustering, diverse subset picking, and cluster centroids |
| 6 | Scaffold analysis | Bemis-Murcko scaffolds, grouping and counting, and scaffold-disjoint train/test splits |
| 7 | Fragmentation | fragmenting molecules, finding common fragments across a library, and fragment-based scoring |
| 8 | 3D conformers | generation, access, RMSD clustering, representative selection, and SASA |
| 9 | Visualization | grids, files, publication SVG, substructure alignment, atom and bond highlighting, conformer display |
| 10 | Chemical reactions | reaction SMARTS, applying to a molecule or a whole library |
Three end-to-end pipelines — load/filter/analyze, SAR by scaffold series, and virtual
screening — are in [references/workflow_patterns.md](references/workflow_patterns.md).
Parallelization
Datamol includes built-in parallelization for many operations. Use n_jobs parameter:
n_jobs=1: Sequential (no parallelization)n_jobs=-1: Use all available CPU coresn_jobs=4: Use 4 cores
Functions supporting parallelization:
dm.read_sdf(..., n_jobs=-1)dm.descriptors.batch_compute_many_descriptors(..., n_jobs=-1, batch_size=128)dm.cluster_mols(..., n_jobs=-1)dm.pdist(..., n_jobs=-1)dm.conformers.sasa(..., n_jobs=-1)
Progress bars: Many batch operations support progress=True parameter.
For parallel descriptor batches, supply a positive batch_size (for example 128).
In the tested 0.13.0 stack the default None reaches joblib and raises when parallelism is enabled.
Reference Documentation
For detailed API documentation, consult these reference files:
references/core_api.md: Core namespace functions (conversions, standardization, fingerprints, clustering)references/io_module.md: File I/O operations (read/write SDF, CSV, Excel, remote files)references/conformers_module.md: 3D conformer generation, clustering, SASA calculationsreferences/descriptors_viz.md: Molecular descriptors and visualization functionsreferences/fragments_scaffolds.md: Scaffold extraction, BRICS/RECAP fragmentationreferences/reactions_data.md: Chemical reactions and toy datasets
Best Practices
1. Choose and record a task-specific standardization policy for external molecules.
Preserve original structures and IDs alongside transformed ones; metal disconnection,
neutralization, salt stripping, and stereochemistry changes can alter the assayed entity.
Do not apply these transformations automatically to organometallic or formulation tasks.
The following is an illustrative policy for inputs where metal disconnection is intended:
mol = dm.standardize_mol(mol, disconnect_metals=True, normalize=True, reionize=True)
2. Check for None values after molecule parsing:
mol = dm.to_mol(smiles)
if mol is None:
raise ValueError("Invalid SMILES; retain the source row in the rejection log")
3. Use parallel processing for large datasets:
result = dm.parallelized(dm.to_mol, smiles_list, n_jobs=-1, progress=True)
4. Use cloud I/O for the requested remote paths with the selected provider credentials:
df = dm.read_sdf("s3://bucket/compounds.sdf", as_df=True, mol_column="mol")
5. Use appropriate fingerprints for similarity:
- ECFP (Morgan): General purpose, structural similarity
- MACCS: Fast, smaller feature space
- Atom pairs: Considers atom pairs and distances
6. Consider scale limitations:
- Butina clustering stores O(N²) pairwise distances; choose a size limit from the memory budget.
- For larger datasets: use
pick_diversewith a boundednpick; hierarchical clustering can also need quadratic memory.
7. Scaffold splitting for ML: Ensure proper train/test separation by scaffold
8. Align molecules when visualizing SAR series
Error Handling
Illustrative input policy: provide smiles_list and retain source IDs plus failures alongside
the accepted molecules. Standardization is task-specific, not a repair guarantee.
# Safe molecule creation
def safe_to_mol(smiles):
try:
mol = dm.to_mol(smiles)
if mol is not None:
mol = dm.standardize_mol(mol)
return mol
except Exception as e:
print(f"Failed to process {smiles}: {e}")
return None
# Safe batch processing
valid_mols = []
for smiles in smiles_list:
mol = safe_to_mol(smiles)
if mol is not None:
valid_mols.append(mol)Integration with Machine Learning
Illustrative model template: supply aligned train_mols, y_target, and held-out test_mols.
Split compounds by the task-appropriate scaffold/group before fitting any learned preprocessing.
Datamol ships with scipy and scikit-learn as dependencies. Import them as normal PyPI packages — they are not scripts bundled in this skill.
import numpy as np
# Use the same fingerprint schema for training and held-out molecules.
fp_options = dict(fp_type="ecfp", radius=2, fpSize=2048, includeChirality=True)
X = np.stack([dm.to_fp(mol, **fp_options) for mol in train_mols])
X_test = np.stack([dm.to_fp(mol, **fp_options) for mol in test_mols])
# Train model (scikit-learn PyPI package)
from sklearn.ensemble import RandomForestRegressor # third-party library
model = RandomForestRegressor(random_state=42)
model.fit(X, y_target)
# Predict
predictions = model.predict(X_test)Troubleshooting
Issue: Molecule parsing fails
- Solution: Retain the failed source record and diagnose syntax/valence first. Standardization is not guaranteed to repair invalid chemistry; inspect any
fix_mol()result and record the transformation before treating it as the original compound.
Issue: Memory errors with clustering
- Solution: Use
dm.pick_diverse()instead of full clustering for large sets
Issue: Slow conformer generation
- Solution: Reduce
n_confsto lower embedding work. RMS pruning happens after embedding/minimization, so a largerrms_cutoffreduces retained conformers without avoiding the initial work
Issue: Remote file access fails
- Solution: Verify the selected fsspec protocol and provider credentials. S3/GCS dependencies are included in 0.13.0; other backends may need installation. Remote authorization and writes were no
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- alerting-oncall – Thiết lập quy tắc cảnh báo, cấu hình lịch trực on-call và quản lý quy trình xử lý sự cố.
- anchor-text-analyzer – Anchor Text Analyzer. Dùng khi làm việc với liên kết có anchor text và đích đến.
- angular – Chuyên gia Angular hiện đại (v20+), am hiểu sâu Signals, Standalone Components, ứng dụng…
- angular-state-management – Nắm vững quản lý state hiện đại trong Angular với Signals, NgRx và RxJS. Dùng khi thiết…
- notion-spec-to-implementation – Chuyển spec trên Notion thành kế hoạch triển khai, tác vụ và theo dõi tiến độ; dùng khi…
- diffdock – Dự đoán tư thế liên kết giữa protein và phân tử nhỏ bằng DiffDock và DiffDock-L từ PDB…
- anti-deception – Dùng trước khi phản hồi khi gặp áp lực đồng tình, tạo cảm giác khẩn cấp giả tạo, viện…
- anti-sycophancy – Loại bỏ các mẫu đồng tình xu nịnh trong phản hồi của AI. Nạp bằng /skill anti-sycophancy.