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

enable writing PDB files with original serial number #1899

Closed
orbeckst opened this issue May 15, 2018 · 3 comments
Closed

enable writing PDB files with original serial number #1899

orbeckst opened this issue May 15, 2018 · 3 comments

Comments

@orbeckst
Copy link
Member

orbeckst commented May 15, 2018

Expected behaviour

For some applications, namely rmsd calculation in PLUMED2, one needs to provide a PDB file with the original ATOM serial numbers. The MDAnalysis PDBWriter should have a kwarg keep_serials (or similar) to keep the ATOM serial numbers from the topology when a subselection is written.

For instance if I want to fit on the CA only (but compute the RMSD for all heavy atoms I would like to do:

u = mda.Universe(topol, structure)
u.add_TopologyAttr("tempfactors")
u.add_TopologyAttr("occupancies")

# calculate RMSD for all heavy atoms
protein_heavy = u.select_atoms("protein and not name H*")
protein_heavy.tempfactors = 1.0

# RMSD fit on C-alphas
ca = protein_heavy.select_atoms("name CA")
ca.occupancies = 1.0

# write file ONLY with atoms of interest (instead of everything with lots
# of zeros in the tempfactors and occupancies)
protein_heavy.write("reference.pdb", keep_serials=True)

The output file will only contain the protein heavy atoms but not the hydrogens (and the rest of the system). The heavy atoms should have the same serial number as in the topology.

Actual behaviour

The serial number in the sub selection always starts at 1 and is incremented sequentially.

Currently version of MDAnalysis:

0.18.1-dev

@orbeckst
Copy link
Member Author

Btw, our PDBWriter does not consider bfactors equivalent to tempfactors; when using bfactors it complains that it does not have tempfactors.

@richardjgowers
Copy link
Member

@orbeckst duplicate of #1072?

@orbeckst
Copy link
Member Author

Yes, duplicates #1072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants