Package: spades / 3.13.1+dfsg-2

0111_use_full_config_dirs.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Description: use full config include path
 This patch makes sure that the config files are not dependent on local
 directory structure.
Author: Sascha Steinbiss <satta@debian.org>
--- a/assembler/src/spades_pipeline/spades_logic.py
+++ b/assembler/src/spades_pipeline/spades_logic.py
@@ -207,6 +207,20 @@ def run_iteration(configs_dir, execution
 
     add_configs(command, dst_configs)
 
+    for root, dirs, files in os.walk(dst_configs):
+        replacements = {'#include "': ('#include "' + root + '/')}
+        for cfg_file in files:
+            cfg_file = os.path.join(root, cfg_file)
+            lines = []
+            with open(cfg_file) as infile:
+                for line in infile:
+                    for src, target in replacements.iteritems():
+                        line = line.replace(src, target)
+                    lines.append(line)
+            with open(cfg_file, 'w') as outfile:
+                for line in lines:
+                    outfile.write(line)
+
     #print("Calling: " + " ".join(command))
     support.sys_call(command, log)
 
@@ -254,6 +268,19 @@ def run_scaffold_correction(configs_dir,
     command = [os.path.join(execution_home, "spades-truseq-scfcorrection"), cfg_file_name]
     add_configs(command, dst_configs)
     log.info(str(command))
+    for root, dirs, files in os.walk(dst_configs):
+        replacements = {'#include "': ('#include "' + root + '/')}
+        for cfg_file in files:
+            cfg_file = os.path.join(root, cfg_file)
+            lines = []
+            with open(cfg_file) as infile:
+                for line in infile:
+                    for src, target in replacements.iteritems():
+                        line = line.replace(src, target)
+                    lines.append(line)
+            with open(cfg_file, 'w') as outfile:
+                for line in lines:
+                    outfile.write(line)
     support.sys_call(command, log)