Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bio-molecular-io

БесплатноЗапускает вложенные скриптыНе проверен

Reads, writes, and converts molecular file formats (SMILES, InChI, SDF V2000/V3000, MOL2, PDB, MMTF) using RDKit and Open Babel with rigorous handling of…

gabrielmoreiraот gabrielmoreira★ 23 звезды на GitHub

Об этом скилле

Version Compatibility

Reference examples tested with: RDKit 2024.09+, Open Babel 3.1.1+, ChEMBL structure_pipeline 1.2+.

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures
  • CLI: obabel -V; obabel -L formats

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Molecular I/O

Parse, write, and convert molecular file formats. Most downstream errors trace back to silent I/O issues: incorrect aromaticity perception, lost stereochemistry, mishandled charges, dropped stereo bonds, or non-canonical tautomers. This skill enumerates each format's failure modes and prescribes the correct toolchain for each scenario.

For full standardization (canonicalization, salt stripping, tautomer enumeration) see chemoinformatics/molecular-standardization. For generating 3D conformers from parsed 2D molecules, see chemoinformatics/conformer-generation.

Format Taxonomy

Format Dim Stereo Charges Strength Fails when
SMILES 2D Explicit /\@ Net charges only Compact, web-friendly, fast parse Loses absolute coordinates; aromatic perception ambiguous across toolkits; tautomers not canonical
InChI 2D Layer 't,s' pH-fixed std layer 'p' Canonical by construction; cross-toolkit identity Loses tautomers (std InChI merges); loses stereo at C^x metals; large molecules timeout
SDF V2000 2D/3D Wedge bonds M CHG line Industry default; metadata via tags 999-atom limit; cannot encode multi-component reactions; query atoms ambiguous
SDF V3000 2D/3D Wedge + stereo flag Inline charge No atom limit; query support; rich properties Some software (legacy) cannot read; verbose
MOL2 (Tripos) 3D Wedge bonds Per-atom partial SYBYL atom types preserved for docking Atom-type dialects diverge (SYBYL vs Corina); RDKit MOL2 parser brittle
PDB 3D None None standard Universal protein format No bond orders; aromatic perception lost; ligand names truncated to 3 chars
PDBQT 3D None Gasteiger / AD4 AutoDock-ready; torsion tree encoded Specific to docking; no aromaticity layer
MMTF/BCIF 3D Encoded Encoded Compact PDB replacement; PDB archive default since 2023 Not all toolkits parse; binary format
CDX/CDXML 2D Drawing Drawing ChemDraw native Not a structural format; converts unreliably
InChIKey Hash Stereo layer — Database key, fast lookup Hash collisions ~10^-9 but possible; cannot recover structure

Aromaticity Perception (most common silent error)

Different toolkits perceive aromaticity differently. The same SMILES round-tripped between toolkits may produce different canonical strings and different fingerprints.

Model Toolkit Rule Symptom of mismatch
Daylight OpenEye, Daylight 4n+2 π on planar ring Furan, thiophene aromatic
RDKit default RDKit Daylight-like with extensions for fused / N-containing Compatible with Daylight for drug-like molecules
MDL Indigo, ChemAxon Reduced (only pyrrole-type) Pyrrole NH aromatic but tropone non-aromatic
OpenEye OEAroModel Several modes Charged thiophene non-aromatic in MDL but aromatic in OpenEye

Fix: Always re-canonicalize via the toolkit doing analysis. Never trust a SMILES produced by toolkit A as input to toolkit B without SetAromaticity(rdkit.Chem.AromaticityModel).

Stereochemistry Layers

Stereo loss is the second most common silent error. Each format encodes stereo differently:

  • SMILES: @/@@ for tetrahedral, / and \ for cis/trans double bonds
  • InChI: separate /t (tetrahedral), /s (stereo flag), /m (mirror) layers
  • SDF: wedge/hash bond + parity 0/1/2; cis/trans encoded via bond direction
  • MOL2: explicit stereo flag

Round-trip tests: If Chem.MolToSmiles(Chem.MolFromSmiles(smi)) does not preserve @ and /\, the molecule was sanitized without Chem.RemoveStereochemistry(). If MolFromMolFile returns a molecule missing wedge bonds, the SDF used parity-only encoding (legacy).

Reading SMILES with Stereo Preservation

Goal: Parse SMILES while preserving stereo and aromatic-flag consistency.

Approach: Use Chem.MolFromSmiles(smi) with sanitization on, verify with round-trip canonicalization, and set explicit stereochemistry where the toolkit's perception missed it.

from rdkit import Chem
from rdkit.Chem import AllChem

def parse_smiles_safe(smi):
    mol = Chem.MolFromSmiles(smi)
    if mol is None:
        return None, 'parse_failure'
    Chem.AssignStereochemistry(mol, cleanIt=True, force=True)
    canon = Chem.MolToSmiles(mol)
    round_trip = Chem.MolFromSmiles(canon)
    if Chem.MolToSmiles(round_trip) != canon:
Полный SKILL.md на GitHub

Установить bio-molecular-io в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/molecule_io.pyusage-guide.md

FAQ

Что делает скилл bio-molecular-io?

Reads, writes, and converts molecular file formats (SMILES, InChI, SDF V2000/V3000, MOL2, PDB, MMTF) using RDKit and Open Babel with rigorous handling of aromaticity perception, stereochemistry, implicit/explicit hydrogens, kekulization, and salt/fragment separation. Use when loading chemical libraries, debugging parse failures, or preparing molecules for downstream standardization, descriptor calculation, or docking.

Как установить скилл bio-molecular-io?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bio-molecular-io запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить bio-molecular-io с