API Documentation for TrajectorySaver

class TrajectorySaver(pdb_md, ligname, special, nucleic)

A class to handle the saving of molecular dynamics trajectory data for ligand–receptor complexes, with or without interacting water molecules.

Parameters:
  • pdb_md (mda.Universe) – An MDAnalysis Universe object containing the trajectory and topology.

  • ligname (str) – The residue name (3 letters) of the ligand in the PDB file.

  • special (str) – The residue name (3 letters) of any special ligand or cofactor (e.g., HEM) in the PDB file.

  • nucleic (bool) – Flag indicating if the receptor is nucleic acid (DNA/RNA). Used for proper atom selection.

save_interacting_waters_trajectory(interacting_waters, outputpath)

Saves .pdb and .dcd files of the trajectory containing ligand, receptor and all interacting waters.

Parameters:
  • interacting_waters (list) – List of all interacting water IDs.

  • outputpath (str) – Path to directory where output files will be saved (default: “./Visualization/”).

Returns:

None. This function writes output directly to a new PDB or DCD file and does not return anything.

Return type:

None

save_frame(frame, outpath, selection=False)

Saves a single frame of the trajectory to a file.

Parameters:
  • frame (int) – Index of the frame to save.

  • outpath (str) – Output path for the saved frame.

  • selection (str) – Optional atom selection string. If not provided, all atoms are included.