comparison run_lastz_tarball.py @ 6:34d51e66256c draft

planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/batched_lastz commit 2ab3532f7a45153eb0f945ac22c37cdcaea8c1e1
author richard-burhans
date Wed, 10 Jul 2024 18:00:34 +0000
parents 007990f98551
children 4cd7884635c2
comparison
equal deleted inserted replaced
5:a68e128cdb1a 6:34d51e66256c
6 import multiprocessing 6 import multiprocessing
7 import os 7 import os
8 import queue 8 import queue
9 import re 9 import re
10 import shutil 10 import shutil
11 import subprocess
11 import sys 12 import sys
12 import subprocess
13 import tarfile 13 import tarfile
14 import tempfile 14 import tempfile
15 import time
15 import typing 16 import typing
16 import time
17 17
18 18
19 lastz_output_format_regex = re.compile( 19 lastz_output_format_regex = re.compile(
20 r"^(?:axt\+?|blastn|cigar|differences|general-?.+|lav|lav\+text|maf[-+]?|none|paf(?::wfmash)?|rdotplot|sam-?|softsam-?|text)$", 20 r"^(?:axt\+?|blastn|cigar|differences|general-?.+|lav|lav\+text|maf[-+]?|none|paf(?::wfmash)?|rdotplot|sam-?|softsam-?|text)$",
21 re.IGNORECASE, 21 re.IGNORECASE,
67 else: 67 else:
68 stderr = command_dict["stderr"] 68 stderr = command_dict["stderr"]
69 if stderr is not None: 69 if stderr is not None:
70 try: 70 try:
71 statinfo = os.stat(stderr, follow_symlinks=False) 71 statinfo = os.stat(stderr, follow_symlinks=False)
72 except: 72 except Exception:
73 statinfo = None 73 statinfo = None
74 74
75 if statinfo is None: 75 if statinfo is None:
76 sys.exit(f"unable to stat stderr file: {' '.join(args)}") 76 sys.exit(f"unable to stat stderr file: {' '.join(args)}")
77 77
303 def _cleanup(self) -> None: 303 def _cleanup(self) -> None:
304 num_output_files = len(self.output_files.keys()) 304 num_output_files = len(self.output_files.keys())
305 305
306 for file_type, file_list in self.output_files.items(): 306 for file_type, file_list in self.output_files.items():
307 with open(f"output.{file_type}", "w") as ofh: 307 with open(f"output.{file_type}", "w") as ofh:
308 print("##maf version=1", file=ofh)
308 for filename in file_list: 309 for filename in file_list:
309 with open(f"galaxy/files/{filename}") as ifh: 310 with open(f"galaxy/files/{filename}") as ifh:
310 for line in ifh: 311 for line in ifh:
311 ofh.write(line) 312 ofh.write(line)
312 313