-
Notifications
You must be signed in to change notification settings - Fork 15
Fix 375 and add support for writing trajectory frames to named files #377
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
Conversation
chryswoods
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Sorry not to have implemented it - the migration to the frame-based way of working required stubbed implementations on all the older IO classes. The Gro87 class never got the stub implemented...
|
No problem, it was very easy to add. I just wish I had thought to look there first, since it took me a while to backtrack my way via the trajectory code itself :-) |
This PR closes #375 by implementing the missing
SireIO::Gro87::getFrame()method. Previously, a nullFrame()object would be returned whenever a frame loaded from a Gro87 file was accessed, e.g. via aTrajectoryIterator.The PR also adds support for writing trajectory frames to user-defined filenames, rather than writing the output to a frame directory. This uses a
frame_namemap option, which then modifies the filename passed through toSireIO::MoleculeParser::writeToFile. This is mangling is required, sincewriteToFileis a static method. I've then wrapped the functionality in the new Sire API, allowing a user to pass a list of filenames tosire.savewhen the input (object to write) is aTrajectoryIterator. This allows the user to do things like:A unit test validates that the correct output is generated, and that appropriate exceptions are thrown when the input is malformed, i.e. the number of filenames not matching the number of frames in the
TrajectoryIterator, or there being a mismatch in the file extension between filenames.Just to note the diff looks a bit weird owing to the removal of
Gro87::operator[](int i), which now just returns an exception when used.develinto this branch before issuing this pull request (e.g. by runninggit pull origin devel): [y]