Chuyển đến nội dung
Skillpedia
Học máy51k · #3501

molfeat

Skill này làm gì

Công cụ này chuyển thông tin về phân tử hóa học (như cấu trúc của chúng) thành biểu diễn số mà máy tính hiểu được. Các biểu diễn này dùng cho các tác vụ như dự đoán thuộc tính phân tử hoặc tìm phân tử tương tự.

Khi nào nên dùng

  • ✓Khi bạn muốn dự đoán thuộc tính của phân tử mới.
  • ✓Khi tìm kiếm phân tử có đặc tính tương tự một phân tử đã biết.
  • ✓Để huấn luyện mô hình học máy với dữ liệu phân tử.

Liên kết skill

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/molfeat/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/molfeat/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chuyển phân tử SMILES “CCO” thành dấu vân tay ECFP với bán kính 2.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng các thuật toán cụ thể để chuyển cấu trúc phân tử thành một chuỗi số (dấu vân tay hoặc descriptor). Nó có thể xử lý các kiểu biểu diễn khác nhau và đảm bảo việc chuyển đổi nhất quán.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Molfeat — Small-molecule featurization

When to use

Use this skill to turn SMILES or RDKit molecules into fingerprints, descriptors, pharmacophores, or pretrained embeddings for molecular machine learning and similarity search. Compare representations on the same molecular split and assay endpoint.

This skill targets Molfeat 1.0.0. The previous 0.11 runtime guidance is obsolete: 1.x supports modern Python and removes DGL/DGLLife, legacy Graphormer, and protein adapters. Historical model-store cards can still name removed adapters. The tagged 1.0 migration guide and source take precedence over older pages still served at the documentation's stable URL.

Installation

Create an isolated environment. Core examples were executed on Python 3.13.3/macOS Apple Silicon with Molfeat 1.0.0, datamol 0.13.0, RDKit 2026.03.6, and PyTorch 2.14.1.

uv venv --python 3.13 .venv-molfeat
uv pip install --python .venv-molfeat/bin/python "molfeat==1.0.0"

On Windows use .venv-molfeat\Scripts\python.exe as the interpreter path. Upstream supports Python 3.11–3.14; macOS Intel uses Python 3.11–3.12, PyTorch 2.2.x, NumPy<2, and Transformers<5. Other platforms require PyTorch>=2.5. Let Molfeat's platform markers resolve these constraints; do not copy Apple Silicon pins to Intel.

Install only needed extras with the same interpreter: molfeat[transformer]==1.0.0 for Hugging Face models, [mordred] for mordredcommunity, [pyg] for graph tensors, [fcd] for ChemNet embeddings, [selfies] for SELFIES conversion, [cache] for HDF5/Parquet, [viz] for visualization, and [cloud] for S3/GCS stores. DGL and Graphormer extras no longer exist. Pretrained inference may download substantial weights; check model licensing, disk space, and device requirements first.

Workflow

  1. Preserve source record IDs, labels, original structures, and a declared policy for salts, stereochemistry, tautomers, charge, and duplicate compounds. Standardization changes chemical identity; apply the same policy to training and prediction.
  2. Start with an explicit ECFP baseline. A calculator processes one molecule; MoleculeTransformer batches it. datamol.Mol is RDKit's molecule type.
  3. Record rejected positions and align every associated array. Inspect descriptor NaN/Inf separately: successful parsing does not guarantee finite features.
  4. Fit any feature selection, imputation, scaling, and model inside the training fold. Prefer scaffold/group or temporal splits appropriate to the scientific question; random splits can leak close analogues or repeated measurements.
  5. Save the featurizer state, ordered feature names, package versions, molecular preprocessing policy, and input IDs. Revalidate old state after migrating to 1.x.

Fingerprint baseline and invalid records

import numpy as np
from molfeat.calc import FPCalculator
from molfeat.trans import MoleculeTransformer

smiles = ["CCO", "invalid", "CC(=O)O", "c1ccccc1"]
record_ids = np.array(["ethanol", "rejected", "acetate", "benzene"])
y = np.array([0.1, 9.9, 0.2, 0.3])  # toy labels only
calc = FPCalculator("ecfp", radius=2, fpSize=2048, includeChirality=True)
transformer = MoleculeTransformer(calc, n_jobs=1, dtype=np.float32)
X, valid_ids = transformer(smiles, ignore_errors=True)
assert X.shape == (3, 2048)
X_ids, y_valid = record_ids[valid_ids], y[valid_ids]
assert valid_ids == [0, 2, 3]
assert np.isfinite(X).all()

ignore_errors belongs on the call, not the constructor. With True, __call__ returns filtered features and original input positions; with False, it raises on failed molecules. transform(..., ignore_errors=True) preserves positions using None for failures. Never filter each feature block independently and then concatenate.

ECFP radius is a bond radius: radius=2 means ECFP4; radius 3 means ECFP6. In 1.0.0 FPCalculator("ecfp") defaults to radius 2 and 2048 bits. FPVecTransformer has a different default length of 2000, so specify length=2048 when using it.

Configuration round trip

transformer.to_state_yaml_file("featurizer.yml")
loaded = MoleculeTransformer.from_state_yaml_file("featurizer.yml")
np.testing.assert_array_equal(loaded(["CCO"]), transformer(["CCO"]))

Load only trusted configuration/artifacts. State can identify Python classes and

…

Câu hỏi thường gặp

“Dấu vân tay” và “descriptor” là gì?

Dấu vân tay giống như mã vạch số của phân tử, thể hiện sự có mặt hoặc vắng mặt của một số đặc điểm. Descriptor là các giá trị số định lượng một đặc tính phân tử cụ thể.

Tôi có thể dùng công cụ này với mọi loại phân tử không?

Có, miễn là phân tử được biểu diễn ở định dạng công cụ hiểu được, như SMILES hoặc cấu trúc RDKit. Công cụ cũng có thể nhận diện và tùy chọn bỏ qua các phân tử không hợp lệ.

Làm sao để đảm bảo kết quả đáng tin cậy khi huấn luyện mô hình?

Quan trọng là dùng cùng một quy tắc chuẩn hóa cho mọi phân tử (cả tập huấn luyện và kiểm tra) và lưu lại chính xác cấu hình đã dùng để tạo biểu diễn. Điều này đảm bảo tính nhất quán.

Chi tiết

Mô tả gốc của tác giả

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.

repo: K-Dense-AI/scientific-agent-skills

Độ phổ biến

Sao GitHub
51k
Vị trí xếp hạng
#3501
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự