# HG changeset patch
# User richard-burhans
# Date 1722359996 0
# Node ID 4966e095e3c3332129cd3d7b6a42fa53e97ce0e8
# Parent 99ee8d6f68151809926753effdf61c98d9212ae6
planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/segalign commit 6cf972d7f1c9ecb097994494a27d00906c6c3e4d
diff -r 99ee8d6f6815 -r 4966e095e3c3 package_output.py
--- a/package_output.py Tue Jul 30 03:31:29 2024 +0000
+++ b/package_output.py Tue Jul 30 17:19:56 2024 +0000
@@ -18,11 +18,14 @@
top_dir: str = "galaxy",
data_dir: str = "files",
config_file: str = "commands.json",
+ format_file: str = "format.txt"
) -> None:
self.pathname: str = os.path.realpath(pathname)
self.data_root: str = os.path.join(top_dir, data_dir)
self.config_path: str = os.path.join(top_dir, config_file)
self.config_file: str = config_file
+ self.format_path: str = os.path.join(top_dir, format_file)
+ self.format_file: str = format_file
self.tarfile: typing.Optional[tarfile.TarFile] = None
self.name_cache: typing.Dict[typing.Any, typing.Any] = {}
self.working_dir: str = os.path.realpath(os.getcwd())
@@ -76,6 +79,15 @@
self.name_cache[dest_path] = 1
# print(f"added: {dest_path}", flush=True)
+ def add_format(self, pathname: str) -> None:
+ if self.tarfile is None:
+ self._initialize()
+
+ source_path = os.path.realpath(pathname)
+
+ if self.tarfile is not None:
+ self.tarfile.add(source_path, arcname=self.format_path, recursive=False)
+
def close(self) -> None:
if self.tarfile is not None:
self.tarfile.close()
@@ -87,13 +99,16 @@
self,
pathname: str,
config: configparser.ConfigParser,
+ args: argparse.Namespace,
package_file: PackageFile,
) -> None:
self.pathname: str = pathname
self.config = config
+ self.args = args
self.package_file = package_file
self.executable: typing.Optional[str] = None
self._parse_lines()
+ self._write_format()
def _parse_lines(self) -> None:
with open("commands.json", "w") as ofh:
@@ -235,6 +250,21 @@
return command_dict
+ def _write_format(self) -> None:
+ if self.args.format_selector == "bam":
+ format_name = "bam"
+ elif self.args.format_selector == "maf":
+ format_name = "maf"
+ elif self.args.format_selector == "differences":
+ format_name = "interval"
+ else:
+ format_name = "tabular"
+
+ with open("format.txt", "w") as ofh:
+ print(f"{format_name}", file=ofh)
+
+ self.package_file.add_format("format.txt")
+
class nodevisitor(bashlex.ast.nodevisitor): # type: ignore[misc]
def __init__(self, positions: typing.List[typing.Tuple[int, int]]) -> None:
@@ -272,6 +302,7 @@
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--tool_directory", type=str, required=True, help="tool directory")
+ parser.add_argument("--format_selector", type=str, required=True, help="format selector")
args = parser.parse_args()
lastz_command_config_file: str = os.path.join(args.tool_directory, "lastz-cmd.ini")
@@ -281,7 +312,7 @@
package_file = PackageFile()
lastz_command_file = "lastz-commands.txt"
- bashCommandLineFile(lastz_command_file, config, package_file)
+ bashCommandLineFile(lastz_command_file, config, args, package_file)
package_file.close()
diff -r 99ee8d6f6815 -r 4966e095e3c3 segalign.xml
--- a/segalign.xml Tue Jul 30 03:31:29 2024 +0000
+++ b/segalign.xml Tue Jul 30 17:19:56 2024 +0000
@@ -19,12 +19,14 @@
'${output}'
- ## #end if
- ## #if $output_format.rplot:
- ## &&
- ## Rscript $r_plot > /dev/null 2>&1
- ## #end if
+## todo :: rplot, bam
+## --action:target=multiple
+## $output_format.rplot
+## .if str( $output_format.out.format ) == "bam":
+## | samtools sort -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '${output}'
+## .else:
+## > '${output}'
+## .end if
+## .if $output_format.rplot:
+## &&
+## Rscript $r_plot > /dev/null 2>&1
+## .end if
## System Options -----------------------------------------------------
@@ -129,6 +131,7 @@
&&
python '$__tool_directory__/package_output.py'
--tool_directory '$__tool_directory__'
+ --format_selector '$output_options.format.format_selector'
]]>