diff --git a/vermouth/dssp/dssp.py b/vermouth/dssp/dssp.py index 40e5ad4b..68763a0a 100644 --- a/vermouth/dssp/dssp.py +++ b/vermouth/dssp/dssp.py @@ -143,7 +143,7 @@ def read_dssp2(lines): return secstructs -def run_dssp(system, executable='dssp', savefile=None, defer_writing=True): +def run_dssp(system, executable='dssp', savefile=None, defer_writing=True, version="3.0.0"): """ Run DSSP on a system and return the assigned secondary structures. @@ -172,6 +172,8 @@ def run_dssp(system, executable='dssp', savefile=None, defer_writing=True): If set to a path, the output of DSSP is written in that file. defer_writing: bool Whether to use :meth:`~vermouth.file_writer.DeferredFileWriter.write` for writing data + version: str + Supported versions for running dssp Returns list[str] @@ -191,6 +193,12 @@ def run_dssp(system, executable='dssp', savefile=None, defer_writing=True): read_dssp2 Parse a DSSP output. """ + # check version + process = subprocess.run(["dssp", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + version_found = process.stdout.decode('UTF8') + if version not in version_found: + raise DSSPError('Vermouth currently only supports DSSP version 3.0.0.') + tmpfile_handle, tmpfile_name = tempfile.mkstemp(suffix='.pdb', text=True, dir='.', prefix='dssp_in_') tmpfile_handle = os.fdopen(tmpfile_handle, mode='w')