Repository navigation
Open
Description
The Atom class only supports atom/element charges for PQR file formats. However, charges can also be indicated at the very end of a line in PDB files such as in this example:
ATOM 1 N THR A 1 -17.147 31.805 -43.528 1.00 0.46 N1+
ATOM 2 CA THR A 1 -16.216 32.474 -44.490 1.00 0.36 C
ATOM 3 C THR A 1 -16.975 33.523 -45.343 1.00 0.50 C
ATOM 4 O THR A 1 -18.168 33.675 -45.098 1.00 2.69 O
ATOM 5 CB THR A 1 -15.438 31.456 -45.363 1.00 0.49 C
ATOM 6 OG1 THR A 1 -14.437 32.141 -46.087 1.00 0.32 O
ATOM 7 CG2 THR A 1 -16.316 30.680 -46.351 1.00 0.87 C
ATOM 8 H1 THR A 1 -17.884 31.341 -44.040 1.00 0.46 H
ATOM 9 H2 THR A 1 -17.550 32.498 -42.913 1.00 0.46 H
ATOM 10 H3 THR A 1 -16.637 31.126 -42.981 1.00 0.46 H
ATOM 11 HA THR A 1 -15.473 33.038 -43.923 1.00 0.36 H
ATOM 12 HB THR A 1 -14.950 30.738 -44.701 1.00 0.49 H
ATOM 13 HG21 THR A 1 -17.262 30.381 -45.905 1.00 0.87 H
ATOM 14 HG22 THR A 1 -16.512 31.288 -47.236 1.00 0.87 H
ATOM 15 HG23 THR A 1 -15.797 29.774 -46.667 1.00 0.87 H
ATOM 16 HG1 THR A 1 -14.113 31.574 -46.824 1.00 0.32 H
TER 17 THR A 1
END
If the above PDB file gets loaded into Biopython and subsequently exported as PDB the atom/element charge information is lost.
Expected behaviour
I would expect the 1+ charge at the end of the first line to be preserved:
ATOM 1 N THR A 1 -17.147 31.805 -43.528 1.00 0.46 N1+
ATOM 2 CA THR A 1 -16.216 32.474 -44.490 1.00 0.36 C
ATOM 3 C THR A 1 -16.975 33.523 -45.343 1.00 0.50 C
ATOM 4 O THR A 1 -18.168 33.675 -45.098 1.00 2.69 O
ATOM 5 CB THR A 1 -15.438 31.456 -45.363 1.00 0.49 C
ATOM 6 OG1 THR A 1 -14.437 32.141 -46.087 1.00 0.32 O
ATOM 7 CG2 THR A 1 -16.316 30.680 -46.351 1.00 0.87 C
ATOM 8 H1 THR A 1 -17.884 31.341 -44.040 1.00 0.46 H
ATOM 9 H2 THR A 1 -17.550 32.498 -42.913 1.00 0.46 H
ATOM 10 H3 THR A 1 -16.637 31.126 -42.981 1.00 0.46 H
ATOM 11 HA THR A 1 -15.473 33.038 -43.923 1.00 0.36 H
ATOM 12 HB THR A 1 -14.950 30.738 -44.701 1.00 0.49 H
ATOM 13 HG21 THR A 1 -17.262 30.381 -45.905 1.00 0.87 H
ATOM 14 HG22 THR A 1 -16.512 31.288 -47.236 1.00 0.87 H
ATOM 15 HG23 THR A 1 -15.797 29.774 -46.667 1.00 0.87 H
ATOM 16 HG1 THR A 1 -14.113 31.574 -46.824 1.00 0.32 H
TER 17 THR A 1
END
Actual behaviour
However, with the current biopython the charge disappears:
ATOM 1 N THR A 1 -17.147 31.805 -43.528 1.00 0.46 N
ATOM 2 CA THR A 1 -16.216 32.474 -44.490 1.00 0.36 C
ATOM 3 C THR A 1 -16.975 33.523 -45.343 1.00 0.50 C
ATOM 4 O THR A 1 -18.168 33.675 -45.098 1.00 2.69 O
ATOM 5 CB THR A 1 -15.438 31.456 -45.363 1.00 0.49 C
ATOM 6 OG1 THR A 1 -14.437 32.141 -46.087 1.00 0.32 O
ATOM 7 CG2 THR A 1 -16.316 30.680 -46.351 1.00 0.87 C
ATOM 8 H1 THR A 1 -17.884 31.341 -44.040 1.00 0.46 H
ATOM 9 H2 THR A 1 -17.550 32.498 -42.913 1.00 0.46 H
ATOM 10 H3 THR A 1 -16.637 31.126 -42.981 1.00 0.46 H
ATOM 11 HA THR A 1 -15.473 33.038 -43.923 1.00 0.36 H
ATOM 12 HB THR A 1 -14.950 30.738 -44.701 1.00 0.49 H
ATOM 13 HG21 THR A 1 -17.262 30.381 -45.905 1.00 0.87 H
ATOM 14 HG22 THR A 1 -16.512 31.288 -47.236 1.00 0.87 H
ATOM 15 HG23 THR A 1 -15.797 29.774 -46.667 1.00 0.87 H
ATOM 16 HG1 THR A 1 -14.113 31.574 -46.824 1.00 0.32 H
TER 17 THR A 1
END
Steps to reproduce
Here's the example file example.txt - unfortunately in .txt format since Github doesn't allow me to upload .pdb file. After downloading it you can simply rename it to example.pdb.
Then run:
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.PDBIO import from PDBIO
structure = PDBParser().get_structure("example-file", "example.pdb")
io = PDBIO()
io.set_structure(structure)
io.save("example-out.pdb")If you now inspect example-out.pdb it won't contain the 1+ charge on the nitrogen atom.
Metadata
Metadata
Assignees
Labels
No labels
Activity
peterjc commentedon Feb 9, 2022
Is this an official PDB extension? Does the mmCIF format also have changes?
markf94 commentedon Feb 11, 2022
The charge column has always been part of the official PDB format as outlined here:
http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM
(see COLUMNS 79-80 -> Charge on the atom)
I have not worked with a lot of mmCIF files so far so I don't know how that format handles this.
peterjc commentedon Feb 11, 2022
Thanks - I've not worked with PDB files for years, but that is a curious omission in the Biopython parser.
markf94 commentedon Feb 11, 2022
Fix is waiting for review in #3857