From 5450f8caa2ff14a62a1bf18184aecba8c185f53d Mon Sep 17 00:00:00 2001 From: karolamik13 Date: Tue, 12 Nov 2024 23:25:09 +0100 Subject: [PATCH] kwargs for calcSignatureInteractions, optional removal of tmp files --- prody/proteins/interactions.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index c00da0121..fd6124a3d 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -3674,7 +3674,7 @@ def extract_sequence_from_pdb(pdb_file, chain, output_file): subprocess.run("rm -rf tmp2 temp", shell=True) -def calcSignatureInteractions(mapping_file, PDB_folder, fixer='pdbfixer'): +def calcSignatureInteractions(mapping_file, PDB_folder, **kwargs): """Analyzes protein structures to identify various interactions using InSty. Processes data from the MSA file and folder with selected models. @@ -3685,11 +3685,21 @@ def calcSignatureInteractions(mapping_file, PDB_folder, fixer='pdbfixer'): :type PDB_folder: str :arg fixer: The method for fixing lack of hydrogen bonds + by default is 'pdbfixer' :type fixer: 'pdbfixer' or 'openbabel' + + :arg remove_tmp_files: Removing intermediate files that are created in the process + by default is True + :type remove_tmp_files: True or False """ import os + fixer = kwargs.pop('fixer', 'pdbfixer') + remove_tmp_files = kwargs.pop('remove_tmp_files', True) + n_per_plot = kwargs.pop('n_per_plot', None) + min_height = kwargs.pop('min_height', 8) + functions = { "HydrogenBonds": calcHydrogenBonds, "SaltBridges": calcSaltBridges, @@ -3719,15 +3729,15 @@ def calcSignatureInteractions(mapping_file, PDB_folder, fixer='pdbfixer'): result, fixed_files = result # Proceed with plotting - n = None - plot_barh(result, bond_type, n) + plot_barh(result, bond_type, n_per_plot=n_per_plot, min_height=min_height) # Remove all fixed files at the end - if 'fixed_files' in locals(): - for fixed_file in fixed_files: - if os.path.exists(fixed_file): - os.remove(fixed_file) - log_message("Removed fixed file: {}".format(fixed_file)) + if remove_tmp_files == True: + if 'fixed_files' in locals(): + for fixed_file in fixed_files: + if os.path.exists(fixed_file): + os.remove(fixed_file) + log_message("Removed fixed file: {}".format(fixed_file))