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

perf: features.contact #220

Merged
merged 38 commits into from Nov 8, 2022
Merged

perf: features.contact #220

merged 38 commits into from Nov 8, 2022

Conversation

DaniBodor
Copy link
Collaborator

@DaniBodor DaniBodor commented Nov 1, 2022

Massively simplified code for addition of edge features in features.atomic_contact.
Also fixed mistake in LJ potential calculation
Removed old functions from tools.pdb, which I think were intended for or once upon a time used for generating edge features, but is now done in feature.atomic_contact

closes #207 and #218

@DaniBodor DaniBodor linked an issue Nov 1, 2022 that may be closed by this pull request
@DaniBodor
Copy link
Collaborator Author

All tests run fine locally, not sure why they fail here

@DaniBodor DaniBodor marked this pull request as ready for review November 1, 2022 22:53
@@ -58,17 +59,12 @@ def _find_matching_residue_class(self, residue: Residue):
return None

def get_vanderwaals_parameters(self, atom: Atom):
type_ = self._get_type(atom)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we need type_ var?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's used for getting the right vanderwaals parameters from the table file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As far as I could see it was only used internally by the get_vanderwaals_parameters function. However, this function basically did nothing else than read the type_ and get the parameters, so instead I merged get_type into get_vanderwaals_parameters.
I tested that old and new add_features functions (from atomic_contact, which uses this) give the exact same result on ~5 test cases, so am fairly confident that it is still being read correctly.

Copy link
Collaborator

@gcroci2 gcroci2 left a comment

Choose a reason for hiding this comment

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

Seems good, but the build is failing. Please fix it before merging :)

@DaniBodor
Copy link
Collaborator Author

I noticed that this code is actually slower than the original in assigning features. I tested this by looping some tests from test_query and checking how long it takes to run.

I realize that this is (probably) because before that calculations (e.g. get_coulomb_potentials and get_lennard_jones_potentials) were only run once per graph on many atoms, and now they are run once per edge on few atoms at a time. Apparently the new way is slower.

I can look into finding a way to combine what happened before with the simplified code base, or we can revert to how it was or leave it as is. What do you think?

@gcroci2
Copy link
Collaborator

gcroci2 commented Nov 2, 2022

I noticed that this code is actually slower than the original in assigning features. I tested this by looping some tests from test_query and checking how long it takes to run.

I realize that this is (probably) because before that calculations (e.g. get_coulomb_potentials and get_lennard_jones_potentials) were only run once per graph on many atoms, and now they are run once per edge on few atoms at a time. Apparently the new way is slower.

I can look into finding a way to combine what happened before with the simplified code base, or we can revert to how it was or leave it as is. What do you think?

I would just revert it. It would have been a nice addition but I wouldn't lose too much time on this

@DaniBodor
Copy link
Collaborator Author

DaniBodor commented Nov 8, 2022

I would just revert it. It would have been a nice addition but I wouldn't lose too much time on this

I resolved it. Didn't take that long and wanted to use some stuff from this PR anyway.

@DaniBodor DaniBodor merged commit 624bfe9 into main Nov 8, 2022
@DaniBodor DaniBodor deleted the add_features_for_residues branch November 8, 2022 12:53
@DaniBodor DaniBodor changed the title Simplified code for edge features refactor: features.contact Nov 16, 2022
@DaniBodor DaniBodor changed the title refactor: features.contact perf: features.contact Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants