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

Torsion Distribution plotting/analysis #20

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

Conversation

RiesBen
Copy link

@RiesBen RiesBen commented Sep 26, 2023

This PR contains the Torsion Distribution plotting/analysis for for openFE trajectories.

Features:

  • read-out alchemical states from the trajectories
  • find all rotatable bonds
  • calculate trajectory torsions
  • plot torsion distribution

Todo:

  • Initial running version for torsion Distribution plotting
  • Initial Compare Torsion Distributions
  • Test Code on more complex systems
  • Implement Tests

Example plots:
image
image

@RiesBen RiesBen added the enhancement New feature or request label Sep 26, 2023
@RiesBen RiesBen self-assigned this Sep 26, 2023
@pep8speaks
Copy link

Hello @RiesBen! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 20:1: E302 expected 2 blank lines, found 1
Line 20:47: E225 missing whitespace around operator
Line 32:42: E225 missing whitespace around operator
Line 46:80: E501 line too long (87 > 79 characters)
Line 56:80: E501 line too long (92 > 79 characters)
Line 59:5: E731 do not assign a lambda expression, use a def
Line 59:80: E501 line too long (84 > 79 characters)
Line 67:80: E501 line too long (93 > 79 characters)
Line 80:80: E501 line too long (116 > 79 characters)
Line 81:80: E501 line too long (116 > 79 characters)
Line 86:1: W391 blank line at end of file

Line 2:1: W391 blank line at end of file

Line 2:80: E501 line too long (101 > 79 characters)
Line 7:1: E265 block comment should start with '# '
Line 12:1: E402 module level import not at top of file
Line 13:1: E402 module level import not at top of file
Line 14:1: E402 module level import not at top of file
Line 15:1: E402 module level import not at top of file
Line 16:1: E402 module level import not at top of file
Line 17:1: E402 module level import not at top of file
Line 18:1: E402 module level import not at top of file
Line 19:1: E402 module level import not at top of file
Line 20:1: E402 module level import not at top of file
Line 24:80: E501 line too long (87 > 79 characters)
Line 35:80: E501 line too long (115 > 79 characters)
Line 67:80: E501 line too long (117 > 79 characters)
Line 99:80: E501 line too long (94 > 79 characters)
Line 105:13: E303 too many blank lines (2)
Line 108:80: E501 line too long (86 > 79 characters)
Line 123:80: E501 line too long (88 > 79 characters)
Line 129:80: E501 line too long (102 > 79 characters)
Line 139:80: E501 line too long (94 > 79 characters)
Line 141:80: E501 line too long (85 > 79 characters)
Line 143:80: E501 line too long (82 > 79 characters)
Line 148:80: E501 line too long (81 > 79 characters)
Line 151:80: E501 line too long (104 > 79 characters)
Line 153:80: E501 line too long (94 > 79 characters)
Line 161:80: E501 line too long (93 > 79 characters)
Line 167:80: E501 line too long (105 > 79 characters)
Line 170:80: E501 line too long (107 > 79 characters)
Line 176:80: E501 line too long (82 > 79 characters)
Line 198:80: E501 line too long (85 > 79 characters)
Line 221:80: E501 line too long (83 > 79 characters)
Line 257:80: E501 line too long (104 > 79 characters)
Line 258:80: E501 line too long (105 > 79 characters)
Line 259:80: E501 line too long (80 > 79 characters)
Line 260:80: E501 line too long (80 > 79 characters)
Line 265:80: E501 line too long (120 > 79 characters)
Line 275:80: E501 line too long (93 > 79 characters)
Line 281:80: E501 line too long (114 > 79 characters)
Line 287:80: E501 line too long (107 > 79 characters)
Line 293:80: E501 line too long (91 > 79 characters)
Line 333:54: W292 no newline at end of file

Line 3:13: E222 multiple spaces after operator
Line 4:19: E127 continuation line over-indented for visual indent
Line 21:80: E501 line too long (89 > 79 characters)
Line 50:80: E501 line too long (110 > 79 characters)
Line 50:110: E703 statement ends with a semicolon
Line 67:80: E501 line too long (94 > 79 characters)

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@2a5900e). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #20   +/-   ##
=======================================
  Coverage        ?   47.01%           
=======================================
  Files           ?        8           
  Lines           ?      368           
  Branches        ?        0           
=======================================
  Hits            ?      173           
  Misses          ?      195           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

List[Chem.Bond]
List of rdkit.Chem.Bond that were found in a molecule taking symmetry into account.
"""
RotatableBondSmarts = Chem.MolFromSmarts("[!$(*#*)&!D1]-&!@[!$(*#*)&!D1]")
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this different from the definition in Lipinski?

List of atomic ids that specify a torsion around the bond of interest.
"""
bond_atoms = [bond.GetBeginAtom(), bond.GetEndAtom()]
additional_atom1 = list(filter(lambda x: x.GetIdx() != bond_atoms[1].GetIdx(), bond_atoms[0].GetNeighbors()))[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

We're going to ignore hydrogen torsions right? Does slicing the zeroth element here potentially miss a heavy atom torsion?

@@ -0,0 +1,333 @@
# This file is thanks Christian W. Feldman
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put plotting into openfe main repo please?

Copy link
Author

Choose a reason for hiding this comment

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

This could actually be a dependency, it's vendored code:
https://github.com/c-feldmann/lassohighlight/tree/master


def calculate_dihedrals(mol, torsion_ids_list)->np.array:
dihedrals = []
for c in mol.GetConformers():
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't work for our trajectories right?

@RiesBen
Copy link
Author

RiesBen commented Sep 26, 2023

Original Task description #11 :

Type
System sampling check
Question
Is phase space well sampled?
How
Minima sampled ~60%
Tool
MDA + rdkit
Note
Ideally what you should be looking at here is a combination of the solvent, vacuum, and complex differences and the variation in dihedral sampling across lambda states. I.e. is there a major change happening in my transformation that isn't being sampled across all states -- @IAlibay

@RiesBen RiesBen mentioned this pull request Sep 26, 2023
@jameseastwood jameseastwood linked an issue Sep 26, 2023 that may be closed by this pull request
@mikemhenry
Copy link

Those plots look really nice 🤩

@RiesBen
Copy link
Author

RiesBen commented Feb 20, 2024

@RiesBen Remove the hydrogens.

@RiesBen RiesBen changed the title [WIP] - Torsion Distribution plotting/analysis Torsion Distribution plotting/analysis Oct 23, 2024
@RiesBen
Copy link
Author

RiesBen commented Oct 23, 2024

@jameseastwood, @hannahbaumann and @IAlibay we should reassign this issue. The implementation should be stable, it is mainly about adressing the comments and merging it.

@jameseastwood jameseastwood assigned jthorton and unassigned RiesBen Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Torsion Sampling
5 participants