MDAnalysis / mdanalysis

MDAnalysis is a Python library to analyze molecular dynamics simulations.
https://mdanalysis.org
Other
1.26k stars 641 forks source link

PSFParser reads and converts string-Like residue number to the leading number #4582

Closed yuxuanzhuang closed 1 month ago

yuxuanzhuang commented 2 months ago

Fixes #2053 #4189

Changes made in this Pull Request:

In CHARMM PSF, residue identifiers (resids) can be any string, as discussed in https://github.com/MDAnalysis/mdanalysis/issues/2053#issuecomment-1984023249. Tools like CHARMM-GUI and psfgen often modify resids by including insertion codes from PDB files or converting large resids to hexadecimal numbers for placement in the resid block.

We should support reading it and this update aligns with the approach used by VMD for reading the leading number (atoi as in C) from string-like resids.

PR Checklist

Developers certificate of origin


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

pep8speaks commented 2 months ago

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

Line 2587:1: W293 blank line contains whitespace

Line 255:9: E731 do not assign a lambda expression, use a def

Line 162:1: E302 expected 2 blank lines, found 1 Line 165:51: W292 no newline at end of file

Comment last updated at 2024-05-30 03:52:24 UTC
github-actions[bot] commented 2 months ago

Linter Bot Results:

Hi @yuxuanzhuang! Thanks for making this PR. We linted your code and found the following:

Some issues were found with the formatting of your code. Code Location Outcome
main package ⚠️ Possible failure
testsuite ⚠️ Possible failure

Please have a look at the darker-main-code and darker-test-code steps here for more details: https://github.com/MDAnalysis/mdanalysis/actions/runs/9296711606/job/25585650663


Please note: The black linter is purely informational, you can safely ignore these outcomes if there are no flake8 failures!

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.17%. Comparing base (81062f3) to head (34810e6).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #4582 +/- ## =========================================== - Coverage 93.60% 93.17% -0.44% =========================================== Files 168 12 -156 Lines 21098 1069 -20029 Branches 3919 0 -3919 =========================================== - Hits 19748 996 -18752 + Misses 892 73 -819 + Partials 458 0 -458 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

orbeckst commented 1 month ago

@hmacdope please look after this PR! Thank you!

(As always, if it gets too much please say something an un-assign yourself.)