Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asap-docking | Correctly save multipose docking results #1009

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

apayne97
Copy link
Contributor

@apayne97 apayne97 commented Apr 24, 2024

Description

Updates the POSIT docker to use the updates from #692 to handle writing multipose posit results.
Fixes #988

Todos

Notable points that this PR has either accomplished or will accomplish.

  • add tests and functionality for creating a new ligand object from multiple separate ligand objects with the same chemical identity
  • update the POSITDocker to use this and pass all the results to a single results obj
  • add pose id to DockingResultsCols
  • add method to split POSITDockingResults into single pose results

Status

  • Ready to go

Developers certificate of origin

Copy link
Collaborator

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, see comments.

provenance=self.provenance(),
probability=(
posed_ligands[0].tags[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this vary by ligand? Or are they all going to be homogenous?

Copy link
Contributor Author

@apayne97 apayne97 May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry for the delay) what are you referring to by "this"? the poses are ordered by the POSIT score such that the first pose is the one with the best POSIT probability.

Comment on lines 343 to 374
input_pairs.append(set)

# create hashable dict of input pairs
input_pair_dict = {
input_pair.unique_name: input_pair for input_pair in input_pairs
}

# split results by input pair
from collections import defaultdict

results_dict = defaultdict(list)
for input_pair, posed_ligand in zip(input_pairs, posed_ligands):
results_dict[input_pair.unique_name].append(posed_ligand)

# return results split by input pair
for input_pair_name, posed_ligands in results_dict.items():
docking_result = POSITDockingResults(
input_pair=input_pair,
posed_ligand=posed_ligand,
probability=prob,
input_pair=input_pair_dict[input_pair_name],
posed_ligand=Ligand.from_single_conformers(posed_ligands),
provenance=self.provenance(),
probability=(
posed_ligands[0].tags[
DockingResultCols.DOCKING_CONFIDENCE_POSIT.value
]
if len(posed_ligands) == 1
else None
),
pose_id=(
posed_ligands[0].tags["Pose_ID"]
if len(posed_ligands) == 1
else None
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this more complicated logic into the branch above to avoid performance penalty when not using a MultiStructure input and also to make the non-Multi case clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've fixed this sufficiently?

@apayne97 apayne97 requested a review from hmacdope May 27, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

asap-docking Update POSITDockingResults object to write multi-pose results to docking_results.json
2 participants