comparison run_lastz_tarball.py @ 10:d10e7502aba8 draft

planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/batched_lastz commit effd27b9070dc4564d3cea38869d3bf043201683
author richard-burhans
date Tue, 13 Aug 2024 15:56:46 +0000
parents 3a67d287d19f
children aa5586d83ae3
comparison
equal deleted inserted replaced
9:1ac663f6a344 10:d10e7502aba8
32 output_queue: "queue.Queue[float]", 32 output_queue: "queue.Queue[float]",
33 debug: bool = False, 33 debug: bool = False,
34 ) -> None: 34 ) -> None:
35 os.chdir("galaxy/files") 35 os.chdir("galaxy/files")
36 36
37 # These are not considered errors even though
38 # we will end up with a segmented alignment
39 truncation_regex = re.compile(
40 r"truncating alignment (ending|starting) at \(\d+,\d+\); anchor at \(\d+,\d+\)$"
41 )
42 truncation_msg = "truncation can be reduced by using --allocate:traceback to increase traceback memory"
43
37 while True: 44 while True:
38 command_dict = input_queue.get() 45 command_dict = input_queue.get()
39 46
40 if not command_dict: 47 if not command_dict:
41 return 48 return
78 85
79 elapsed = time.perf_counter() - begin 86 elapsed = time.perf_counter() - begin
80 output_queue.put(elapsed) 87 output_queue.put(elapsed)
81 88
82 elif p.returncode == 1: 89 elif p.returncode == 1:
83 # should be more robust
84 traceback_warning = True 90 traceback_warning = True
85 91
86 stderr_file = command_dict["stderr"] 92 stderr_file = command_dict["stderr"]
87 if stderr_file is None: 93 if stderr_file is None:
88 traceback_warning = False 94 traceback_warning = False
89 else: 95 else:
90 with open(stderr_file) as f: 96 with open(stderr_file) as f:
91 for stderr_line in f: 97 for stderr_line in f:
92 for prefix in ["truncating alignment", "truncation can be reduced"]:
93 if stderr_line.startswith(prefix):
94 continue
95
96 stderr_line = stderr_line.strip() 98 stderr_line = stderr_line.strip()
97 if stderr_line: 99 if (
100 not truncation_regex.match(stderr_line)
101 and stderr_line != truncation_msg
102 ):
98 traceback_warning = False 103 traceback_warning = False
99 104
100 if traceback_warning: 105 if traceback_warning:
101 elapsed = time.perf_counter() - begin 106 elapsed = time.perf_counter() - begin
102 output_queue.put(elapsed) 107 output_queue.put(elapsed)
227 try: 232 try:
228 with open("galaxy/format.txt") as f: 233 with open("galaxy/format.txt") as f:
229 format_name = f.readline() 234 format_name = f.readline()
230 format_name = format_name.rstrip("\n") 235 format_name = format_name.rstrip("\n")
231 except FileNotFoundError: 236 except FileNotFoundError:
232 sys.exit( 237 sys.exit(f"ERROR: input tarball missing galaxy/format.txt: {self.pathname}")
233 f"ERROR: input tarball missing galaxy/format.txt: {self.pathname}"
234 )
235 238
236 if format_name in ["bam", "maf"]: 239 if format_name in ["bam", "maf"]:
237 self.format_name = format_name 240 self.format_name = format_name
238 elif format_name == "differences": 241 elif format_name == "differences":
239 self.format_name = "interval" 242 self.format_name = "interval"