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

Get PDBWriter to follow standard for ATOM/HETATM #2826

Open
IAlibay opened this issue Jul 7, 2020 · 3 comments
Open

Get PDBWriter to follow standard for ATOM/HETATM #2826

IAlibay opened this issue Jul 7, 2020 · 3 comments

Comments

@IAlibay
Copy link
Member

IAlibay commented Jul 7, 2020

Related to #1753

Is your feature request related to a problem?

Currently the PDB writer will always write out every single residue with an ATOM record type.

This is causing some issues downstream where we pass PDB files written by MDA to propka (Becksteinlab/propkatraj#24)

My interpretation of the PDBv3 standard is that standard amino acids and nucleotides are written as ATOM records, everything else is a HETATM (https://www.wwpdb.org/documentation/file-format-content/format33/sect9.html).

Describe the solution you'd like

As a first step, default to writing ATOM records if atoms belong to a residue that is included in the standard, otherwise write a HETATM record. Then we could expand to expand to the suggestions in #1753?

Describe alternatives you've considered

The alternative is that we use one of the converters downstream, but it would be nice to have a standard compliant PDB writer.

@Luthaf
Copy link
Contributor

Luthaf commented Jul 7, 2020

You can try to use chemfiles PDB writer instead (using format='CHEMFILES'), which should deal with this specific issue. If you do try it, let me know how it goes!

@IAlibay
Copy link
Member Author

IAlibay commented Jul 7, 2020

Thanks @Luthaf. I did try chemfiles unfortunately there's a deeper issue with NamedStream objects that I haven't been able to get to the bottom of yet. i.e. the following will fail:

pstream = mda.lib.util.NamedStream(StringIO(), 'file.pdb')
with ChemfilesWriter(pstream, chemfiles_format='PDB') as w:
  w.write(ag)
pstream.reset()

Either way, I think the MDA PDB writer needs fixing. Indeed the fact that chemfiles' writer differs in behaviour is an even bigger reason. In my opinion, any way that a user tries to write out a given file format with MDA should yield the same answer.

@Luthaf
Copy link
Contributor

Luthaf commented Jul 7, 2020

Yes, since chemfiles uses its own C++ code to write to files and not standard python file objects, I would expect such code to fail. This is something I might be able to fix with the next release which introduces in-memory reading/writing.

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