structural-biology.com

Smiles2YAML: From a JSON of candidate SMILES to a folder of Boltz-2 input YAML

generate_yaml.py

From a JSON of candidate SMILES to a folder of Boltz-2 input YAMLs, in one prompt.

python dependencies output input author


A command-line utility for generating Boltz-2 / co-folding input YAML files from a batch of candidate SMILES stored in a JSON file. Designed to work with the output format produced by generative chemistry runs (e.g. fragment-based screening, de novo design) and feed directly into a Boltz-style ModelCIF prediction pipeline.

Why it matters: generative chemistry runs spit out hundreds of candidate SMILES, but Boltz-2 wants one carefully structured YAML per compound, each pairing the ligand with a protein chain, a pocket constraint, and an affinity block. Hand-writing those is tedious and error-prone. generate_yaml.py reads the candidates straight from your JSON, prompts once for the protein context, and writes a clean, submission-ready YAML for every selected compound. It is useful for anyone bridging de novo design or fragment screening into a co-folding affinity pipeline: turn a screening output into a ready-to-run prediction batch in seconds, with stdlib-only portability and no dependencies to install.


Overview

Given a JSON file containing a dictionary of candidate SMILES under a "candidates" key, generate_yaml.py interactively prompts for protein context and contact constraints, then writes one YAML file per selected candidate — ready to submit to Boltz-2 (or a compatible co-folding engine) for structure prediction with binding affinity estimation.

Each output YAML encodes:
– A single protein chain with user-supplied ID and sequence
– A ligand defined by cleaned SMILES
– A pocket constraint anchoring the ligand to a specified contact residue
– An affinity property block targeting the ligand


Requirements

  • Python 3.8+
  • Standard library only (argparse, json, re, pathlib) — no additional dependencies

Installation

git clone https://github.com/<your-org>/generate_yaml.git
cd generate_yaml
# No install step required — pure stdlib

Usage

python generate_yaml.py <json_file>

Example

python generate_yaml.py scratch_Baricitinib_sim.out.20260530_0219.json

The script will interactively prompt for:

PromptDescriptionExample
Protein IDChain identifier used in the YAMLA
Protein sequenceFull single-letter amino acid sequenceMGHHHHHHSSGVD...
Contact residue numberResidue number defining the binding pocket1007
Output directoryPath where YAML files will be written~/boltz_runs/baricitinib/
Candidate selectionWhich candidates to export (see below)1-25 or all

Candidate Selection Syntax

FormatDescriptionExample
allExport every candidateall
NA single candidate by 1-based index7
N-MAn inclusive range1-25
N, M, ...Arbitrary comma-separated list1, 7, 17, 28, 31

Candidate numbering is 1-based and follows the original key order in the JSON "candidates" dictionary.


Output

Files are written to the specified output directory, named sequentially by candidate index:


👤 Author

Marc C. Deller, D.Phil.
Structural biologist & drug discovery scientist