Molecular Format Conversion
SkillDev toolsConvert between molecular formats including SMILES, InChI, InChIKey, and SELFIES for cheminformatics applications.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Molecular Format Conversion skill
What this skill tells your AI
The instructions your AI receives, as published by spectrai-initiative/innoclaw in .claude/skills/molecular-format-conversion/SKILL.md and read by ahel’s review.
Usage
1. MCP Server Definition
Use the same ChemicalToolsClient class as defined in the molecular-properties-calculation skill.
2. Molecular Format Conversion Workflow
This workflow converts molecules between different chemical formats (SMILES, InChI, SELFIES) for database searching, machine learning, and cheminformatics applications.
Workflow Steps:
- SMILES to InChI - Convert SMILES to International Chemical Identifier
- InChI to SMILES - Convert InChI back to SMILES
- SMILES to SELFIES - Convert to string-based molecular representation
Implementation:
## Initialize client
HEADERS = {"SCP-HUB-API-KEY": "<your-api-key>"}
client = ChemicalToolsClient(
"https://scp.intern-ai.org.cn/api/v1/mcp/31/SciToolAgent-Chem",
HEADERS
)
if not await client.connect():
print("connection failed")
exit()
print("=== Molecular Format Conversion ===\n")
## Test molecules
smiles = "CCO" # Ethanol
inchi = "InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3"
## Step 1: SMILES to InChI
print("Step 1: SMILES to InChI")
result = await client.client.call_tool(
"SMILESToInChI",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"SMILES: {smiles}")
print(f"{result_data}\n")
## Step 2: InChI to SMILES
print("Step 2: InChI to SMILES")
result = await client.client.call_tool(
"InChIToSMILES",
arguments={"inchi": inchi}
)
result_data = client.parse_result(result)
print(f"InChI: {inchi}")
print(f"{result_data}\n")
## Step 3: SMILES to SELFIES
print("Step 3: SMILES to SELFIES")
result = await client.client.call_tool(
"SMILEStoSELFIES",
arguments={"smiles": smiles}
)
result_data = client.parse_result(result)
print(f"SMILES: {smiles}")
print(f"{result_data}\n")
## Step 4: SELFIES to SMILES
print("Step 4: SELFIES to SMILES")
selfies = "[C][C][O]"
result = await client.client.call_tool(
"SELFIEStoSMILES",
arguments={"selfies": selfies}
)
result_data = client.parse_result(result)
print(f"SELFIES: {selfies}")
print(f"{result_data}\n")
await client.disconnect()
Tool Descriptions
SciToolAgent-Chem Server:
-
SMILESToInChI: Convert SMILES to InChI- Args:
smiles(str) - Returns: InChI string
- Args:
-
InChIToSMILES: Convert InChI to SMILES- Args:
inchi(str) - Returns: SMILES string
- Args:
-
SMILEStoSELFIES: Convert SMILES to SELFIES- Args:
smiles(str) - Returns: SELFIES string
- Args:
-
SELFIEStoSMILES: Convert SELFIES to SMILES- Args:
selfies(str) - Returns: SMILES string
- Args:
-
InChIToInChIKey: Convert InChI to InChIKey- Args:
inchi(str) - Returns: InChIKey (27-character hash)
- Args:
-
InChIKeyToInChI: Convert InChIKey to InChI- Args:
inchikey(str) - Returns: InChI string
- Args:
Input/Output
Input:
- SMILES: Simplified Molecular Input Line Entry System (e.g., "CCO")
- InChI: IUPAC International Chemical Identifier (e.g., "InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3")
- InChIKey: Hashed InChI (27 characters, e.g., "LFQSCWFLJHTTHZ-UHFFFAOYSA-N")
- SELFIES: Self-Referencing Embedded Strings (e.g., "[C][C][O]")
Output:
- Converted molecular representation in target format
Format Comparison
| Format | Canonical | Human-Readable | Database-Friendly | ML-Friendly |
|---|---|---|---|---|
| SMILES | Partial | High | Medium | Medium |
| InChI | Yes | Low | High | Low |
| InChIKey | Yes | No | Very High | No |
| SELFIES | Yes | Low | Low | Very High |
Use Cases
- SMILES: Standard format for most cheminformatics tools
- InChI: Canonical representation for database searching
- InChIKey: Fast database lookups and duplicate detection
- SELFIES: Machine learning models (guarantees valid molecules)
Format Details
SMILES (Simplified Molecular Input Line Entry System)
- Pros: Human-readable, widely supported
- Cons: Not canonical (multiple SMILES for same molecule)
- Example: "CCO", "c1ccccc1", "CC(=O)O"
InChI (International Chemical Identifier)
- Pros: Canonical, includes stereochemistry and isotopes
- Cons: Long, not human-readable
- Example: "InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3"
InChIKey
- Pros: Fixed-length hash, fast comparison
- Cons: Cannot reconstruct molecule from key
- Example: "LFQSCWFLJHTTHZ-UHFFFAOYSA-N"
- Structure: 14 characters (connectivity) + separator + 8 characters (stereo) + separator + version
SELFIES (Self-Referencing Embedded Strings)
- Pros: Always generates valid molecules, ideal for ML
- Cons: Less human-readable, newer format
- Example: "[C][C][O]"
- Used in: Generative models, molecular optimization
Additional Conversion Tools
ConvertSmilesToInchi: Alternative SMILES to InChI converterGenerateMolKeyFromSmiles: Generate molecular keyInChIKeyToMOL: Convert InChIKey to MOL fileIsValidInChIKey: Validate InChIKey format
Error Handling
Some conversions may fail for:
- Invalid input formats
- Unsupported chemical features
- Very large or complex molecules
Always check for errors in the returned data.
Signals
- GitHub stars
- 391
- Forks
- 28
- Last commit
- Aug 2026
ahel recommends instead
Advanced
- Catalog kind
- skill
- Gateway key
molecular-format-conversion-spectrai-initiative- Source
- github.com/spectrai-initiative/innoclaw