Repository navigation
Conversation
The TER format string was padded to 81 columns, one past the PDB format line width, and the TER serial was reused for the first atom of the following chain. Pad TER to 80 columns and advance the atom numbering after it, as in wwPDB files (ATOM n, TER n+1, ATOM n+2).
JoaoRodrigues
approved these changes
Nov 6, 2026
JoaoRodrigues
left a comment
Member
There was a problem hiding this comment.
Looks great to me, thank you.
Before we merge, can you comment on if you wrote this using AI? We're debating if we accept AI contributions or not and since a decision hasn't been made, we're opting to not include them at the moment.
|
|
||
| Typically select is a subclass of L{Select}. | ||
|
|
||
| :param preserve_atom_numbering: write each atom with its stored |
Member
There was a problem hiding this comment.
This will cause the next atom after the TER to have the same atom number as the TER. I think this is OK, weird, but OK.
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rstfile, have runpre-commitlocally, and understand that continuous integration checks 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.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)
Closes #1383
PDBIO.savewrote TER records with two problems:record (the ATOM lines are 80). Tools that read PDB files as fixed 80-column
records can mangle the following line: pdb-tools'
pad_linejoined the nextATOM line onto the TER and the atom was lost.
(
ATOM 2441,TER 2442,ATOM 2442). wwPDB files give TER its own serial(
ATOM n,TER n+1,ATOM n+2), as reported in Bio.PDB.PDBIO.save() - increment serial number of the TER record #1383.TER is now padded to 80 columns and the atom numbering advances after it, as in
the second patch proposed in #1383. With
preserve_atom_numbering=Truetheatoms keep their stored serials as before; the docstring now documents this
option.
Added
test_pdbio_write_ter(two models of two chains from1SSU_mod.pdb),which fails without the change.