From 275e036c3815a3e460333409d55db1238e12f48c Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:35:36 +0100 Subject: [PATCH 01/39] Fix to 1. Get canon sites to list only assembly ress and 2. Seperate xtalform sites spatially --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 9058b319..317e7d5d 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -915,7 +915,7 @@ def _crystalform_incremental_cluster( # Get CA positions centroid_ca_positions = { - observation_id: neighbourhoods[observation_id].atoms[(centroid_res[0], centroid_res[1], 'CA')] + observation_id.join('/'): neighbourhoods[observation_id].atoms[(centroid_res[0], centroid_res[1], 'CA')] for observation_id, centroid_res in observation_centroid_residues.items() } From 6b3272ef1a4ad14540f39312d4b4e79435350cce Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:39:44 +0100 Subject: [PATCH 02/39] Fix to 1. Get canon sites to list only assembly ress and 2. Seperate xtalform sites spatially --- src/ligand_neighbourhood_alignment/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 317e7d5d..df05a73a 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1343,13 +1343,14 @@ def _update( # Assign datasets for dtag, dataset in new_datasets.items(): - dataset_assignments[dtag] = _assign_dataset( + new_dataset_assignments[dtag] = _assign_dataset( dataset, assemblies, xtalforms, structures[dtag], structures, ) + dataset_assignments.update(dataset_assignments) _save_assignments(fs_model, dataset_assignments) logger.info(f"Assigned {len(dataset_assignments)} xtalform assignments to datasets!") From a8deff13cf04274b5c8fa11234388ead33e5a7fd Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:39:53 +0100 Subject: [PATCH 03/39] Fix to 1. Get canon sites to list only assembly ress and 2. Seperate xtalform sites spatially --- src/ligand_neighbourhood_alignment/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index df05a73a..f5fa3d9d 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1342,6 +1342,7 @@ def _update( alignment_heirarchy.save_yaml(fs_model.assembly_transforms, assembly_transforms, lambda x: x) # Assign datasets + new_dataset_assignments = {} for dtag, dataset in new_datasets.items(): new_dataset_assignments[dtag] = _assign_dataset( dataset, From 1269ca0131eb48d877a7215c510c77fbece45f27 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:40:37 +0100 Subject: [PATCH 04/39] Fix to 1. Get canon sites to list only assembly ress and 2. Seperate xtalform sites spatially --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index f5fa3d9d..59a0bf9c 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1351,7 +1351,7 @@ def _update( structures[dtag], structures, ) - dataset_assignments.update(dataset_assignments) + dataset_assignments.update(new_dataset_assignments) _save_assignments(fs_model, dataset_assignments) logger.info(f"Assigned {len(dataset_assignments)} xtalform assignments to datasets!") From 653f183008053f7b7aaebc720414c67a52c4398b Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:45:44 +0100 Subject: [PATCH 05/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 59a0bf9c..9bd9a0ef 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1351,7 +1351,10 @@ def _update( structures[dtag], structures, ) - dataset_assignments.update(new_dataset_assignments) + print(len(dataset_assignments)) + dataset_assignments.update(new_dataset_assignments) + print(len(dataset_assignments)) + _save_assignments(fs_model, dataset_assignments) logger.info(f"Assigned {len(dataset_assignments)} xtalform assignments to datasets!") From 5ec9e2ee0f57e9acf2538c303a9c476247aab87a Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:45:54 +0100 Subject: [PATCH 06/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 9bd9a0ef..d1a730e6 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1354,7 +1354,7 @@ def _update( print(len(dataset_assignments)) dataset_assignments.update(new_dataset_assignments) print(len(dataset_assignments)) - + raise Exception _save_assignments(fs_model, dataset_assignments) logger.info(f"Assigned {len(dataset_assignments)} xtalform assignments to datasets!") From 262369174d856d5eb3b6830e9fe106ce063ca626 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:49:29 +0100 Subject: [PATCH 07/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index d1a730e6..5d3ee2f7 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1883,6 +1883,10 @@ def _load_dataset_assignments(dataset_assignments_yaml): for dtag, assignment in dic.items(): dataset_assignments[dtag] = assignment + + print('assignment') + print(dataset_assignments) + raise Exception return dataset_assignments From d21cdbd7f4e2e33866d3dd41e2db5c92af27c577 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:55:53 +0100 Subject: [PATCH 08/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 5d3ee2f7..b8625042 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1884,9 +1884,6 @@ def _load_dataset_assignments(dataset_assignments_yaml): for dtag, assignment in dic.items(): dataset_assignments[dtag] = assignment - print('assignment') - print(dataset_assignments) - raise Exception return dataset_assignments From 33d7f026ca5cb75f5818a0f8b4a08aaf0cfdc7c7 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:57:55 +0100 Subject: [PATCH 09/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index b8625042..e410e16e 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1351,10 +1351,7 @@ def _update( structures[dtag], structures, ) - print(len(dataset_assignments)) - dataset_assignments.update(new_dataset_assignments) - print(len(dataset_assignments)) - raise Exception + _save_assignments(fs_model, dataset_assignments) logger.info(f"Assigned {len(dataset_assignments)} xtalform assignments to datasets!") From 60398af00d452aa1271018f3202f0c7506de8be4 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:00:26 +0100 Subject: [PATCH 10/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index e410e16e..fc572cab 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1351,6 +1351,7 @@ def _update( structures[dtag], structures, ) + dataset_assignments.update(new_dataset_assignments) _save_assignments(fs_model, dataset_assignments) logger.info(f"Assigned {len(dataset_assignments)} xtalform assignments to datasets!") From a938fc5fbc1e315d1315009506752e95751e8c9d Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:07:00 +0100 Subject: [PATCH 11/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index fc572cab..d6498578 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -915,7 +915,7 @@ def _crystalform_incremental_cluster( # Get CA positions centroid_ca_positions = { - observation_id.join('/'): neighbourhoods[observation_id].atoms[(centroid_res[0], centroid_res[1], 'CA')] + '/'.join(observation_id): neighbourhoods[observation_id].atoms[(centroid_res[0], centroid_res[1], 'CA')] for observation_id, centroid_res in observation_centroid_residues.items() } From 6945539954d96468f5e80e071a4f82edd237dc60 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:16:45 +0100 Subject: [PATCH 12/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index d6498578..f2786f67 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -915,7 +915,7 @@ def _crystalform_incremental_cluster( # Get CA positions centroid_ca_positions = { - '/'.join(observation_id): neighbourhoods[observation_id].atoms[(centroid_res[0], centroid_res[1], 'CA')] + observation_id: neighbourhoods[observation_id].atoms[(centroid_res[0], centroid_res[1], 'CA')] for observation_id, centroid_res in observation_centroid_residues.items() } From 62756664a7b0e346b3bd566b861b75043b01ee8d Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:21:14 +0100 Subject: [PATCH 13/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index f2786f67..3df3182c 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -922,7 +922,7 @@ def _crystalform_incremental_cluster( # Identify current xtalform centre residues (for the considered canonical site) centre_residues_positions = { - xtalform_site_id: centroid_ca_positions[xtalform_site_id] + xtalform_site_id: centroid_ca_positions[xtalform_site_id.split('/')] for xtalform_site_id in xtalform_sites } From 8dc9ff3f59469e1704747ef34af1349f4e223bb2 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:31:26 +0100 Subject: [PATCH 14/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 3df3182c..b23ed997 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -922,7 +922,7 @@ def _crystalform_incremental_cluster( # Identify current xtalform centre residues (for the considered canonical site) centre_residues_positions = { - xtalform_site_id: centroid_ca_positions[xtalform_site_id.split('/')] + xtalform_site_id: centroid_ca_positions[tuple(xtalform_site_id.split('/'))] for xtalform_site_id in xtalform_sites } From 633ba4139cc3d14b631a8c3b2c1918f9b7e32de7 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:37:47 +0100 Subject: [PATCH 15/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index b23ed997..6bfc4857 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1556,6 +1556,15 @@ def _update( # for canonical_site_id, canonical_site in canonical_sites.items(): # for conformer_site_id, conformer_site in canonical_site.conformer_sites.items(): # for lid in conformer_site.ligand_ids: + for dtag, dataset_alignment_info in fs_model.alignments.items(): + for chain, chain_alignment_info in dataset_alignment_info.items(): + for residue, residue_alignment_info in chain_alignment_info.items(): + for version, ligand_neighbourhood_output in residue_alignment_info.items(): + for ( + canonical_site_id, + aligned_structure_path, + ) in ligand_neighbourhood_output.aligned_structures.items(): + print(aligned_structure_path) for dtag, dataset_alignment_info in fs_model.alignments.items(): for chain, chain_alignment_info in dataset_alignment_info.items(): for residue, residue_alignment_info in chain_alignment_info.items(): From 050473777eee847b4bc726607651ba6f10d25019 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:38:04 +0100 Subject: [PATCH 16/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 6bfc4857..9886858d 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1565,6 +1565,7 @@ def _update( aligned_structure_path, ) in ligand_neighbourhood_output.aligned_structures.items(): print(aligned_structure_path) + exit() for dtag, dataset_alignment_info in fs_model.alignments.items(): for chain, chain_alignment_info in dataset_alignment_info.items(): for residue, residue_alignment_info in chain_alignment_info.items(): From 6917b9f439013fca73574e888164df4be4e06b3d Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:41:37 +0100 Subject: [PATCH 17/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 9886858d..3fad1f66 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1556,17 +1556,10 @@ def _update( # for canonical_site_id, canonical_site in canonical_sites.items(): # for conformer_site_id, conformer_site in canonical_site.conformer_sites.items(): # for lid in conformer_site.ligand_ids: + for dtag, dataset_alignment_info in fs_model.alignments.items(): - for chain, chain_alignment_info in dataset_alignment_info.items(): - for residue, residue_alignment_info in chain_alignment_info.items(): - for version, ligand_neighbourhood_output in residue_alignment_info.items(): - for ( - canonical_site_id, - aligned_structure_path, - ) in ligand_neighbourhood_output.aligned_structures.items(): - print(aligned_structure_path) - exit() - for dtag, dataset_alignment_info in fs_model.alignments.items(): + if dtag not in new_datasets: + continue for chain, chain_alignment_info in dataset_alignment_info.items(): for residue, residue_alignment_info in chain_alignment_info.items(): for version, ligand_neighbourhood_output in residue_alignment_info.items(): From 76c1b7a93be0ca95ff631f445c01de02ed1bcdf8 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:49:58 +0100 Subject: [PATCH 18/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 3fad1f66..3ae1eb61 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1310,6 +1310,7 @@ def _update( assembly_landmarks, assembly_transforms, version, + base_dir ): logger.info(f"Version is: {version}") # Get the structures @@ -1558,8 +1559,6 @@ def _update( # for lid in conformer_site.ligand_ids: for dtag, dataset_alignment_info in fs_model.alignments.items(): - if dtag not in new_datasets: - continue for chain, chain_alignment_info in dataset_alignment_info.items(): for residue, residue_alignment_info in chain_alignment_info.items(): for version, ligand_neighbourhood_output in residue_alignment_info.items(): @@ -1567,7 +1566,7 @@ def _update( canonical_site_id, aligned_structure_path, ) in ligand_neighbourhood_output.aligned_structures.items(): - if not Path(aligned_structure_path).exists(): + if not ( (fs_model.source_dir / aligned_structure_path).exists() or Path(aligned_structure_path).exists()): # _update_aligned_structures() _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] @@ -1628,7 +1627,7 @@ def _update( for canonical_site_id, alignment_info in dataset_alignment_info.items(): aligned_structure_path = alignment_info["aligned_structures"] logger.info(f"Outputting reference structure: {aligned_structure_path}") - if not Path(aligned_structure_path).exists(): + if not ( (fs_model.source_dir / aligned_structure_path).exists() or Path(aligned_structure_path).exists()): _structure = structures[dtag].clone() _align_reference_structure( _structure, @@ -1658,7 +1657,7 @@ def _update( aligned_event_map_path, ) in ligand_neighbourhood_output.aligned_event_maps.items(): logger.info(f"Writing to: {aligned_event_map_path}") - if not Path(aligned_event_map_path).exists(): + if not ( (fs_model.source_dir / aligned_event_map_path).exists() or Path(aligned_event_map_path).exists()): _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] # Check for the matching conformer site From 2836b14375c93a7736d8d895911829dd85e48451 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:50:39 +0100 Subject: [PATCH 19/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 3ae1eb61..fbd8e28f 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1310,7 +1310,6 @@ def _update( assembly_landmarks, assembly_transforms, version, - base_dir ): logger.info(f"Version is: {version}") # Get the structures From 60d57a6cf96211a2989430b868552a99ecfe2e06 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:59:44 +0100 Subject: [PATCH 20/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index fbd8e28f..c48b039e 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1565,7 +1565,20 @@ def _update( canonical_site_id, aligned_structure_path, ) in ligand_neighbourhood_output.aligned_structures.items(): - if not ( (fs_model.source_dir / aligned_structure_path).exists() or Path(aligned_structure_path).exists()): + rprint(fs_model.source_dir / aligned_structure_path) + rprint(Path(aligned_structure_path)) + + rprint(fs_model.source_dir) + exit() + for dtag, dataset_alignment_info in fs_model.alignments.items(): + for chain, chain_alignment_info in dataset_alignment_info.items(): + for residue, residue_alignment_info in chain_alignment_info.items(): + for version, ligand_neighbourhood_output in residue_alignment_info.items(): + for ( + canonical_site_id, + aligned_structure_path, + ) in ligand_neighbourhood_output.aligned_structures.items(): + if not ( (fs_model.source_dir / aligned_structure_path).exists() | Path(aligned_structure_path).exists()): # _update_aligned_structures() _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] @@ -1626,7 +1639,7 @@ def _update( for canonical_site_id, alignment_info in dataset_alignment_info.items(): aligned_structure_path = alignment_info["aligned_structures"] logger.info(f"Outputting reference structure: {aligned_structure_path}") - if not ( (fs_model.source_dir / aligned_structure_path).exists() or Path(aligned_structure_path).exists()): + if not ( (fs_model.source_dir / aligned_structure_path).exists() | Path(aligned_structure_path).exists()): _structure = structures[dtag].clone() _align_reference_structure( _structure, @@ -1656,7 +1669,7 @@ def _update( aligned_event_map_path, ) in ligand_neighbourhood_output.aligned_event_maps.items(): logger.info(f"Writing to: {aligned_event_map_path}") - if not ( (fs_model.source_dir / aligned_event_map_path).exists() or Path(aligned_event_map_path).exists()): + if not ( (fs_model.source_dir / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] # Check for the matching conformer site From 18fa4466ce17f0e256752f9476b03707b157adf4 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:06:39 +0100 Subject: [PATCH 21/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index c48b039e..f1cbc128 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1557,19 +1557,7 @@ def _update( # for conformer_site_id, conformer_site in canonical_site.conformer_sites.items(): # for lid in conformer_site.ligand_ids: - for dtag, dataset_alignment_info in fs_model.alignments.items(): - for chain, chain_alignment_info in dataset_alignment_info.items(): - for residue, residue_alignment_info in chain_alignment_info.items(): - for version, ligand_neighbourhood_output in residue_alignment_info.items(): - for ( - canonical_site_id, - aligned_structure_path, - ) in ligand_neighbourhood_output.aligned_structures.items(): - rprint(fs_model.source_dir / aligned_structure_path) - rprint(Path(aligned_structure_path)) - rprint(fs_model.source_dir) - exit() for dtag, dataset_alignment_info in fs_model.alignments.items(): for chain, chain_alignment_info in dataset_alignment_info.items(): for residue, residue_alignment_info in chain_alignment_info.items(): @@ -1578,7 +1566,7 @@ def _update( canonical_site_id, aligned_structure_path, ) in ligand_neighbourhood_output.aligned_structures.items(): - if not ( (fs_model.source_dir / aligned_structure_path).exists() | Path(aligned_structure_path).exists()): + if not ( (fs_model.source_dir.parent / aligned_structure_path).exists() | Path(aligned_structure_path).exists()): # _update_aligned_structures() _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] @@ -1639,7 +1627,7 @@ def _update( for canonical_site_id, alignment_info in dataset_alignment_info.items(): aligned_structure_path = alignment_info["aligned_structures"] logger.info(f"Outputting reference structure: {aligned_structure_path}") - if not ( (fs_model.source_dir / aligned_structure_path).exists() | Path(aligned_structure_path).exists()): + if not ( (fs_model.source_dir.parent / aligned_structure_path).exists() | Path(aligned_structure_path).exists()): _structure = structures[dtag].clone() _align_reference_structure( _structure, @@ -1669,7 +1657,7 @@ def _update( aligned_event_map_path, ) in ligand_neighbourhood_output.aligned_event_maps.items(): logger.info(f"Writing to: {aligned_event_map_path}") - if not ( (fs_model.source_dir / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): + if not ( (fs_model.source_dir.parent / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] # Check for the matching conformer site From ef6fc0cbde999f094786db1de937117c791d7351 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:55 +0100 Subject: [PATCH 22/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index f1cbc128..0c2ffbda 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1678,6 +1678,9 @@ def _update( xmap_path = datasets[dtag].ligand_binding_events[(dtag, chain, residue)].xmap aligned_structure_path = ligand_neighbourhood_output.aligned_structures[canonical_site_id] + st_path = fs_model.source_dir.parent / aligned_structure_path + if not st_path.exists(): + st_path = aligned_structure_path aligned_structure = gemmi.read_structure(str(aligned_structure_path)) aligned_res = aligned_structure[0][chain][str(residue)][0] From 27367203a64f9d070c9c70f976c033e5121541d0 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:15:00 +0100 Subject: [PATCH 23/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 0c2ffbda..a966fd0f 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1681,7 +1681,7 @@ def _update( st_path = fs_model.source_dir.parent / aligned_structure_path if not st_path.exists(): st_path = aligned_structure_path - aligned_structure = gemmi.read_structure(str(aligned_structure_path)) + aligned_structure = gemmi.read_structure(str(st_path)) aligned_res = aligned_structure[0][chain][str(residue)][0] # logger.info(datasets[dtag].ligand_binding_events[(dtag, chain, residue)].dtag) From 50ae5d6753077a243263cb476927455256074e12 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:28:45 +0100 Subject: [PATCH 24/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index a966fd0f..f5d0a996 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1658,6 +1658,7 @@ def _update( ) in ligand_neighbourhood_output.aligned_event_maps.items(): logger.info(f"Writing to: {aligned_event_map_path}") if not ( (fs_model.source_dir.parent / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): + print(fs_model.source_dir.parent / aligned_event_map_path) _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] # Check for the matching conformer site From 66ad8187f4791931f0a4ef711a8a3540e3ef123b Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:47:55 +0100 Subject: [PATCH 25/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index f5d0a996..110910e1 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1657,7 +1657,8 @@ def _update( aligned_event_map_path, ) in ligand_neighbourhood_output.aligned_event_maps.items(): logger.info(f"Writing to: {aligned_event_map_path}") - if not ( (fs_model.source_dir.parent / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): + # if not ( (fs_model.source_dir.parent / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): + if Path(aligned_event_map_path).is_relative_to(fs_model.source_dir): print(fs_model.source_dir.parent / aligned_event_map_path) _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] From 67a43cd0ac5619bfdf6a7cda21dd4536b8887858 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:56:57 +0100 Subject: [PATCH 26/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 110910e1..635a6831 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1658,7 +1658,12 @@ def _update( ) in ligand_neighbourhood_output.aligned_event_maps.items(): logger.info(f"Writing to: {aligned_event_map_path}") # if not ( (fs_model.source_dir.parent / aligned_event_map_path).exists() | Path(aligned_event_map_path).exists()): - if Path(aligned_event_map_path).is_relative_to(fs_model.source_dir): + rel = True + try: + rel = Path(aligned_event_map_path).is_relative_to(fs_model.source_dir) + except: + rel = False + if rel: print(fs_model.source_dir.parent / aligned_event_map_path) _structure = structures[dtag].clone() canonical_site = canonical_sites[canonical_site_id] @@ -1686,9 +1691,6 @@ def _update( aligned_structure = gemmi.read_structure(str(st_path)) aligned_res = aligned_structure[0][chain][str(residue)][0] - # logger.info(datasets[dtag].ligand_binding_events[(dtag, chain, residue)].dtag) - # logger.info(datasets[dtag].ligand_binding_events[(dtag, chain, residue)].chain) - # logger.info(datasets[dtag].ligand_binding_events[(dtag, chain, residue)].residue) # * if (xmap_path != "None") and (xmap_path is not None): xmap = read_xmap(xmap_path) From 0890b0262e9a91eee2fecafcba3ef8c6ab55ad2b Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:45:52 +0000 Subject: [PATCH 27/39] Fix for A71 --- src/ligand_neighbourhood_alignment/alignment_heirarchy.py | 1 + .../generate_sites_from_components.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/alignment_heirarchy.py b/src/ligand_neighbourhood_alignment/alignment_heirarchy.py index faa7e027..9b1cddaf 100644 --- a/src/ligand_neighbourhood_alignment/alignment_heirarchy.py +++ b/src/ligand_neighbourhood_alignment/alignment_heirarchy.py @@ -75,6 +75,7 @@ def _chain_to_biochain(chain_name, xtalform: dt.XtalForm, assemblies: dict[str, for _j, _chain_name in enumerate(_xtal_assembly.chains): if chain_name == _chain_name: return assemblies[_xtal_assembly.assembly].generators[_j].biomol + raise Exception(f'No biochain found for chain {chain_name}') StructureLandmarks = dict[tuple[str, str, str], tuple[float, float, float]] diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 431ac26a..37314d5c 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -336,10 +336,11 @@ def _update_reference_structure_transforms( # Determine whether the biochain is shared, and if not skip reference_structure = structures[key[0]] reference_structure_xtalform = xtalforms[dataset_assignments[key[0]]] + xtalform_chains = [chain for assembly in reference_structure_xtalform.assemblies.values() for chain in assembly.chains] reference_structure_biochains = { chain.name: alignment_heirarchy._chain_to_biochain(chain.name, reference_structure_xtalform, assemblies) for chain - in reference_structure[0] + in xtalform_chains } reference_structure_biochains_inv = {v: k for k, v in reference_structure_biochains.items()} From 94c3e0411c19b244dfdb7a817a2d92a6d8800832 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:49:03 +0000 Subject: [PATCH 28/39] Fix for A71 --- .../generate_sites_from_components.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 37314d5c..ecdaebb0 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -351,7 +351,8 @@ def _update_reference_structure_transforms( alignment_residues_ref_st = [] alignment_residues_mov_st = [] core_chain = reference_structure_biochains_inv[canonical_site_biochain] - for rid in canonical_site.residues: + canonical_site_residues = canonical_site.residues + for rid in canonical_site_residues: chain, res = rid[0], rid[1] biochain = alignment_heirarchy._chain_to_biochain( chain, From e7de75e1c01514ca94bb9ee5b1b11b9a7633897d Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:50:21 +0000 Subject: [PATCH 29/39] Fix for A71 --- .../generate_sites_from_components.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index ecdaebb0..317f5c6a 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -338,7 +338,7 @@ def _update_reference_structure_transforms( reference_structure_xtalform = xtalforms[dataset_assignments[key[0]]] xtalform_chains = [chain for assembly in reference_structure_xtalform.assemblies.values() for chain in assembly.chains] reference_structure_biochains = { - chain.name: alignment_heirarchy._chain_to_biochain(chain.name, reference_structure_xtalform, assemblies) + chain: alignment_heirarchy._chain_to_biochain(chain.name, reference_structure_xtalform, assemblies) for chain in xtalform_chains } From 2aa62b3d917142a0d49b7a6db9b1aaf409ff72e4 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:52:34 +0000 Subject: [PATCH 30/39] Fix for A71 --- .../generate_sites_from_components.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 317f5c6a..616c8a3c 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -338,7 +338,7 @@ def _update_reference_structure_transforms( reference_structure_xtalform = xtalforms[dataset_assignments[key[0]]] xtalform_chains = [chain for assembly in reference_structure_xtalform.assemblies.values() for chain in assembly.chains] reference_structure_biochains = { - chain: alignment_heirarchy._chain_to_biochain(chain.name, reference_structure_xtalform, assemblies) + chain: alignment_heirarchy._chain_to_biochain(chain, reference_structure_xtalform, assemblies) for chain in xtalform_chains } From 89fc7fc6f4631e0aa7383efbfb9b499368bc9b56 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:09:10 +0000 Subject: [PATCH 31/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 4 +++- .../generate_sites_from_components.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 635a6831..2fab9b4d 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1534,7 +1534,9 @@ def _update( conformer_sites, assemblies, xtalforms, - dataset_assignments + dataset_assignments, + xtalform_sites, + canonical_site_id ) logger.info(f"Now have {len(reference_structure_transforms)} reference structure transforms") save_reference_structure_transforms( diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 616c8a3c..3677f484 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -322,13 +322,20 @@ def _update_reference_structure_transforms( conformer_sites: dict[str, dt.ConformerSite], assemblies, xtalforms, - dataset_assignments + dataset_assignments, + xtalform_sites, +canonical_site_id ): # Get the biochain of the canonical site site_reference_ligand_id = conformer_sites[canonical_site.reference_conformer_site_id].reference_ligand_id site_reference_ligand_xtalform = xtalforms[dataset_assignments[site_reference_ligand_id[0]]] + for xsid, xtalform_site in xtalform_sites.items(): + if xtalform_site.xtalform_id == dataset_assignments[site_reference_ligand_id[0]]: + if xtalform_site.canonical_site_id == canonical_site_id: + break + site_chain = xtalform_site.crystallographic_chain canonical_site_biochain = alignment_heirarchy._chain_to_biochain( - site_reference_ligand_id[1], + site_chain, site_reference_ligand_xtalform, assemblies ) From c84c5ffcc552b0cc15c0c50abcfa2f9d97751889 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:17:31 +0000 Subject: [PATCH 32/39] Fix for A71 --- .../generate_sites_from_components.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 3677f484..778bbade 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -328,11 +328,12 @@ def _update_reference_structure_transforms( ): # Get the biochain of the canonical site site_reference_ligand_id = conformer_sites[canonical_site.reference_conformer_site_id].reference_ligand_id - site_reference_ligand_xtalform = xtalforms[dataset_assignments[site_reference_ligand_id[0]]] - for xsid, xtalform_site in xtalform_sites.items(): - if xtalform_site.xtalform_id == dataset_assignments[site_reference_ligand_id[0]]: - if xtalform_site.canonical_site_id == canonical_site_id: - break + site_reference_ligand_xtalform_id = dataset_assignments[site_reference_ligand_id[0]] + site_reference_ligand_xtalform = xtalforms[site_reference_ligand_xtalform_id] + for xsid, _xtalform_site in xtalform_sites.items(): + if _xtalform_site.xtalform_id == site_reference_ligand_xtalform_id: + if _xtalform_site.canonical_site_id == canonical_site_id: + xtalform_site = _xtalform_site site_chain = xtalform_site.crystallographic_chain canonical_site_biochain = alignment_heirarchy._chain_to_biochain( site_chain, From 7f1ac4ea13a15d9bbebc2f333d28eb4f23341f16 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:18:49 +0000 Subject: [PATCH 33/39] Fix for A71 --- .../generate_sites_from_components.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 778bbade..0c2b2175 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -331,8 +331,10 @@ def _update_reference_structure_transforms( site_reference_ligand_xtalform_id = dataset_assignments[site_reference_ligand_id[0]] site_reference_ligand_xtalform = xtalforms[site_reference_ligand_xtalform_id] for xsid, _xtalform_site in xtalform_sites.items(): - if _xtalform_site.xtalform_id == site_reference_ligand_xtalform_id: - if _xtalform_site.canonical_site_id == canonical_site_id: + _xtalform_id = _xtalform_site.xtalform_id + if _xtalform_id == site_reference_ligand_xtalform_id: + _xtalform_canonical_site_id = _xtalform_site.canonical_site_id + if _xtalform_canonical_site_id == canonical_site_id: xtalform_site = _xtalform_site site_chain = xtalform_site.crystallographic_chain canonical_site_biochain = alignment_heirarchy._chain_to_biochain( From 65ee3165b98a60a4d1e080d049696645c2d6385b Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:53:28 +0000 Subject: [PATCH 34/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 11 +++++++++-- .../generate_sites_from_components.py | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 2fab9b4d..c780b6aa 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -976,7 +976,8 @@ def _update_xtalform_sites( canonical_site_id: str, dataset_assignments: dict[str, str], conformer_sites: dict[str, dt.ConformerSite], - neighbourhoods + neighbourhoods, + debug=False ): # Iterate over Canonical Sites, collecting Observations that are in the same crystalform # Then get their centroid CA positions, @@ -1007,6 +1008,8 @@ def _update_xtalform_sites( } for xtalform_name in crystalform_observations } + if debug: + raise Exception # Spatially cluster crystalform_observation_cluster_assignments = { @@ -1479,13 +1482,17 @@ def _update( for canonical_site_id, canonical_site in canonical_sites.items(): # If canonical site in a xtalform site, replace with new data, otherwise # Check if residues match as usual, otherwise create a new canon site for it + debug = False + if canonical_site_id == 'LYSRSCPZ-x0426+A+805+1': + debug=True _update_xtalform_sites( xtalform_sites, canonical_site, canonical_site_id, dataset_assignments, conformer_sites, - ligand_neighbourhoods + ligand_neighbourhoods, + debug ) logger.info(f"Now have {len(xtalform_sites)} xtalform sites") _save_xtalform_sites(fs_model, xtalform_sites) diff --git a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py index 0c2b2175..f331f7d5 100644 --- a/src/ligand_neighbourhood_alignment/generate_sites_from_components.py +++ b/src/ligand_neighbourhood_alignment/generate_sites_from_components.py @@ -324,7 +324,7 @@ def _update_reference_structure_transforms( xtalforms, dataset_assignments, xtalform_sites, -canonical_site_id + canonical_site_id ): # Get the biochain of the canonical site site_reference_ligand_id = conformer_sites[canonical_site.reference_conformer_site_id].reference_ligand_id From e7e8eddaedc365488600d928a3fb05f83eca285d Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:57:32 +0000 Subject: [PATCH 35/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index c780b6aa..3a783970 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1008,8 +1008,7 @@ def _update_xtalform_sites( } for xtalform_name in crystalform_observations } - if debug: - raise Exception + # Spatially cluster crystalform_observation_cluster_assignments = { @@ -1021,6 +1020,9 @@ def _update_xtalform_sites( for xtalform_name in crystalform_observations } + if debug: + raise Exception + # Create the xtalforms or assign new observations for xtalform_name in crystalform_observation_cluster_assignments: for centroid_residue, asigned_observation_ids in crystalform_observation_cluster_assignments[ From a52668c19c0b145061a00f34664cda6a4d50357c Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:01:34 +0000 Subject: [PATCH 36/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 3a783970..1b4fc072 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1039,7 +1039,7 @@ def _update_xtalform_sites( xtalform_site_id = "/".join(centroid_residue) xtalform_site = dt.XtalFormSite( xtalform_name, - centroid_residue[1], + crystalform_observation_centroids[centroid_residue][1], canonical_site_id, asigned_observation_ids, ) From 038290ba64a7c15e2c66ce7f81f7b847c62c8f84 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:02:01 +0000 Subject: [PATCH 37/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 1b4fc072..d6d22d3d 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1020,8 +1020,8 @@ def _update_xtalform_sites( for xtalform_name in crystalform_observations } - if debug: - raise Exception + # if debug: + # raise Exception # Create the xtalforms or assign new observations for xtalform_name in crystalform_observation_cluster_assignments: From 02ce9ae26fb904c6019cbef8484dccc673409397 Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:06:24 +0000 Subject: [PATCH 38/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index d6d22d3d..4088df12 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1039,7 +1039,7 @@ def _update_xtalform_sites( xtalform_site_id = "/".join(centroid_residue) xtalform_site = dt.XtalFormSite( xtalform_name, - crystalform_observation_centroids[centroid_residue][1], + crystalform_observation_centroids[xtalform_name][centroid_residue][1], canonical_site_id, asigned_observation_ids, ) From 6d6d5d88ca38d4e1684fd9168859b24557182ddd Mon Sep 17 00:00:00 2001 From: ConorFWild <41680328+ConorFWild@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:08:41 +0000 Subject: [PATCH 39/39] Fix for A71 --- src/ligand_neighbourhood_alignment/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ligand_neighbourhood_alignment/cli.py b/src/ligand_neighbourhood_alignment/cli.py index 4088df12..36154a03 100644 --- a/src/ligand_neighbourhood_alignment/cli.py +++ b/src/ligand_neighbourhood_alignment/cli.py @@ -1039,7 +1039,7 @@ def _update_xtalform_sites( xtalform_site_id = "/".join(centroid_residue) xtalform_site = dt.XtalFormSite( xtalform_name, - crystalform_observation_centroids[xtalform_name][centroid_residue][1], + crystalform_observation_centroids[xtalform_name][centroid_residue][0], canonical_site_id, asigned_observation_ids, )