Skip to content

Set element to 'X' for unknown/ambiguous cases. - #3250

Merged
JoaoRodrigues merged 3 commits into
biopython:masterfrom
JoaoRodrigues:atom_element_unk
Sep 7, 2020
Merged

JoaoRodrigues merged 3 commits into
biopython:masterfrom
JoaoRodrigues:atom_element_unk

Conversation

@JoaoRodrigues

Copy link
Copy Markdown
Member

This change comes from my benchmark on the entire PDB. I added a small test to assign elements and we have a few failures on unknown or ambiguous atoms. Here's an example from PDB 4CPA:

ATOM   2439  N   GLX I   2     -14.463 -16.664  -1.443  1.00 23.73           N  
ATOM   2440  CA  GLX I   2     -13.386 -16.604  -2.426  1.00 29.49           C  
ATOM   2441  C   GLX I   2     -12.828 -15.227  -2.806  1.00 31.92           C  
ATOM   2442  O   GLX I   2     -11.632 -15.318  -3.276  1.00 37.34           O  
ATOM   2443  CB  GLX I   2     -13.815 -17.229  -3.786  1.00 23.88           C  
ATOM   2444  CG  GLX I   2     -13.280 -16.825  -5.123  1.00 25.96           C  
ATOM   2445  CD  GLX I   2     -12.527 -17.669  -6.090  1.00 35.96           C  
ATOM   2446  XE1 GLX I   2     -11.768 -18.704  -5.944  1.00 40.06           X  
ATOM   2447  XE2 GLX I   2     -12.724 -17.305  -7.323  1.00 35.50           X  

Currently, our parsers assign an empty/blank element to those XE1 and XE2 atoms (as they should, good thing they don't assign xenon!) but it seems that the PDB prefers these are 'X'. This PR makes that change and moves some of the documentation from function comments to the docstring.

Not urgent to include this, happy to wait until we release 1.78.

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run pre-commit locally,
    and understand that AppVeyor and TravisCI will be used to confirm the Biopython unit
    tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

@codecov

codecov Bot commented Sep 2, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #3250 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3250   +/-   ##
=======================================
  Coverage   83.91%   83.92%           
=======================================
  Files         317      317           
  Lines       51528    51529    +1     
=======================================
+ Hits        43240    43244    +4     
+ Misses       8288     8285    -3     
Impacted Files Coverage Δ
Bio/PDB/Atom.py 89.15% <100.00%> (+1.47%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 989e7bc...b3ac454. Read the comment docs.

@JoaoRodrigues

Copy link
Copy Markdown
Member Author

@jgreener64 - would appreciate a small review here if you have the time!

@jgreener64

Copy link
Copy Markdown
Contributor

Would this mean that reading in a PDB file with no elements listed and then writing it back out would put Xs in all the element entries?

Not that that's such a bad thing, I'm just wondering.

@JoaoRodrigues

JoaoRodrigues commented Sep 7, 2020 via email

Copy link
Copy Markdown
Member Author

@jgreener64

Copy link
Copy Markdown
Contributor

Ah that makes sense. This PR looks good to me.

@JoaoRodrigues

Copy link
Copy Markdown
Member Author

Thanks!

Comment thread NEWS.rst

The latest news is at the top of this file.

(In progress, not yet released): Biopython 1.78

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Whoops. Good catch.

@peterjc peterjc left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Style wise this looks fine, and I understand the rational. No comment on the wisdom of this change, I never had to deal with atypical atoms in PDB files.

@JoaoRodrigues

Copy link
Copy Markdown
Member Author

There isn't much wisdom here, just trying to match the PDB 'standard' as much as possible and this is one of those 'undocumented' features... Thanks for the comments! Will merge!

@JoaoRodrigues
JoaoRodrigues merged commit 8a8dd37 into biopython:master Sep 7, 2020
@JoaoRodrigues
JoaoRodrigues deleted the atom_element_unk branch September 7, 2020 18:09
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.

3 participants