Skip to content
Snippets Groups Projects
Commit 95727af9 authored by bay9355's avatar bay9355
Browse files
parents 86783f86 5b3d4e29
No related branches found
No related tags found
No related merge requests found
......@@ -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'):
......
......@@ -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):
......
......@@ -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
......
......@@ -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 = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment