Skip to content

Commit c05e662

Browse files
authored
Update cluster_pdb_test_mmcifs.py (#141)
1 parent 04fe0e0 commit c05e662

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

scripts/cluster_pdb_test_mmcifs.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,15 @@ def filter_structure_chain_sequences(
166166
# multimeric structure are kept only if the polymer chain is novel, and any
167167
# ligand chains within the (polymer-)filtered structure are kept only if
168168
# the ligand chain is novel as well.
169-
if molecule_type == "ligand" and not is_novel_ligand(
170-
sequence, reference_ligand_fps, max_sim=max_ligand_similarity
171-
):
169+
try:
170+
if molecule_type == "ligand" and not is_novel_ligand(
171+
sequence, reference_ligand_fps, max_sim=max_ligand_similarity
172+
):
173+
continue
174+
except Exception as e:
175+
logger.warning(
176+
f"Failed to check if ligand is novel due to: {e}. Assuming it is not novel..."
177+
)
172178
continue
173179
filtered_structure_chain_sequences[chain_id] = sequence
174180

@@ -177,9 +183,15 @@ def filter_structure_chain_sequences(
177183
):
178184
# NOTE: For the evaluation dataset's monomers, sequence non-redundant polymers or
179185
# any novel ligand chains within the (polymer-)filtered structure are kept.
180-
if molecule_type == "ligand" and not is_novel_ligand(
181-
sequence, reference_ligand_fps, max_sim=max_ligand_similarity
182-
):
186+
try:
187+
if molecule_type == "ligand" and not is_novel_ligand(
188+
sequence, reference_ligand_fps, max_sim=max_ligand_similarity
189+
):
190+
continue
191+
except Exception as e:
192+
logger.warning(
193+
f"Failed to check if ligand is novel due to: {e}. Assuming it is not novel..."
194+
)
183195
continue
184196
filtered_structure_chain_sequences[chain_id] = sequence
185197

0 commit comments

Comments
 (0)