Skip to content

Fixes #4924#4961

Merged
orbeckst merged 11 commits intoMDAnalysis:developfrom
BHM-Bob:develop
Mar 29, 2025
Merged

Fixes #4924#4961
orbeckst merged 11 commits intoMDAnalysis:developfrom
BHM-Bob:develop

Conversation

@BHM-Bob
Copy link
Contributor

@BHM-Bob BHM-Bob commented Mar 12, 2025

[… generate_kirchoff: fix residue_index_map generate to avoid use all atoms when select is 'name CA'](fix-bug: package/MDAnalysis/analysis/gnm.py: closeContactGNMAnalysis: generate_kirchoff: fix residue_index_map generate to avoid use all atoms when select is 'name CA')

Fixes #4924

Changes made in this Pull Request:

  • fix-bug: package/MDAnalysis/analysis/gnm.py: closeContactGNMAnalysis: generate_kirchoff: fix residue_index_map generate to avoid use all atoms when select is 'name CA'

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.


📚 Documentation preview 📚: https://mdanalysis--4961.org.readthedocs.build/en/4961/

BHM-Bob added 2 commits March 12, 2025 17:28
… generate_kirchoff: fix residue_index_map generate to avoid use all atoms when select is 'name CA'
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.

@codecov
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.41%. Comparing base (35d9d2e) to head (b768d02).
Report is 21 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4961      +/-   ##
===========================================
- Coverage    93.42%   93.41%   -0.02%     
===========================================
  Files          177      189      +12     
  Lines        21859    22925    +1066     
  Branches      3078     3078              
===========================================
+ Hits         20422    21415     +993     
- Misses         986     1059      +73     
  Partials       451      451              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Can you add a new test that shows that the bug has been fixed?

The test should FAIL without your fix and PASS with your fix.

The test should be added to testsuite/MDAnalysisTests/analysis/test_gnm.py.

BHM-Bob added 2 commits March 13, 2025 10:57
…alysis

- Add test case to verify correct behavior when selecting 'name CA' atoms
- Ensure that all residues are included in the analysis, fixing the issue where only residues 0-14 were used
- Validate the results against expected eigenvalues and Kirchhoff matrix
… readability

- Improved code formatting and line breaks for better readability
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Can you please also add an entry to CHANGELOG under Fixes?

Thanks for adding the test. I have to look at it in more detail. Does it make sense that the eigenvalues for the CA case are essentially zero (~1e-16)?

@orbeckst orbeckst self-assigned this Mar 15, 2025
@BHM-Bob
Copy link
Contributor Author

BHM-Bob commented Mar 15, 2025

Can you please also add an entry to CHANGELOG under Fixes?

Thanks for adding the test. I have to look at it in more detail. Does it make sense that the eigenvalues for the CA case are essentially zero (~1e-16)?

I did not read the original paper on the algorithm, but I tried to optimize the code for speed and studied it in detail. I think it is because we get fewer contacts in a residue with selection name CA compared to the selection protein.

Here are the diffrent values with different selections in the test case:

  • name CA: [3.57984776e-16, 3.53892581e-16]
  • backbone: [0.10452734363228021, 0.09703186472743706]
  • protein: [2.4328739192983098, 2.2967250902017526]

The value increases as the number of atoms increases.

This fix also corrects the case in 'backbone'.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests and answering my questions. I think this now looks good.

@orbeckst orbeckst merged commit 66e7e5c into MDAnalysis:develop Mar 29, 2025
23 of 24 checks passed
@orbeckst
Copy link
Member

Thank you for your first contribution!!

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.

The residue_index_map in closeContactGNMAnalysis has an error in selecting "name CA"

2 participants