-
Notifications
You must be signed in to change notification settings - Fork 749
Description
Background
The 0.11.0 release will break the API in many places (see also the Release Notes for 0.11.0):
| Issue | API Changes |
|---|---|
| #250 & #252 | Summary of Timestep API changes |
| #310 | frame numbers start at 0 instead of 1 |
| #308 | time is now a property of Timestep and not of the trajectory reader |
| #287 | Summary of reorganization of modules (MDAnalysis.lib) |
| #372 | Many AtomGroup methods were changed to properties (and some were renamed) |
| #376 | AtomGroup.numberOfAtoms() (and similar methods for residues and segments) is now a property AtomGroup.n_atoms; likewise, Universe.trajectory.numatoms and .numframes are now .n_atoms and .n_frames, respectively. |
| #389 | AtomGroup.selectAtoms() to AtomGroup.select_atoms() (and same for Universe.selectAtoms() |
| #373 | calculating of bond, angle and dihedral values from 2,3, or 4-member AtomGroups will change |
| #385 | AtomGroup.resids (and segids) will return an array the size of the AtomGroup; the old behavior will be obtained with AtomGroup.residues.resids; likewise ResidueGroup.segids will return an array the size of the ResidueGroup |
| #406 | AtomGroup.set_<property> are now pluralized to match the property names, where they were once singular. e.g. ag.set_resnum is now ag.set_resnums, ag.set_radius is now ag.set_radii. |
ten2eleven.py script
In order to ease the burden on users we would like to have a script ten2eleven.py that aids the user in the translation of Python code to the new syntax. That might not always be possible but some (tedious) changes could likely be automated.
This should be somewhat similar to the py2to3 script.
Specifications
-
The script should take a python source file as input and write out an altered version of the file.
- Optionally, it should run recursively on a directory and change all py files in the directory.
- Optionally, it should write all changed files to a new target directory and replicate the original directory structure in the target directory.
-
Automatically do substitutions and renamings like the following:
ag.residues() → ag.residues atom.number → atom.index import MDAnalysis.core.qcprot → import MDAnalysis.lib.qcprot(We need a complete list of substitutions – please add to this issue report!)
-
It would also be desirable to flag pieces of code that should be manually inspected, e.g. anything related to
ts.frame. Optionally, it should insert comment lines in places that should be inspected. -
It should keep a backup file of the original file and it should never overwrite the backup files.