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

Fix PDB load_one for Cl atoms #284

Merged
merged 4 commits into from
Jun 12, 2023
Merged

Conversation

tovrstra
Copy link
Member

Fixes #282

@tovrstra
Copy link
Member Author

The same fix should work for any atom name, assuming the leading two characters define the symbol. This will not always work, e.g. PDB files often use CA for the alpha carbon, not Calcium. See e.g. https://files.rcsb.org/view/5D3A.pdb

If you want to make sure things work like they should, use PDB files with elements defined in the nearly last columns, instead of relying on atom names. We could add a warning for when the symbol is guessed from the atom name, just to clarify that one is potentially in trouble.

@codecov
Copy link

codecov bot commented Oct 18, 2021

Codecov Report

Merging #284 (5d3b498) into master (bb9415f) will decrease coverage by 0.03%.
The diff coverage is 92.10%.

@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
- Coverage   95.01%   94.99%   -0.03%     
==========================================
  Files          74       74              
  Lines        8811     8828      +17     
  Branches     1213     1216       +3     
==========================================
+ Hits         8372     8386      +14     
- Misses        191      193       +2     
- Partials      248      249       +1     
Impacted Files Coverage Δ
iodata/formats/pdb.py 97.27% <76.92%> (-2.03%) ⬇️
iodata/test/test_pdb.py 98.61% <100.00%> (+0.13%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

BradenDKelly
BradenDKelly previously approved these changes Oct 19, 2021
Copy link
Contributor

@BradenDKelly BradenDKelly left a comment

Choose a reason for hiding this comment

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

This seems fine to me. We just need to add a warning if the last column is missing since I have a feeling CA will happen

@tovrstra
Copy link
Member Author

I've pushed a commit with the warnings. I have reorganized a few things to stay closer to the definitions in the PDB format. We should also consider opening an issue to rename some fields return by the PDB loader, eg. atname instead of attype. Usually, these names are not atom types.

@tovrstra
Copy link
Member Author

tovrstra commented May 8, 2023

@FarnazH @evohringer @BradenDKelly This is ready to be merged as far as I am concerned. I'll merge this on May 15 unless there are new comments by then.

@tovrstra tovrstra merged commit ca6113b into theochem:master Jun 12, 2023
6 of 7 checks passed
@tovrstra tovrstra deleted the fix-pdb-cl branch June 12, 2023 11:07
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.

PDB load_one issue with atom type CL
2 participants