That’s a common approach (for instance, the MDAnalysis.analysis.hole module uses it).
Even better would be a “pydssp” package that provides a Python interface to the DSSP algorithm. If I had the time, I would use the open source sources for DSSP and try to write a simple DSSP library (either C++ or Cython) with a generic Python interface that would be easy to use from MDAnalysis (and any other code that wants to use it).
But in the meantime, something like
protein = u.select_atoms(“protein”)
pdbfile = “temporary.pdb”
data = []
with mda.Writer(pdbfile, “w”) as W:
for ts in u.trajectory[::step]:
W.write(protein)
secstructure = run_dssp(pdbfile)
data.append( (ts.frame, ts.time, secstructure) )
where run_dssp() should be a function that calls dssp (e.g. with subprocess.run()) and returns the secondary structur information as a suitable data structure. We then store it in `data` as a time series and then you have to process `data`. (You can also create proper temporary files that get cleaned up automatically but I just put down the bare bones.)
Oliver