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

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

Merged
merged 6 commits into from
May 31, 2024

Conversation

yuxuanzhuang
Copy link
Contributor

@yuxuanzhuang yuxuanzhuang commented Apr 30, 2024

Fixes #2053 #4189

Changes made in this Pull Request:

  • Updated PSFParser to convert string-like residue numbers to their leading number. If the conversion fails, the residue number defaults to 0.

In CHARMM PSF, residue identifiers (resids) can be any string, as discussed in #2053 (comment). 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

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

Developers certificate of origin


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

@pep8speaks
Copy link

pep8speaks commented Apr 30, 2024

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

Copy link

github-actions bot commented Apr 30, 2024

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!

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@             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     

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

Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

This looks good to me @yuxuanzhuang. Thanks! Would you be able to just add a quick test that the resids of the form 14F etc are able to be read from the test file?

@orbeckst
Copy link
Member

@hmacdope please look after this PR! Thank you!

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

Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

Looks good to me now @yuxuanzhuang! Thanks!

@hmacdope hmacdope merged commit 347a0c0 into MDAnalysis:develop May 31, 2024
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

parse charmm psf file with residue insertion codes failed
4 participants