You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue with CCD code string parsing when code starts with a digit (e.g., "29N" parsed as "2") #400
Thank you for developing and sharing ESMFold2 / ESM3!
When passing a valid CCD code that begins with a number (such as "29N") to LigandInput(ccd="29N"), ESMFold2 fails during input preprocessing. The internal parser incorrectly truncates or parses the CCD string down to its leading digit ("2"), resulting in ValueError: CCD component 2 not found.
Additionally, when setting up covalent bonds using CovalentBond with string atom names, a secondary TypeError: '<' not supported between instances of 'str' and 'int' is triggered during compute_token_bonds.
Minimal Reproducible Example
from esm.models.esmfold2 import (
ProteinInput,
LigandInput,
StructurePredictionInput,
ESMFold2InputBuilder,
)
from esm.sdk.api import CovalentBond # or esm.utils.structure.input_builder
1. Define Protein Chain
protein = ProteinInput(
id="B",
sequence="CPFDCRWSTPCHWC"
)
2. Define Ligand with a CCD code starting with a number
Error Traceback
Loading CCD dictionary from /data/ssd/esm-main/models/esmfold2/ccd.pkl
Traceback (most recent call last):
File "/home/gordon/run/ESMfold2/BT8009.py", line 181, in
main()
File "/home/gordon/run/ESMfold2/BT8009.py", line 129, in main
results = ESMFold2InputBuilder().fold(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/ssd/esm-main/esm_env/lib/python3.12/site-packages/esm/models/esmfold2/processor.py", line 412, in fold
features, chain_infos = self.prepare_input(
^^^^^^^^^^^^^^^^^^^
File "/data/ssd/esm-main/esm_env/lib/python3.12/site-packages/esm/models/esmfold2/processor.py", line 218, in prepare_input
features, chain_infos = prepare_esmfold2_input(
^^^^^^^^^^^^^^^^^^^^^^^
File "/data/ssd/esm-main/esm_env/lib/python3.12/site-packages/esm/models/esmfold2/prepare_input.py", line 1470, in prepare_esmfold2_input
chains, tokens, atoms = build_chains_from_input(input, seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/ssd/esm-main/esm_env/lib/python3.12/site-packages/esm/models/esmfold2/prepare_input.py", line 759, in build_chains_from_input
new_tokens, new_atoms = tokenize_ligand_ccd(
^^^^^^^^^^^^^^^^^^^^
File "/data/ssd/esm-main/esm_env/lib/python3.12/site-packages/esm/models/esmfold2/prepare_input.py", line 520, in tokenize_ligand_ccd
raise ValueError(f"CCD component {code} not found")
ValueError: CCD component 2 not found
changed the title [-][Bug] Issue with CCD code string parsing when code starts with a digit (e.g., "29N" parsed as "2")[/-][+]Issue with CCD code string parsing when code starts with a digit (e.g., "29N" parsed as "2")[/+]on Sep 10, 2026
Activity
[-][Bug] Issue with CCD code string parsing when code starts with a digit (e.g., "29N" parsed as "2")[/-][+]Issue with CCD code string parsing when code starts with a digit (e.g., "29N" parsed as "2")[/+]faustomilletari commentedon Sep 10, 2026
on it. Can you pass CCD as a list of strings and check if the problem is still there?
faustomilletari commentedon Sep 10, 2026
The issue happens because you are passing CCDs as bare strings and not lists of strings. You need to pass them as Lists of strings
sansgordon-lang commentedon Sep 15, 2026
Thank you so much for the clarification, @faustomilletari!
Passing the CCD as a list of strings (ccd=["29N"]) instead of a bare string fixed the parsing issue. Really appreciate the quick and clear help!