Skip to content

buggy write_pdb in network/predict_complex.py #153

@zsalvet

Description

@zsalvet

predict_complex.py crashes in write_pdb routine due to incorrect handling of -Ls
option (tries to output gaps to PDB and miscalculated positions of residues behind the first gap).
This patch fixes it:

--- RoseTTAFold/network/predict_complex.py.orig 2025-08-22 16:33:14.284501138 +0200
+++ RoseTTAFold_full/RoseTTAFold/network/predict_complex.py    2025-08-22 16:40:44.152420040 +0200
@@ -260,11 +263,13 @@
                     resNo = i+1
                     chain = "A"
                     for i_chain in range(len(Ls)-1,0,-1):
-                        tot_res = sum(Ls[:i_chain])
+                        tot_res = sum(Ls[:i_chain])  + i_chain -1
                         if i+1 > tot_res:
                             chain = chainIDs[i_chain]
-                            resNo = i+1 - tot_res
+                            resNo = i - tot_res
                             break
+                    if i+1 == tot_res+1 :
+                        continue
                     f.write ("%-6s%5s %4s %3s %s%4d    %8.3f%8.3f%8.3f%6.2f%6.2f\n"%(
                             "ATOM", ctr, " CA ", util.num2aa[s],
                              chain, resNo, atoms[i,0], atoms[i,1], atoms[i,2],
@@ -275,11 +280,13 @@
                     resNo = i+1
                     chain = "A"
                     for i_chain in range(len(Ls)-1,0,-1):
-                        tot_res = sum(Ls[:i_chain])
-                        if i+1 > tot_res:
+                        tot_res = sum(Ls[:i_chain]) + i_chain -1
+                        if i+1 > tot_res :
                             chain = chainIDs[i_chain]
-                            resNo = i+1 - tot_res
+                            resNo = i - tot_res
                             break
+                    if i+1 == tot_res+1 :
+                        continue
                     for j,atm_j in enumerate((" N  "," CA "," C  ")):
                         f.write ("%-6s%5s %4s %3s %s%4d    %8.3f%8.3f%8.3f%6.2f%6.2f\n"%(
                                 "ATOM", ctr, atm_j, util.num2aa[s],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions