Skip to content

Commit d32205a

Browse files
committed
Extend available new chains to include lowercase letters
Also print a warning if the user exceeds 52 chains (using up all upper- and lower-case chain ids).
1 parent 63e270f commit d32205a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rfdiffusion/inference/model_runners.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ def sample_init(self, return_forward_trajectory=False):
317317
self.chain_idx = []
318318
self.idx_pdb = []
319319
all_chains = {contig_ref[0] for contig_ref in self.contig_map.ref}
320-
available_chains = sorted(list(set(string.ascii_uppercase) - all_chains))
320+
available_chains = sorted(list(set(string.ascii_letters) - all_chains))
321+
321322
# Iterate over each chain
322323
for last_res in length_bound:
323324
chain_ids = {contig_ref[0] for contig_ref in self.contig_map.ref[first_res: last_res]}
@@ -328,6 +329,10 @@ def sample_init(self, return_forward_trajectory=False):
328329
chain_ids = chain_ids - {"_"}
329330
# If there are no fixed residues that have a chain id, pick the first available letter
330331
if not chain_ids:
332+
if not available_chains:
333+
raise ValueError(f"No available chains! You are trying to design a new chain, and you have "
334+
f"already used all upper- and lower-case chain ids (up to 52 chains): "
335+
f"{','.join(all_chains)}.")
331336
chain_id = available_chains[0]
332337
available_chains.remove(chain_id)
333338
# Otherwise, use the chain of the fixed (motif) residues

0 commit comments

Comments
 (0)