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

AlignTraj doesn't accept writer kwargs #4564

Closed
ljwoods2 opened this issue Apr 12, 2024 · 0 comments · Fixed by #4565
Closed

AlignTraj doesn't accept writer kwargs #4564

ljwoods2 opened this issue Apr 12, 2024 · 0 comments · Fixed by #4565

Comments

@ljwoods2
Copy link
Contributor

Expected behavior

When creating an aligned trajectory which is written to a file rather than stored in memory, I want to be able to pass in kwargs to the writer like I normally would when creating a writer object, but AlignTraj doesn't allow this.

Actual behavior

AlignTraj's init method creates a writer for the provided filename like this:

self._writer = mda.Writer(self.filename, natoms)

Code to reproduce the behavior

Example use case, when writing to h5md and you want the output file to be compressed.

from MDAnalysisTests.datafiles import COORDINATES_TOPOLOGY, COORDINATES_H5MD
from MDAnalysis.analysis import rms, align
import h5py

aligner = align.AlignTraj(u, ref,
                          select='protein and name CA',
                          filename='aligned_traj.h5md',
                          compression='gzip', compression_opts=9,
                          in_memory=False).run()
with h5py.File('aligned_traj.h5md', 'r') as f:
    print(f"{f["particles"]["trajectory"]["position"]["value"].compression}")

Current version of MDAnalysis

  • Which version are you using? (run python -c "import MDAnalysis as mda; print(mda.__version__)")
    2.8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants