Skip to content

Commit

Permalink
kwargs for calcSignatureInteractions, optional removal of tmp files
Browse files Browse the repository at this point in the history
  • Loading branch information
karolamik13 committed Nov 12, 2024
1 parent 6e342c4 commit 5450f8c
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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))



Expand Down

0 comments on commit 5450f8c

Please sign in to comment.