TrajectoryEnsemble
The TrajectoryEnsemble class both store
the information of simulations in the ensemble and preload it by
serialization. It can also apply on-the-fly transformations to the
trajectories and extract selected components (e.g. only protein)
to seperated files.
A TrajectoryEnsemble is created from files:
from ENPMDA.preprocessing import TrajectoryEnsemble
traj_ensemble = TrajectoryEnsemble(ensemble_name='ensemble',
topology_list=ensemble_top,
trajectory_list=ensemble_traj)
traj_ensemble.load_ensemble()
In order to add transformations e.g. wrap/unwrap, extra bonded_topology_list
is required as input to provide bonded information. Note the speed of
on-the-fly transformations is really slow for large systems and I
recommend patching https://github.com/MDAnalysis/mdanalysis/pull/3169
to your MDAnalysis installation. Alternatively, you can do trajectory
preprocessing in advance (with e.g. gmx trjconv) and use the output
trajectory while setting bonded_topology_list=None and only_raw=True.
Classes
- class ENPMDA.preprocessing.trajectory_preprocessing.TrajectoryEnsemble(ensemble_name: str, topology_list: list, trajectory_list: list, bonded_topology_list: list | None = None, skip: int = 1, timestamp: str = '20230328-081317', updating: bool = True, only_raw: bool = False, wrapping: bool = True, protein_selection: str = 'protein')[source]
Class to store an ensemble of simulations. It can also be used to apply transformations to the trajectory and either return the raw trajectory or the processed trajectory for protein and system.
Note
Each trajectory should be stored in its own folder.
Warning
If only_raw=False, protein.pdb, system.pdb, protein.xtc, and system.xtc files will be generated in the same folder as the loading trajectory.
- __init__(ensemble_name: str, topology_list: list, trajectory_list: list, bonded_topology_list: list | None = None, skip: int = 1, timestamp: str = '20230328-081317', updating: bool = True, only_raw: bool = False, wrapping: bool = True, protein_selection: str = 'protein')[source]
- Parameters:
ensemble_name (str) – The name of the ensemble. It will be used as the folder to save the pickled Universes. It can also be the absolute path to the folder.
topology_list (list) – List of topology files, e.g. gro, pdb, etc.
trajectory_list (list) – List of trajectory files, e.g. xtc, trr, etc.
bonded_topology_list (list, optional) – List of tpr files. For providing extra bonded information.
skip (int, optional) – The number of frame interval to skip. This number only applies to the processed trajectory. If you set only_raw=True, this skip number will be ignored.
timestamp (str, optional) – The timestamp of creating the ensemble It will be set to the current time if not provided.
updating (bool, optional) – If True, the trajectory will be updated even if the trajectory was processed before.
only_raw (bool, optional) – If True, only the raw trajectory will be returned. Otherwise, on-the-fly transformation will be applied to trajectories and processed trajectories for protein and system will be returned.
wrapping (bool, optional) – If True, all the atoms will be wrapped inside the box.
protein_selection (str, optional) – The selection string for protein.pdb. Default is “protein”. Can also be any selection string supported by MDAnalysis.
- property filename
The saving location of all the pickled files.