Skip to content

Commit 8f221e4

Browse files
committed
fix models() crash when no structures found
1 parent 75bfc96 commit 8f221e4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

evcouplings/compare/protocol.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,16 @@ def _map_alphafold_hits(modeldb_list_file, relevant_ids):
621621
"uniprot_end": end,
622622
})
623623

624-
return pd.DataFrame(_table)
625-
624+
if len(_table) > 0:
625+
return pd.DataFrame(_table)
626+
else:
627+
# reindex so empty dataframe has all columns; use fill_value = "" to force column types to object
628+
return pd.DataFrame().reindex([
629+
"uniprot_ac", "pdb_id", "pdb_chain",
630+
"resseq_start", "resseq_end",
631+
"coord_start", "coord_end",
632+
"uniprot_start", "uniprot_end"
633+
], axis=1, fill_value="")
626634

627635
def _identify_predicted_structures(**kwargs):
628636
"""

0 commit comments

Comments
 (0)