Biskit :: EnsembleTraj :: EnsembleTraj :: Class EnsembleTraj
[hide private]
[frames] | no frames]

Class EnsembleTraj

source code


Multiple copy trajectory. The order of the frame names is assumed to be as follows:
 time0_member1, time0_member2, .., time1_member1, time1_member2, ..
 i.e. frames must be sorted first by time then by member. 


Instance Methods [hide private]
  __init__(self, pdbs=None, refpdb=None, n_members=10, **kw)
Create EnsembleTraj from PDB files or pickled PDBModels.
str version(self)
Version of class.
  replaceContent(self, traj)
Replace content of this trajectory by content of given traj.
EnsembleTraj thin(self, step=1)
Keep only each step'th frame from trajectory with 10 ensemble members.
[trajectory] memberList(self, step=1)
Extract ensemble member Trajectories.
[int] memberIndices(self, member, step=1)
List of frame indices for this member:
[1|0] memberMask(self, member)
Get mask for all frames belonging to a given ensemble member.
Trajectory takeFrames(self, indices)
Return a copy of the trajectory containing only the specified frames.
Trajectory takeMember(self, i)
Take all frames belonging to member:
EnsembleTraj takeMembers(self, mIndices)
Take all frames belonging to the members in mIndices:
  concatEnsembles(self, *traj)
Concatenate this with other trajectories in a zig zac manner, resulting in an ensembleTraj with additional members.
EnsembleTraj compressMembers(self, mask)
Apply mask to member trajectories.
  keepMembers(self, indices)
in-place version of takeMembers.
  removeMembers(self, indices)
Remove given member trajectories from this ensemble.
  resetFrameNames(self)
Reset frame names to t_00_m_00 ..
[int] argsortMember(self, inverse_time=0, inverse_member=0, step=1)
Get list of frame indices sorted first by member, then by time (unlike the normal sorting of EnsembleTraj, which is first by time then by member).
biggles.FramedArray() plotMemberProfiles(self, *name, **arg)
Plot profiles of all member trajectories seperately:
  fitMembers(self, refIndex=None, refModel=None, mask=None, n_it=1, prof='rms', verbose=1, **profInfos)
RMSD-fit each member trajectory seperately onto one of its frames or its average structure.
  blockFit(self, ref=None, mask=None)
RMSD-fit the average of each member trajectory (i.e.
[0|1] outliers(self, z=1.0, mask=None, prof='rmsCA_last', last=10, step=1, verbose=1)
Identify outlier trajectories.

Inherited from Trajectory.Trajectory: __getitem__, __getstate__, __len__, __setstate__, argsortFrames, atomMask, avgModel, blockFit2ref, clone, compressAtoms, compressFrames, concat, concatAtoms, fit, getFluct_global, getFluct_local, getGammaFluct, getPDBModel, getPca, getRef, getResFluct, keepAtoms, keepFrames, lenAtoms, lenFrames, pairwiseRmsd, pcMovie, pca, plotProfile, profile, profile2mask, profileInfo, removeAtoms, removeFrames, resMap, residusMaximus, setProfile, setProfileInfo, setRef, sortAtoms, sortFrames, takeAtoms, takeChains, transform, writeCrd, writePdb, writePdbs


Class Variables [hide private]

Inherited from Trajectory.Trajectory: ex_numbers


Method Details [hide private]

__init__(self, pdbs=None, refpdb=None, n_members=10, **kw)
(Constructor)

source code 

Create EnsembleTraj from PDB files or pickled PDBModels. The file names are used for alphabetical sorting and must lead to an ordering first by time then by member (i.e. frame_10_01.pdb where 10 is the time step and 01 is the member index). Unlike normal alphabetical order, frame_2_2 sorts before frame_10_10, i.e. we attempt to interprete numbers contained in the frame name strings.
Parameters:
  • pdbs ([ str ] OR [ PDBModel ]) - file names of all conformations OR PDBModels
  • refpdb (str) - file name of reference pdb
  • n_members (int) - number or tjajectories in the ensemble
  • kw (key=value) - optional key=value pairs, see Biskit.Trajectory.
Raises:
Overrides: Trajectory.Trajectory.__init__

version(self)

source code 

Version of class.
Returns: str
version
Overrides: Trajectory.Trajectory.version

replaceContent(self, traj)

source code 

Replace content of this trajectory by content of given traj. No deep-copying, only references are taken.
Parameters:
  • traj (trajectory) - trajectory
Overrides: Trajectory.Trajectory.replaceContent

Note: Overrides Trajectory method.

thin(self, step=1)

source code 

Keep only each step'th frame from trajectory with 10 ensemble members.
Parameters:
  • step (int) - 1..keep all frames, 2..skip first and every second, .. (default: 1)
Returns: EnsembleTraj
reduced EnsembleTraj

memberList(self, step=1)

source code 

Extract ensemble member Trajectories.
Parameters:
  • step (int) - leave out each step-1 frame (for each ensemble member) (default: 1)
Returns: [trajectory]
[EnsembleTraj] i.e. [ traj_member1, traj_member2, .. traj_member10 ]

To Do: cast member Trajectories back to normal Trajectory object

memberIndices(self, member, step=1)

source code 

List of frame indices for this member:
 memberIndices( int_member, [int_step] )
Parameters:
  • member (int) - member trajectory
  • step (int) - return only every i'th frame (default: 1)
Returns: [int]
indices for members

memberMask(self, member)

source code 

Get mask for all frames belonging to a given ensemble member.
Parameters:
  • member (int) - member index starting with 0
Returns: [1|0]
member mask, N.array( N_frames x 1) of 1||0

takeFrames(self, indices)

source code 

Return a copy of the trajectory containing only the specified frames.
Parameters:
  • indices ([int]) - positions to take
Returns: Trajectory
copy of this Trajectory (fewer frames, semi-deep copy of ref)
Overrides: Trajectory.Trajectory.takeFrames

takeMember(self, i)

source code 

Take all frames belonging to member:
 takeMember( int ) -> EnsembleTraj, single member trajectory
Parameters:
  • i (int) - member trajectory
Returns: Trajectory
trajectory containing member i

takeMembers(self, mIndices)

source code 

Take all frames belonging to the members in mIndices:
 takeMembers( mIndices ) -> EnsembleTraj with frames of given members
Parameters:
  • mIndices ([int] OR array('i')) - list of member indices
Returns: EnsembleTraj
EnsembleTraj with specified members

To Do: return self.__class__ instead of EnsembleTraj

concatEnsembles(self, *traj)

source code 

Concatenate this with other trajectories in a zig zac manner, resulting in an ensembleTraj with additional members. The ref model of the new Trajectory is a 'semi-deep' copy of this trajectorie's model.(see PDBModel.take() ):
 concat( traj [, traj2, traj3, ..] ) -> Trajectory
Parameters:
  • traj (one or more EnsembleTrajectory) - with identical atoms as this one

To Do: fix so that pc, and profiles are not lost

compressMembers(self, mask)

source code 

Apply mask to member trajectories.
Parameters:
  • mask ([1|0]) - positions in trajectory list to keep or remove
Returns: EnsembleTraj
compressed EnsembleTraj

keepMembers(self, indices)

source code 

in-place version of takeMembers. keepMembers( indices ) -> None
Parameters:
  • indices ([int]) - member numbers

removeMembers(self, indices)

source code 

Remove given member trajectories from this ensemble.
Parameters:
  • indices ([int]) - trajectory (member) numbers

resetFrameNames(self)

source code 

Reset frame names to t_00_m_00 .. t_50_m_10.

argsortMember(self, inverse_time=0, inverse_member=0, step=1)

source code 

Get list of frame indices sorted first by member, then by time (unlike the normal sorting of EnsembleTraj, which is first by time then by member). Default is ascending order (first frame is first time step of member 0).
Parameters:
  • inverse_time (1|0) - descending time order (last frame first) (default: 0)
  • inverse_member (1|0) - descending member order (last member first) (default: 0)
  • step (int) - take only every step frame (default: 1)
Returns: [int]
length is N_frames (only if step is 1 )

plotMemberProfiles(self, *name, **arg)

source code 

Plot profiles of all member trajectories seperately:
 plotMemberProfiles( name1, [name2, .. ],[ arg1=x,..])
   -> biggles.Table
Parameters:
  • name (str) - profile name(s)
  • arg (key=value) - pairs for biggles.Curve() and/or xlabel=..,ylabel=..
Returns: biggles.FramedArray()
biggles plot object

fitMembers(self, refIndex=None, refModel=None, mask=None, n_it=1, prof='rms', verbose=1, **profInfos)

source code 

RMSD-fit each member trajectory seperately onto one of its frames or its average structure.
Parameters:
  • refIndex (int OR None) - index of reference frame within member traj. If None -> fit to average coordinates (if refModel == None)
  • refModel (PDBModel) - fit to this structure (default: None)
  • mask ([1|0] OR None) - atoms to consider (default: None, all heavy)
  • n_it (1|0) - number of fit iterations, kicking out outliers on the way (default: 1):
     1 -> classic single fit,
     0 -> until convergence
    
  • prof (str) - save rms per frame in profile of this name (default: rms)
  • profInfos (key=value) - description key-value pairs for profile

blockFit(self, ref=None, mask=None)

source code 

RMSD-fit the average of each member trajectory (i.e. the trajectory en block) onto the overall average (default) or a given structure.
Parameters:
  • ref (PDBModel) - reference structure (default: average structure)
  • mask ([1|0] OR None) - atoms to consider (default: None, all heavy)

outliers(self, z=1.0, mask=None, prof='rmsCA_last', last=10, step=1, verbose=1)

source code 

Identify outlier trajectories. First we calculate the CA-RMS of every |step|th frame to the last frame. Outliers are member trajectories for which the slope of this rms profile is z standard deviations below the mean of all members.
Parameters:
  • z (float) - z-value threshold
  • mask ([int]) - atom mask used (default: ref.maskCA())
  • prof (str) - name of pre-calculated profile to use (default: 'rmsCA_last')
  • last (int) - skip |last| last frames from linear regression
  • step (int) - frame offset
Returns: [0|1]
member mask of outlier trajectories