From 69b494e53e0e08bd9eb2710d214ecd39bcbdfbd3 Mon Sep 17 00:00:00 2001 From: David Kastner Date: Mon, 18 Aug 2025 20:54:40 -0400 Subject: [PATCH] Improve user notification of resolved clashes --- qp/cli.py | 4 +++- qp/protonate/parse_output.py | 2 +- qp/structure/missing.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/qp/cli.py b/qp/cli.py index e09fcfc..771ff67 100644 --- a/qp/cli.py +++ b/qp/cli.py @@ -205,7 +205,9 @@ def run(config): AA = missing.define_residues() residues_with_clashes = parse_log(protoss_log_file, protoss_pdb, AA) if residues_with_clashes: - print(f"> WARNING: Protoss has deleted {len(residues_with_clashes)} residues due to clashes, trying to fix them with Modeller") + print(f"> WARNING: Protoss removed {len(residues_with_clashes)} residues due to clashes") + clash_details = ", ".join([f"{res_name}{res_id} in chain {chain}" for res_id, _, _, chain, res_name in sorted(list(residues_with_clashes))]) + print(f"> WARNING: Remodeling {clash_details} with Modeller.") else: break # Don't loop again as no clashes were detected diff --git a/qp/protonate/parse_output.py b/qp/protonate/parse_output.py index 25e99ed..6f1b406 100644 --- a/qp/protonate/parse_output.py +++ b/qp/protonate/parse_output.py @@ -35,7 +35,7 @@ def parse_log(log_path, pdb_path, AA): res_id = int(atom_line[22:26].strip()) one_letter_code = AA.get(res_name, 'X') # Use 'X' for unknown residues chain_index = chain_order.get(chain, -1) - residues_with_clashes.add((res_id, one_letter_code, chain_index, chain)) + residues_with_clashes.add((res_id, one_letter_code, chain_index, chain, res_name)) return residues_with_clashes diff --git a/qp/structure/missing.py b/qp/structure/missing.py index 5dd7193..7cc4bc6 100644 --- a/qp/structure/missing.py +++ b/qp/structure/missing.py @@ -454,7 +454,7 @@ def delete_clashes(pdb_path, residues_with_clashes): lines = file.readlines() # Create a set for quick lookup of residues to delete - residues_to_delete = {(chain, res_id) for res_id, _, _, chain in residues_with_clashes} + residues_to_delete = {(chain, res_id) for res_id, _, _, chain, _ in residues_with_clashes} # Write the new PDB file, excluding the residues to delete with open(pdb_path, "w") as file: