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

Output PDB stings are not ordered by atom number. #4

Open
ChrisWellsWood opened this issue Feb 18, 2019 · 1 comment
Open

Output PDB stings are not ordered by atom number. #4

ChrisWellsWood opened this issue Feb 18, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ChrisWellsWood
Copy link
Contributor

Details

Currently the output sting for the PDB has atom lines ordered by their occurence in the AMPAL object. This causes problems with some software as atoms are normally ordered by atom number.

Minimal Example

import ampal
import random

st = ampal.load_pdb('tests/testing_files/1ubq.pdb')
random.shuffle(st[0]._monomers)
print(st.pdb)

OUTPUT

HEADER ISAMBARD Model 1ubq                                                             
ATOM    447  N   ASP A  58      22.997  17.978  14.366  1.00  9.11           N  
ATOM    448  CA  ASP A  58      22.418  17.638  15.693  1.00  7.91           C  
ATOM    449  C   ASP A  58      21.460  18.737  16.163  1.00  9.12           C  
ATOM    450  O   ASP A  58      20.497  18.506  16.900  1.00  8.61           O  
ATOM    451  CB  ASP A  58      23.461  17.331  16.741  1.00  8.41           C  
ATOM    452  CG  ASP A  58      24.184  16.016  16.619  1.00 11.50           C  
ATOM    453  OD1 ASP A  58      25.303  15.894  17.152  1.00 10.05           O  
ATOM    454  OD2 ASP A  58      23.572  15.107  15.975  1.00 11.70           O  
ATOM    403  N   ASP A  52      31.233  21.090  21.459  1.00 12.71           N  
ATOM    404  CA  ASP A  52      32.262  20.670  20.514  1.00 16.56           C  
ATOM    405  C   ASP A  52      32.128  19.364  19.750  1.00 15.83           C  
ATOM    406  O   ASP A  52      32.546  19.317  18.558  1.00 17.21           O  
ATOM    407  CB  ASP A  52      33.638  20.716  21.242  1.00 21.05           C  
ATOM    408  CG  ASP A  52      34.174  22.129  21.354  1.00 25.12           C  
ATOM    409  OD1 ASP A  52      35.252  22.322  21.958  1.00 28.37           O  
ATOM    410  OD2 ASP A  52      33.544  23.086  20.883  1.00 25.82           O  
...

Proposed Solution

Reorder atoms by atom number in make_pdb method. Preserve the order in the AMPAL object.

@ChrisWellsWood ChrisWellsWood added the bug Something isn't working label Feb 18, 2019
@ChrisWellsWood ChrisWellsWood self-assigned this Feb 18, 2019
@ChrisWellsWood
Copy link
Contributor Author

@Drew-Thomson After taking a look at the atom ordering in the PDB string, I'm going to make a new function that takes a list of atoms and returns the PDB string. The old write_pdb function that does this currently isn't flexible enough to handle this for weird historic reasons. I'll make the new function available at the top level and make a deprecation warning that the old method will be removed in a future release. How does that sound?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant