# HG changeset patch # User richard-burhans # Date 1757370730 0 # Node ID f6090d2a5722a7634478d0192f0cb40cf1f75c4b # Parent 43e72105f47307c7afbbba71a039c18255ef999f planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/batched_lastz commit 439b32f4ac520e4b22770fa2becd363230e198e0 diff -r 43e72105f473 -r f6090d2a5722 batched_lastz.xml --- a/batched_lastz.xml Fri Aug 30 15:32:44 2024 +0000 +++ b/batched_lastz.xml Mon Sep 08 22:32:10 2025 +0000 @@ -22,7 +22,12 @@ - + + + + + + 1.04.22 - 4 + 5 21.05 diff -r 43e72105f473 -r f6090d2a5722 run_lastz_tarball.py --- a/run_lastz_tarball.py Fri Aug 30 15:32:44 2024 +0000 +++ b/run_lastz_tarball.py Mon Sep 08 22:32:10 2025 +0000 @@ -2,6 +2,8 @@ import argparse import concurrent.futures +import contextlib +import gzip import json import multiprocessing import os @@ -16,6 +18,16 @@ import typing +@contextlib.contextmanager +def open_file(filename: str): + if filename.endswith(".gz"): + with gzip.open(filename, "wt", compresslevel=6) as f: + yield f + else: + with open(filename, "w") as f: + yield f + + lastz_output_format_regex = re.compile( r"^(?:axt\+?|blastn|cigar|differences|general-?.+|lav|lav\+text|maf[-+]?|none|paf(?::wfmash)?|rdotplot|sam-?|softsam-?|text)$", re.IGNORECASE, @@ -214,7 +226,7 @@ except FileNotFoundError: sys.exit(f"ERROR: input tarball missing galaxy/format.txt: {self.pathname}") - if format_name in ["bam", "maf"]: + if format_name in ["axt", "bam", "maf"]: self.format_name = format_name elif format_name == "differences": self.format_name = "interval" @@ -341,10 +353,12 @@ sys.exit(f"ERROR: expecting a single output file, found {num_output_files}") final_output_format = self.batch_tar.final_output_format() + if final_output_format in ["axt", "maf"]: + final_output_format = f"{final_output_format}.gz" for file_type, file_list in self.output_files.items(): - with open(f"output.{final_output_format}", "w") as ofh: - if final_output_format == "maf": + with open_file(f"output.{final_output_format}") as ofh: + if final_output_format == "maf.gz": print("##maf version=1", file=ofh) for filename in file_list: