| name | af3-json-sha256 |
| description | Extract deduplicated protein, DNA, and RNA sequences from AF3 or Protenix inference JSON files into per-entity-type FASTA files keyed by SHA-256 hash. Use as the first stage of the MSA pipeline before `af3-msa-search` and `af3-msa-injector`. |
AF3/Protenix JSON to FASTA (SHA-256 keyed)
Extract unique biological entity sequences from AF3 or Protenix inference JSON and write one FASTA file per entity type (protein, DNA, RNA), with each entry keyed by its SHA-256 hash.
Pipeline Context
This is stage 1 of the structure prediction MSA pipeline:
- af3-json-sha256 (this skill) — JSON to deduplicated FASTA
- af3-msa-search — ColabFold MSA search from FASTA
- af3-msa-injector — Inject MSA results back into inference JSON
Run commands from repository root and prefer .venv/bin/python.
Quick Start
- Extract from a single JSON file:
.venv/bin/python skills/af3-json-sha256/scripts/af3_json_to_fasta.py \
--input /abs/path/to/job_xxx.json \
--output /abs/path/to/fasta_out
- Extract from a directory of JSON files:
.venv/bin/python skills/af3-json-sha256/scripts/af3_json_to_fasta.py \
--input /abs/path/to/json_dir \
--output /abs/path/to/fasta_out \
--glob '*.json'
- Extract only protein sequences:
.venv/bin/python skills/af3-json-sha256/scripts/af3_json_to_fasta.py \
--input /abs/path/to/json_dir \
--output /abs/path/to/fasta_out \
--types protein
Output Format
One FASTA file per entity type is written to --output:
protein.fasta — all unique protein sequences
dna.fasta — all unique DNA sequences
rna.fasta — all unique RNA sequences
Empty entity types produce no file. FASTA entries are sorted by hash for deterministic output.
>a1b2c3d4e5f6... (64-char SHA-256 hex digest)
NORMALIZEDSEQUENCE
Sequences are wrapped at 60 characters per line.
CLI Flags
--input: Single JSON file or directory of JSON files (required).
--output: Output directory for FASTA files (required).
--format auto|af3|protenix: Force format or auto-detect (default: auto).
--glob: File pattern when --input is a directory (default: *.json).
--types: Comma-separated entity types to extract (default: protein,dna,rna).
Entity Type Mapping
| AF3 key | Protenix key | Entity type | Extracted? |
|---|
protein | proteinChain | protein | Yes |
dna | dnaSequence | dna | Yes |
rna | rnaSequence | rna | Yes |
ligand | ligand | — | No |
ion | ion | — | No |
Sequence Normalization
All sequences are normalized before hashing:
- Strip all whitespace
- Convert to uppercase
The same normalization is used by af3-msa-injector for SHA-256 matching, ensuring hash consistency across the pipeline.
Resources
scripts/af3_json_to_fasta.py: deterministic CLI for FASTA extraction from AF3/Protenix JSON.