diff --git a/cami_src/algorithms/AlgorithmWrapper.py b/cami_src/algorithms/AlgorithmWrapper.py index 6378fade6ebea5dcd882cce7b74063b69c1a463d..17de832c30197b6ca0eb0a7e00f1108fcc50c790 100644 --- a/cami_src/algorithms/AlgorithmWrapper.py +++ b/cami_src/algorithms/AlgorithmWrapper.py @@ -38,10 +38,10 @@ class AlgorithmWrapper(object): def create_tmp_output_dir(self, tmp_dir): out_dir = os.path.join(tmp_dir, self.name) - print(tmp_dir) + #print(tmp_dir) if not os.path.exists(out_dir): os.mkdir(out_dir) - print(f"created temporary directory for {self.name} named {out_dir}...") + if self.debug: print(f"created temporary directory for {self.name} named {out_dir}...") self.output_dir = out_dir def name_file(self, kind, ending='txt'): diff --git a/cami_src/algorithms/DiamondWrapper.py b/cami_src/algorithms/DiamondWrapper.py index 93ca932a20200630a4dd4a5dc6012fcf72afc86a..ee616361500565236ca7df570d2b3f8e3c1afc7c 100644 --- a/cami_src/algorithms/DiamondWrapper.py +++ b/cami_src/algorithms/DiamondWrapper.py @@ -42,7 +42,7 @@ class DiamondWrapper(AlgorithmWrapper): command = f'{diamond} "{ppi}" "{seeds}" {nof_predictions} {self.alpha} "{algo_output}"' subprocess.call(command, shell=True, stdout=subprocess.PIPE) assert os.path.exists(algo_output), f'DIAMOnD failed to save output to {algo_output}' - print(f"DIAMOnD results saved in {algo_output}") + if self.debug: print(f"DIAMOnD results saved in {algo_output}") return self.extract_output(algo_output) def prepare_input(self): diff --git a/cami_src/algorithms/DominoWrapper.py b/cami_src/algorithms/DominoWrapper.py index d642ecf6f2dccfc371a788dbe428024e2e363584..34953a3e507056832942efc11f72e0fecaea4322 100644 --- a/cami_src/algorithms/DominoWrapper.py +++ b/cami_src/algorithms/DominoWrapper.py @@ -54,7 +54,7 @@ class DominoWrapper(AlgorithmWrapper): command = f'mv "{algo_output}" "{os.path.join(self.output_dir, outputfilename)}"' subprocess.call(command, shell=True, stdout=subprocess.PIPE) algo_output = os.path.join(self.output_dir, outputfilename) - print(f"{self.name} results saved in {algo_output}") + if self.debug: print(f"{self.name} results saved in {algo_output}") return self.extract_output(algo_output) @@ -64,8 +64,7 @@ class DominoWrapper(AlgorithmWrapper): """ inputparams = [] # prepare inputfiles - if self.debug: - print(f'creating {self.name} input files in {self.output_dir}') + if self.debug: print(f'creating {self.name} input files in {self.output_dir}') ppi_filename = self.name_file('ppi', 'sif') ppi_file = os.path.join(self.output_dir, ppi_filename) @@ -81,26 +80,23 @@ class DominoWrapper(AlgorithmWrapper): file.write(f"{str(edge.source()) + '_'}\tppi\t{str(edge.target()) + '_'}\n") # the nodes need to be appended by '_' so that pandas recognizes the vertices as strings inputparams.append(ppi_file) - print(f'{self.name} ppi is saved in {ppi_file}') + if self.debug: print(f'{self.name} ppi is saved in {ppi_file}') with open(seed_file, "w") as file: file.write('#node\n') for seed in self.seeds: file.write(f"{seed}_\n") inputparams.append(seed_file) - if self.debug: - print(f'{self.name} seeds are saved in {seed_file}') + if self.debug: print(f'{self.name} seeds are saved in {seed_file}') slices_filename = self.name_file('slices') slices_output = os.path.join(self.output_dir, slices_filename) if not os.path.exists(slices_output): - if self.debug: - print('creating domino slices_file...') + if self.debug: print('creating domino slices_file...') command = f'slicer --network_file "{ppi_file}" --output_file "{slices_output}"' subprocess.call(command, shell=True, stdout=subprocess.PIPE) - if self.debug: - print(f'{self.name} slices are saved in {slices_output}') + if self.debug: print(f'{self.name} slices are saved in {slices_output}') inputparams.append(slices_output) return inputparams diff --git a/cami_src/algorithms/RobustWrapper.py b/cami_src/algorithms/RobustWrapper.py index 84d00ef3af6552356e4ae3064a97b2e69d106351..fb89b20be6f356e9574d6491df78711d357383d6 100755 --- a/cami_src/algorithms/RobustWrapper.py +++ b/cami_src/algorithms/RobustWrapper.py @@ -58,7 +58,7 @@ class RobustWrapper(AlgorithmWrapper): {self.initialFraction} {self.reductionFactor} \ {self.numberSteinerTrees} {self.threshold}' subprocess.call(command, shell=True, stdout=subprocess.PIPE) - print(f"Robust results saved in {algo_output}") + if self.debug: print(f"Robust results saved in {algo_output}") return self.extract_output(algo_output) # inputparams = []