changeset 19:cefa7625d6cb draft

planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/segalign commit 2840545abeeca2dc0a6e6df138633e561d379e52
author richard-burhans
date Thu, 01 Aug 2024 18:39:46 +0000
parents a5769923297c
children 96ff17622b17
files package_output.py runner.py segalign.xml
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/package_output.py	Wed Jul 31 02:40:51 2024 +0000
+++ b/package_output.py	Thu Aug 01 18:39:46 2024 +0000
@@ -4,12 +4,16 @@
 import configparser
 import json
 import os
+import resource
 import sys
 import tarfile
+import time
 import typing
 
 import bashlex
 
+RUSAGE_ATTRS: typing.Final = ["ru_utime", "ru_stime", "ru_maxrss", "ru_minflt", "ru_majflt", "ru_inblock", "ru_oublock", "ru_nvcsw", "ru_nivcsw"]
+
 
 class PackageFile:
     def __init__(
@@ -303,8 +307,13 @@
     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")
+    parser.add_argument("--debug", action="store_true", help="enable debug messages")
     args = parser.parse_args()
 
+    if args.debug:
+        r_beg = resource.getrusage(resource.RUSAGE_SELF)
+        beg: int = time.monotonic_ns()
+
     lastz_command_config_file: str = os.path.join(args.tool_directory, "lastz-cmd.ini")
 
     config: configparser.ConfigParser = configparser.ConfigParser()
@@ -315,6 +324,14 @@
     bashCommandLineFile(lastz_command_file, config, args, package_file)
     package_file.close()
 
+    if args.debug:
+        ns: int = time.monotonic_ns() - beg
+        r_end = resource.getrusage(resource.RUSAGE_SELF)
+        print(f"package output clock time: {ns} ns", file=sys.stderr, flush=True)
+        for rusage_attr in RUSAGE_ATTRS:
+            value = getattr(r_end, rusage_attr) - getattr(r_beg, rusage_attr)
+            print(f"  package output {rusage_attr}: {value}", file=sys.stderr, flush=True)
+
 
 if __name__ == "__main__":
     main()
--- a/runner.py	Wed Jul 31 02:40:51 2024 +0000
+++ b/runner.py	Thu Aug 01 18:39:46 2024 +0000
@@ -37,7 +37,7 @@
 
 
 class LastzCommand:
-    lastz_command_regex = re.compile(r"lastz (.+?)?ref\.2bit\[nameparse=darkspace\]\[multiple\]\[subset=ref_block(\d+)\.name\] (.+?)?query\.2bit\[nameparse=darkspace\]\[subset=query_block(\d+)\.name] --format=(\S+) --ydrop=(\d+) --gappedthresh=(\d+) --strand=(minus|plus)(?: --ambiguous=(\S+))?(?: --(notrivial))?(?: --scoring=(\S+))? --segments=tmp(\d+)\.block(\d+)\.r(\d+)\.(minus|plus)(?:\.split(\d+))?\.segments --output=tmp(\d+)\.block(\d+)\.r(\d+)\.(minus|plus)(?:\.split(\d+))?\.(\S+) 2> tmp(\d+)\.block(\d+)\.r(\d+)\.(minus|plus)(?:\.split(\d+))?\.err")
+    lastz_command_regex = re.compile(r"lastz (.+?)?ref\.2bit\[nameparse=darkspace\]\[multiple\]\[subset=ref_block(\d+)\.name\] (.+?)?query\.2bit\[nameparse=darkspace\]\[subset=query_block(\d+)\.name] --format=(\S+) --ydrop=(\d+) --gappedthresh=(\d+) --strand=(minus|plus)(?: --ambiguous=(\S+))?(?: --(notrivial))?(?: --scores=(\S+))? --segments=tmp(\d+)\.block(\d+)\.r(\d+)\.(minus|plus)(?:\.split(\d+))?\.segments --output=tmp(\d+)\.block(\d+)\.r(\d+)\.(minus|plus)(?:\.split(\d+))?\.(\S+) 2> tmp(\d+)\.block(\d+)\.r(\d+)\.(minus|plus)(?:\.split(\d+))?\.err")
 
     def __init__(self, line: str) -> None:
         self.line = line
--- a/segalign.xml	Wed Jul 31 02:40:51 2024 +0000
+++ b/segalign.xml	Thu Aug 01 18:39:46 2024 +0000
@@ -132,6 +132,9 @@
 python '$__tool_directory__/package_output.py'
     --tool_directory '$__tool_directory__'
     --format_selector '$output_options.format.format_selector'
+#if str($system_options.debug) == "true"
+    --debug
+#end if
 
     ]]></command>
     <inputs>