bio-molecular-io
Reads, writes, and converts molecular file formats (SMILES, SDF, MOL2, PDB) using RDKit and Open Babel. Handles structure parsing, canonicalization, and full standardization pipeline including sanitization, normalization, and tautomer canonicalization. Use when loading chemical libraries, converting formats, or preparing molecules for analysis.
Best use case
bio-molecular-io is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Reads, writes, and converts molecular file formats (SMILES, SDF, MOL2, PDB) using RDKit and Open Babel. Handles structure parsing, canonicalization, and full standardization pipeline including sanitization, normalization, and tautomer canonicalization. Use when loading chemical libraries, converting formats, or preparing molecules for analysis.
Teams using bio-molecular-io should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/bio-molecular-io/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How bio-molecular-io Compares
| Feature / Agent | bio-molecular-io | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Reads, writes, and converts molecular file formats (SMILES, SDF, MOL2, PDB) using RDKit and Open Babel. Handles structure parsing, canonicalization, and full standardization pipeline including sanitization, normalization, and tautomer canonicalization. Use when loading chemical libraries, converting formats, or preparing molecules for analysis.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## Version Compatibility
Reference examples tested with: RDKit 2024.03+
Before using code patterns, verify installed versions match. If versions differ:
- Python: `pip show <package>` then `help(module.function)` to check signatures
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
**"Load my chemical library into Python"** → Parse molecular file formats (SMILES, SDF, MOL2, PDB) into RDKit molecule objects for programmatic access, standardization, and format conversion.
- Python: `Chem.MolFromSmiles()`, `Chem.SDMolSupplier()` (RDKit)
Read, write, and convert molecular file formats with structure standardization.
## Supported Formats
| Format | Extension | Use Case |
|--------|-----------|----------|
| SMILES | .smi | Text representation, databases |
| SDF/MOL | .sdf, .mol | 3D structures, compound libraries |
| MOL2 | .mol2 | Docking, force field atoms |
| PDB | .pdb | Protein-ligand complexes |
## Reading Molecules
**Goal:** Load molecules from SMILES strings, SDF files, or SMILES files into RDKit molecule objects.
**Approach:** Use Chem.MolFromSmiles for individual SMILES, SDMolSupplier for multi-molecule SDF files, and file iteration for SMILES files, filtering out parse failures.
```python
from rdkit import Chem
from rdkit.Chem import AllChem
# From SMILES
mol = Chem.MolFromSmiles('CCO')
# From SDF file (single molecule)
mol = Chem.MolFromMolFile('molecule.mol')
# From SDF file (multiple molecules)
supplier = Chem.SDMolSupplier('library.sdf')
molecules = [mol for mol in supplier if mol is not None]
print(f'Loaded {len(molecules)} molecules')
# From SMILES file
with open('compounds.smi') as f:
molecules = []
for line in f:
parts = line.strip().split()
if parts:
mol = Chem.MolFromSmiles(parts[0])
if mol:
mol.SetProp('_Name', parts[1] if len(parts) > 1 else '')
molecules.append(mol)
```
## Writing Molecules
```python
from rdkit import Chem
# To SMILES
smiles = Chem.MolToSmiles(mol) # Canonical SMILES
smiles_iso = Chem.MolToSmiles(mol, isomericSmiles=True) # With stereochemistry
# To SDF file
writer = Chem.SDWriter('output.sdf')
for mol in molecules:
writer.write(mol)
writer.close()
# To MOL block (string)
mol_block = Chem.MolToMolBlock(mol)
```
## Structure Standardization
**Goal:** Normalize molecular representations to a canonical form for consistent comparison and analysis.
**Approach:** Apply a multi-step pipeline: sanitize valences, normalize functional groups, neutralize charges, canonicalize tautomers, and strip salts using rdMolStandardize.
Use rdMolStandardize module (Python MolStandardize was removed Q1 2024).
```python
from rdkit import Chem
from rdkit.Chem.MolStandardize import rdMolStandardize
def standardize_molecule(mol):
'''
Full standardization pipeline.
Order: Sanitize -> Normalize -> Neutralize -> Canonicalize tautomer -> Strip salts
'''
if mol is None:
return None
# Sanitize (assign valences, kekulize)
try:
Chem.SanitizeMol(mol)
except Exception:
return None
# Normalize (standardize functional groups)
normalizer = rdMolStandardize.Normalizer()
mol = normalizer.normalize(mol)
# Neutralize charges where possible
uncharger = rdMolStandardize.Uncharger()
mol = uncharger.uncharge(mol)
# Canonicalize tautomers
enumerator = rdMolStandardize.TautomerEnumerator()
mol = enumerator.Canonicalize(mol)
# Remove salts/fragments (keep largest)
remover = rdMolStandardize.FragmentRemover()
mol = remover.remove(mol)
return mol
# Standardize a library
standardized = [standardize_molecule(m) for m in molecules]
standardized = [m for m in standardized if m is not None]
```
## Open Babel Conversion
For format conversions not supported by RDKit.
```python
# Open Babel 3.x import (not 'import pybel')
from openbabel import pybel
# Read MOL2 (better supported in Open Babel)
mols = list(pybel.readfile('mol2', 'ligands.mol2'))
# Convert to SDF
output = pybel.Outputfile('sdf', 'output.sdf', overwrite=True)
for mol in mols:
output.write(mol)
output.close()
# Format conversion
for mol in pybel.readfile('pdb', 'complex.pdb'):
mol.write('mol2', 'ligand.mol2', overwrite=True)
```
## Molecular Drawing
Use rdMolDraw2D (legacy Draw.MolToImage deprecated).
```python
from rdkit import Chem
from rdkit.Chem.Draw import rdMolDraw2D
def draw_molecule(mol, filename, size=(400, 300)):
'''Draw molecule to PNG file.'''
drawer = rdMolDraw2D.MolDraw2DCairo(size[0], size[1])
drawer.DrawMolecule(mol)
drawer.FinishDrawing()
with open(filename, 'wb') as f:
f.write(drawer.GetDrawingText())
# Draw with highlighting
def draw_with_substructure(mol, pattern, filename):
'''Highlight substructure match.'''
match = mol.GetSubstructMatch(Chem.MolFromSmarts(pattern))
drawer = rdMolDraw2D.MolDraw2DCairo(400, 300)
drawer.DrawMolecule(mol, highlightAtoms=match)
drawer.FinishDrawing()
with open(filename, 'wb') as f:
f.write(drawer.GetDrawingText())
```
## Related Skills
- molecular-descriptors - Calculate properties after loading
- similarity-searching - Compare loaded molecules
- virtual-screening - Prepare ligands for dockingRelated Skills
molecular-dynamics
Run and analyze molecular dynamics simulations with OpenMM and MDAnalysis. Set up protein/small molecule systems, define force fields, run energy minimization and production MD, analyze trajectories (RMSD, RMSF, contact maps, free energy surfaces). For structural biology, drug binding, and biophysics.
bio-molecular-descriptors
Calculates molecular descriptors and fingerprints using RDKit. Computes Morgan fingerprints (ECFP), MACCS keys, Lipinski properties, QED drug-likeness, TPSA, and 3D conformer descriptors. Use when featurizing molecules for machine learning or filtering by drug-likeness criteria.
zinc-database
Access ZINC (230M+ purchasable compounds). Search by ZINC ID/SMILES, similarity searches, 3D-ready structures for docking, analog discovery, for virtual screening and drug discovery.
zarr-python
Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.
xlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
wikipedia-search
Search and fetch structured content from Wikipedia using the MediaWiki API for reliable, encyclopedic information
wellally-tech
Integrate digital health data sources (Apple Health, Fitbit, Oura Ring) and connect to WellAlly.tech knowledge base. Import external health device data, standardize to local format, and recommend relevant WellAlly.tech knowledge base articles based on health data. Support generic CSV/JSON import, provide intelligent article recommendations, and help users better manage personal health data.
weightloss-analyzer
分析减肥数据、计算代谢率、追踪能量缺口、管理减肥阶段
<!--
# COPYRIGHT NOTICE
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always