dcdParser¶
Classes¶
-
class
dcdParser.NAMDDCD(psfFile, dcdFile=None)¶ This class contains methods for trajectory file analysis.
It’s the second class to be called, after NAMDPSF. Here a dcd file is optional and can be added after initialization
Parameters: - psfFile – NAMD .psf file to be loaded
- dcdFile – NAMD .dcd file to be used
-
appendPDB(pdbFile)¶ Can be used to append a frame with coordinates from a pdb file.
Can be used even if no .dcd file was loaded.
Parameters: pdbFile – pdb file path
-
getAlignedCenterOfMass(selection='all', outSel=None, frames=slice(0, None, None))¶ This method aligns the center of mass of each frame to the origin. It does not perform any fitting for rotations, so that it can be used for center of mass drift corrections if no global angular momentum is present.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- outSel – if not None, move atoms from outSel based on center of mass of selection
- frames – either not given to select all frames, an int, or a slice object
-
getAlignedData(selection, outSel=None, frames=slice(0, None, None))¶ This method will fit all atoms between firstAtom and lastAtom for each frame between begin and end, using the first frame for the others to be fitted on.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- outSel – if not None, move atoms from this selection based transformation matrix obtained from selection
- frames – either not given to select all frames, an int, or a slice object
Returns: a similar array as the initial dataset but with aligned coordinates.
-
getCenterOfMass(selection, frames=slice(0, None, None))¶ Computes the center of mass for selected atoms and frames.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- frames – either not given to select all frames, an int, or a slice object
-
getDistances(sel1, sel2=None, frame=0)¶ Computes pair-wise distances between sel1 and sel2.
Parameters: - sel1 – first selection of atoms used for distance calculation with sel2 (default -> all)
- sel2 – second selection for distance calculation with sel1 (default -> all)
- frame – frame to be used for computation, if more than one frame is used, the returned array contains distances averaged over all selected frames.
Returns: a matrix containing pairwise distances, if memory allows it, with sel1 being arranged row-wise and sel2 column-wise.
-
getGyrationRadius(selection='protein', frames=slice(0, None, None))¶ Computes the radius of gyration for the given selection and frames.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- frames – if True, will try to align all atoms to the ones on the first frame
-
getPBC(selection='all', frames=slice(0, None, None))¶ This method applies periodic boundary conditions on all selected atom coordinates for each frame selected.
-
getProtVolume(selection='protein', frame=0)¶ Computes an approximate volume of the protein by summing the volume of each amino acids in the provided selection.
Parameters: - selection – selection to be used. Should be obviously a protein.
- frame – frame to be used to compute the volume
- volType – type of volume to be used, either ‘IMGT’ (from imgt.org), ‘hard-sphere’ or ‘vdW’ (the latter standing for van der Waals volume)
Returns: the volume in \(\AA^3\)
References:
[1] http://proteinsandproteomics.org/content/free/tables_1/table08.pdf [2] http://www.imgt.org/IMGTeducation/Aide-memoire/_UK/aminoacids/abbreviation.html#refs
-
getRMSDperAtom(selection='all', alignCOM=True, align=False, frames=slice(0, None, None))¶ Computes the RMSD for each atom in selection and for frames between begin and end.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- alignCOM – if True, will try to align the center of mass of the selection to the first frame
- align – if True, will try to align all atoms to the ones on the first frame
- frames – either not given to select all frames, an int, or a slice object
Returns: the RMSD averaged over time.
-
getRMSDperFrame(selection='all', alignCOM=True, align=False, frames=slice(0, None, None))¶ Computes the RMSD for each atom in selection and for frames between begin and end.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- alignCOM – if True, will try to align the center of mass of the selection to the first frame
- align – if True, will try to align all atoms to the ones on the first frame
- frames – either not given to select all frames, an int, or a slice object
Returns: the RMSD averaged over all selected atoms.
-
getRMSDperResidue(selection='protein', alignCOM=True, align=False, frames=slice(0, None, None))¶ Computes the RMSD for each residue in selection and for selected frames.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- alignCOM – if True, will try to align the center of mass of the selection to the first frame
- align – if True, will try to align all atoms to the ones on the first frame
- frames – either not given to select all frames, an int, or a slice object
Returns: the RMSD averaged over time.
-
getSTDperAtom(selection='all', align=False, frames=slice(0, None, None), mergeXYZ=True)¶ Computes the standard deviation for each atom in selection and averaged over selected frames.
Parameters: - selection – selected atom, can be a single string or a list of atom indices
- align – if True, will try to align all atoms to the ones on the first frame
- end – last frame to be used + 1
- mergeXYZ – if True, uses the vector from the origin instead of each projections
Returns: the standard deviation averaged over time.
-
getSpecVolume(selection='protein', frame=0)¶ Estimates protein specific volume based on volume estimation.
Parameters: - selection – selection to be used. Should be obviously a protein.
- frame – frame to be used to compute the volume
- volType – type of volume to be used, either ‘hard-sphere’ or ‘vdW’ (the latter standing for van der Waals volume)
Returns: the specific volume in \(\cm^3 / g\)
-
getWithin(distance, refSel, outSel='all', frame=0)¶ Selects all atoms that within the given distance of the given selection and frame.
Parameters: - distance – distance in angstrom, within which to select atoms
- refSel – initial selection from which distance should be computed
- outSel – atoms to keep in output, all others won’t be considered for computation
- frame – frame to be used for atom selection, can be str, int, range or slice
Returns: an array of boolean, set to 1 for each selected atom in simulation in each selected frame. If the second dimension of the array is one, the output is flattened, and atom indices are returned directly.
-
getWithinCOM(distance, COM, outSel=None, frame=0, getSameResid=False)¶ Selects all atoms that within the given distance of the given selection and frame.
Parameters: - distance – distance in angstrom, within which to select atoms
- COM – Center of mass for the desired frame
- outSel – specific selection for output. If not None, after all atoms within the given distance have been selected, the selected can be restricted further using a keyword or a list of indices. Only atoms that are present in the ‘within’ list and in the ‘outSel’ list are returned.
- frame – frame number to be used for atom selection
- getSameResid – if True, select all atoms in the same residue before returning the list
Returns: list of selected atom indices.
-
plotAveragedDistances_chordDiagram(sel1, sel2=None, frames=None, startDist=None, maxDist=10, step=2, lwStep=1.2, resList=None, labelStep=5)¶ Computes averaged distances between sel1 and sel2, then plot the result on a chord diagram in a residue-wise manner.
Both selections need to be the same for all frames used, so ‘within’ keyword cannot be used here.
Parameters: - sel1 – first selection of atoms for ditance computation
- sel2 – second selection of atoms (optional, if None, sel1 is used)
- frames – frames to be used for averaging
- maxDist – maximum distance to use for the plot
- step – step between each distance bin, each of them will be plotted on a color and line width scale.
- lwStep – line width step for plotting, each bin will be plotted with a linewidth being ( maxDist / bin max edge ) * lwStep
- resList – list of residue indices (optional, if None, will be guessed from file)
- labelStep – step for residue labels (optional, default 5, each 5 residue are indicated)
-
plotAveragedDistances_parallelPlot(sel1, sel2=None, frames=None, startDist=None, maxDist=10, step=2, lwStep=0.8)¶ Computes averaged distances between sel1 and sel2, then plot the result on a parallel plot in a residue-wise manner.
Both selections need to be the same for all frames used, so ‘within’ keyword cannot be used here.
Parameters: - sel1 – first selection of atoms for ditance computation
- sel2 – second selection of atoms (optional, if None, sel1 is used)
- frames – frames to be used for averaging
- maxDist – maximum distance to use for the plot
- step – step between each distance bin, each of them will be plotted on a color and line width scale.
- lwStep – line width step for plotting, each bin will be plotted with a linewidth being (maxDist / bin max edge) * lwStep
-
plotRMSDperAtom(selection='all', alignCOM=True, align=False, frames=slice(0, None, None))¶ Plot the RMSD along the axis 0 of dataset. This makes use of the
getRMSDperAtom()method.
-
plotRMSDperFrame(selection='all', alignCOM=True, align=False, frames=slice(0, None, None))¶ Plot the RMSD along the axis 1 of dataset. This makes use of the
getRMSDperFrame()method.
-
plotRMSDperResidue(selection='all', alignCOM=True, align=False, frames=slice(0, None, None))¶ Plot the RMSD along the axis 0 of dataset. This makes use of the
getRMSDperAtom()method.
-
plotSTDperAtom(selection='all', align=False, frames=slice(0, None, None), mergeXYZ=True)¶ Plot the standard deviation along the axis 0 of dataset. This makes use of the
getSTDperAtom()method.If mergeXYZ is True, then computes the distance to the origin first.
-
rotate(rotVec, selection, frames=slice(0, None, None))¶ This method allows to rotate the given selection using the angle/axis representation given by rotVec, whose coordinates represent the axis of rotation and norm gives the rotation magnitude in radians.
Parameters: - rotVec (np.ndarray) – a rotation vector in 3D cartesian coordinates as described above
- selection – either string or array of indices, will be used for fitting
- frames – either not given to select all frames, an int, or a slice object