Mercurial > repos > richard-burhans > batched_lastz
changeset 15:f6090d2a5722 draft
planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/batched_lastz commit 439b32f4ac520e4b22770fa2becd363230e198e0
author | richard-burhans |
---|---|
date | Mon, 08 Sep 2025 22:32:10 +0000 |
parents | 43e72105f473 |
children | 79182c2a8c80 |
files | batched_lastz.xml macros.xml run_lastz_tarball.py |
diffstat | 3 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <tests> <test expect_num_outputs="1"> <param name="input" value="input.tgz" ftype="tgz"/> - <output name="output" decompress="true" file="output.maf.gz" ftype="maf"/> + <output name="output"> + <assert_contents> + <has_size min="1"/> + </assert_contents> + </output> + </test> </tests> <help><![CDATA[
--- a/macros.xml Fri Aug 30 15:32:44 2024 +0000 +++ b/macros.xml Mon Sep 08 22:32:10 2025 +0000 @@ -6,7 +6,7 @@ </requirements> </xml> <token name="@TOOL_VERSION@">1.04.22</token> - <token name="@VERSION_SUFFIX@">4</token> + <token name="@VERSION_SUFFIX@">5</token> <token name="@PROFILE@">21.05</token> <xml name="citations"> <citations>
--- 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: