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

improve 2d vis of mappings #278

Closed
wants to merge 2 commits into from
Closed

Conversation

richardjgowers
Copy link
Contributor

previously would independently calculate 2D vis for each molecule, then RMS align these

now constrains second molecule's 2d representation to match that of the first molecule

overall improves the 2d vis generated, esp. when dealing with rotamers

before: (here atom 9L maps to atom 9R. rdkit however assigns a more traditional sulfonamide layout)

image (3)

after: (atom 9L & 9R are constrained. This results in the H's having less layout room, but makes it clear why they didn't map)

mapping_fixed

previously would independently calculate 2D vis for each molecule, then RMS align these

now constrains second molecule's 2d representation to match that of the first molecule

overall improves the 2d vis generated, esp. when dealing with rotamers
@pep8speaks
Copy link

pep8speaks commented Jan 29, 2024

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

Line 135:80: E501 line too long (80 > 79 characters)
Line 159:80: E501 line too long (80 > 79 characters)

Comment last updated at 2024-01-29 13:47:29 UTC

The structure contains the indices of the molecules in mols as key
Tuple[molA, molB] and maps the atom indices via the value Dict[
molA_atom_idx, molB_atom_idx]
atom_mapping: dict[int, int], optional
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'm changing the signature of this, since it's an private/internal function. Previously it would accept arbitrarily many molecules and mapping, but this was untested/unused. I've narrowed this down to 1 molecule or 2 molecules with a mapping.

Copy link
Contributor

Choose a reason for hiding this comment

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

would we need to turn this back, when going multistate?

Copy link
Contributor

Choose a reason for hiding this comment

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

or would we implement a new function?

Copy link
Contributor

Choose a reason for hiding this comment

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

just a thought, to think about it.

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1f77481) 99.22% compared to head (1de370a) 99.22%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #278   +/-   ##
=======================================
  Coverage   99.22%   99.22%           
=======================================
  Files          36       36           
  Lines        1938     1942    +4     
=======================================
+ Hits         1923     1927    +4     
  Misses         15       15           

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

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Would it be possible to see an example with a larger R group please? So we know that the hydrogen "squishing" isn't going to lead to more worse visual problems long term?

edit: for example, what if the hydrogen at position 10/12 on the benzene right is actually COOH?

atomMap=[(k, v) for v, k in atomMap.items()]
)
# create layout of first molecule
# TODO:
Copy link
Member

Choose a reason for hiding this comment

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

Please raise an issue for this current problem and this todo.

I suspect someone's going to stumble upon this with an old version of gufe and we'll forget this ever happened.

hmacdope pushed a commit to hmacdope/gufe that referenced this pull request Feb 29, 2024
related to off tk #1563
hmacdope pushed a commit to hmacdope/gufe that referenced this pull request Feb 29, 2024
related to off tk #1563
hmacdope pushed a commit to hmacdope/gufe that referenced this pull request Feb 29, 2024
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.

4 participants