From a722da6faf541570f328185d07970815ca55eca8 Mon Sep 17 00:00:00 2001 From: ftclark3 <60708336+ftclark3@users.noreply.github.com> Date: Tue, 2 Sep 2025 10:59:34 -0500 Subject: [PATCH 1/2] update image rendering method in vmd script resolves #16 --- frustratometer/frustration/frustration.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frustratometer/frustration/frustration.py b/frustratometer/frustration/frustration.py index 81ec880..38ad604 100644 --- a/frustratometer/frustration/frustration.py +++ b/frustratometer/frustration/frustration.py @@ -1025,9 +1025,10 @@ def write_tcl_script(pdb_file: Union[Path,str], chain: str, mask: np.array, dist exit ''') elif still_image_name: + # file type choices other than ppm may work; see https://www.ks.uiuc.edu/Research/vmd/current/ug/node147.html fo.write(f'set output "{still_image_name}"' + ''' - render snapshot $output - exit + render format TachyonInternal PPM + render TachyonInternal $output ''') fo.close() return tcl_script @@ -1573,4 +1574,4 @@ def compute_energy_sliding_window(seq: str, 'frustration': frustration_sw } - return results \ No newline at end of file + return results From 4ac4285e0c9f36570799416810b6f55be2d2220b Mon Sep 17 00:00:00 2001 From: ftclark3 <60708336+ftclark3@users.noreply.github.com> Date: Tue, 2 Sep 2025 17:43:14 -0500 Subject: [PATCH 2/2] add option to write vmd script but not launch vmd --- frustratometer/classes/Frustratometer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frustratometer/classes/Frustratometer.py b/frustratometer/classes/Frustratometer.py index 962050f..8c58dac 100644 --- a/frustratometer/classes/Frustratometer.py +++ b/frustratometer/classes/Frustratometer.py @@ -291,7 +291,7 @@ def auc(self): """ return frustration.compute_auc(self.roc()) - def vmd(self, sequence: str = None, single:Union[str,np.array] = 'singleresidue', pair:Union[str,np.array] = 'mutational', + def vmd(self, sequence: str = None, single:Union[str,np.array] = 'singleresidue', pair:Union[str,np.array] = 'mutational', launch_vmd:bool = True, aa_freq:np.array = None, correction:int = 0, max_connections:Union[int,None] = None, movie_name=None, still_image_name=None): """ Calculates frustration indices and superimposes frustration patterns onto PDB structure using the VMD software. @@ -322,7 +322,8 @@ def vmd(self, sequence: str = None, single:Union[str,np.array] = 'singleresidue' -self.frustration(kind=single, sequence=sequence, aa_freq=aa_freq), -self.frustration(kind=pair, sequence=sequence, aa_freq=aa_freq), max_connections=max_connections, movie_name=movie_name, still_image_name=still_image_name) - frustration.call_vmd(self.pdb_file, tcl_script) + if launch_vmd: + frustration.call_vmd(self.pdb_file, tcl_script) def view_pair_frustration(self, sequence:str = None, pair:str = 'mutational', aa_freq:np.array = None): """