LOOS  v2.3.2
loos.pyloos.trajectories.Trajectory Class Reference

Python-based wrapper for LOOS Trajectories This class turns a loos Trajectory into something more python-like. More...

Inheritance diagram for loos.pyloos.trajectories.Trajectory:
Collaboration diagram for loos.pyloos.trajectories.Trajectory:

Public Member Functions

def __init__ (self, fname, model, kwargs)
 Instantiate a Trajectory object. More...
def stride (self, n)
def skip (self, n)
def fileName (self)
def setSubset (self, selection)
def __iter__ (self)
def __len__ (self)
def reset (self)
def next (self)
def trajectory (self)
def model (self)
def readFrame (self, i)
def frame (self)
def realIndex (self)
def index (self)
def frameNumber (self, i)
def __getitem__ (self, i)

Detailed Description

Python-based wrapper for LOOS Trajectories This class turns a loos Trajectory into something more python-like.

Behind the scenes, it wraps a loos::AtomicGroup and a loos::Trajectory. The behavior of the trajectory can be controlled through passed keywords,

Keyword Description
skip=n Skip the first n-frames of the wrapped trajectory
stride=n Step through the wrapped trajectory n-frames at a time
iterator=i Use the python iterator object i to select frames from the wrapped trajectory
subset=s Use 's' to select a subset of the model to use for each frame

Remember that all atoms are shared. If you want to decouple the trajectory from other groups, pass it a copy of the model.


1 model = loos.createSystem('foo.pdb')
2 traj = loos.pyloos.Trajectory('foo.dcd', model)
3 calphas = loos.selectAtoms(model, 'name == "CA"')
4 for frame in traj:
5  print calphas.centroid()

The same thing but skipping the first 50 frames and taking every other frame

1 traj = loos.pyloos.Trajectory('foo.dcd', model, skip=50, stride=2)

Only use frames 19-39 (i.e. the 20th through 40th frames)

1 traj = loos.pyloos.Trajectory('foo.dcd', model, iterator=range(19,40))

An alternative way of only iterating over a subset...

1 model = loos.createSystem('foo.pdb')
2 traj = loos.pyloos.Trajectory('foo.dcd', model, subset='name == "CA"')

Decouple the model stored in the trajectory,

1 traj = loos.pyloos.Trajectory('foo.dcd', model.copy())
Python-based wrapper for LOOS Trajectories
>>> model = loos.createSystem('foo.pdb')
>>> traj = loos.pyloos.Trajectory('foo.dcd', model)

keyword args:
    skip = # of frames to skip from start
  stride = # of frames to step through
iterator = Python iterator used to pick frame (overrides skip and stride)
  subset = Selection used to pick subset for each frame

See the Doxygen documentation for more details.

Definition at line 55 of file trajectories.py.

Constructor & Destructor Documentation

def loos.pyloos.trajectories.Trajectory.__init__ (   self,

Instantiate a Trajectory object.

Definition at line 71 of file trajectories.py.

Member Function Documentation

def loos.pyloos.trajectories.Trajectory.__getitem__ (   self,
Handle array indexing and slicing.  Negative indices are
relative to the end of the trajectory

Definition at line 234 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.__len__ (   self)
Number of frames in the trajectory

Definition at line 141 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.fileName (   self)
Return the filename that this Trajectory represents

Definition at line 121 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.frame (   self)
Return the current frame (subset)

Definition at line 181 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.frameNumber (   self,
Returns the real frame numbers corresponding to the passed indices.  Can accept
either an integer or a list of integers.

For example:
>>> t = loos.pyloos.Trajectory('foo.dcd', model, skip=50)
>>> t.frameNumber(0)
>>> t.frameNumber(range(0,2))
[50, 51]

Definition at line 196 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.index (   self)
The state of the iterator

Definition at line 191 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.model (   self)
Return the current model

Definition at line 167 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.readFrame (   self,
Read a frame and update the model

Definition at line 171 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.realIndex (   self)
The 'real' frame in the trajectory for this index

Definition at line 185 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.reset (   self)
Reset the iterator

Definition at line 150 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.setSubset (   self,
Set the subset used when iterating over a trajectory.
The selection is a LOOS selection string.

Definition at line 127 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.skip (   self,
Skip this number of frames at the start of the trajectory

Definition at line 115 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.stride (   self,
Step through the trajectory by this number of frames

Definition at line 109 of file trajectories.py.

def loos.pyloos.trajectories.Trajectory.trajectory (   self)
Access the wrapped loos.Trajectory

Definition at line 163 of file trajectories.py.

The documentation for this class was generated from the following file: