changeset 73:adb84c450789 draft

planemo upload for repository https://github.com/rolfverberg/galaxytools commit 366e516aef0735af2998c6ff3af037181c8d5213-dirty
author rv43
date Mon, 20 Mar 2023 17:30:24 +0000
parents d5329ca0210d
children 4f4ee8db5f67
files tomo_reduce.py tomo_reduce.xml
diffstat 2 files changed, 42 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/tomo_reduce.py	Mon Mar 20 17:08:28 2023 +0000
+++ b/tomo_reduce.py	Mon Mar 20 17:30:24 2023 +0000
@@ -15,30 +15,30 @@
     # Parse command line arguments
     parser = argparse.ArgumentParser(
             description='Reduce tomography data')
-    parser.add_argument('-i', '--input_file',
-            required=True,
-            type=pathlib.Path,
-            help='''Full or relative path to the input file (in yaml or nxs format).''')
-    parser.add_argument('-o', '--output_file',
-            required=True,
-            type=pathlib.Path,
-            help='''Full or relative path to the output file (in Nexus format).''')
-    parser.add_argument('--galaxy_flag',
-            action='store_true',
-            help='''Use this flag to run the scripts as a galaxy tool.''')
-    parser.add_argument('--img_x_bounds',
-            required=False,
-            nargs=2,
-            type=int,
-            help='Vertical data reduction image range')
+#    parser.add_argument('-i', '--input_file',
+#            required=True,
+#            type=pathlib.Path,
+#            help='''Full or relative path to the input file (in yaml or nxs format).''')
+#    parser.add_argument('-o', '--output_file',
+#            required=True,
+#            type=pathlib.Path,
+#            help='''Full or relative path to the output file (in Nexus format).''')
+#    parser.add_argument('--galaxy_flag',
+#            action='store_true',
+#            help='''Use this flag to run the scripts as a galaxy tool.''')
+#    parser.add_argument('--img_x_bounds',
+#            required=False,
+#            nargs=2,
+#            type=int,
+#            help='Vertical data reduction image range')
     parser.add_argument('-l', '--log',
 #            type=argparse.FileType('w'),
             default=sys.stdout,
             help='Logging stream or filename')
-    parser.add_argument('--log_level',
-            choices=logging._nameToLevel.keys(),
-            default='INFO',
-            help='''Specify a preferred logging level.''')
+#    parser.add_argument('--log_level',
+#            choices=logging._nameToLevel.keys(),
+#            default='INFO',
+#            help='''Specify a preferred logging level.''')
     args = parser.parse_args()
 
     # Set log configuration
@@ -66,25 +66,28 @@
 #    tracemalloc.start()
 
     # Log command line arguments
-    logging.info(f'input_file = {args.input_file}')
-    logging.info(f'output_file = {args.output_file}')
-    logging.info(f'galaxy_flag = {args.galaxy_flag}')
-    logging.info(f'img_x_bounds = {args.img_x_bounds}')
-    logging.debug(f'log = {args.log}')
-    logging.debug(f'is log stdout? {args.log is sys.stdout}')
-    logging.debug(f'log_level = {args.log_level}')
+#    logging.info(f'input_file = {args.input_file}')
+#    logging.info(f'output_file = {args.output_file}')
+#    logging.info(f'galaxy_flag = {args.galaxy_flag}')
+#    logging.info(f'img_x_bounds = {args.img_x_bounds}')
+#    logging.debug(f'log = {args.log}')
+#    logging.debug(f'is log stdout? {args.log is sys.stdout}')
+#    logging.debug(f'log_level = {args.log_level}')
+    logging.info(f'log = {args.log}')
+    logging.info(f'is log stdout? {args.log is sys.stdout}')
+    print('Done')
 
     # Instantiate Tomo object
-    tomo = Tomo(galaxy_flag=args.galaxy_flag)
+#    tomo = Tomo(galaxy_flag=args.galaxy_flag)
 
     # Read input file
-    data = tomo.read(args.input_file)
+#    data = tomo.read(args.input_file)
 
     # Generate reduced tomography images
-    data = tomo.gen_reduced_data(data, img_x_bounds=args.img_x_bounds)
+#    data = tomo.gen_reduced_data(data, img_x_bounds=args.img_x_bounds)
 
     # Write output file
-    data = tomo.write(data, args.output_file)
+#    data = tomo.write(data, args.output_file)
 
     # Displaying memory usage
 #    logging.info(f'Memory usage: {tracemalloc.get_traced_memory()}')
--- a/tomo_reduce.xml	Mon Mar 20 17:08:28 2023 +0000
+++ b/tomo_reduce.xml	Mon Mar 20 17:30:24 2023 +0000
@@ -1,34 +1,24 @@
 <tool id="tomo_reduce" name="Tomo Reduce" version="0.1.1" python_template_version="3.9">
     <description>Reduce tomography images</description>
-    <macros>
-        <import>tomo_macros.xml</import>
-    </macros>
-    <expand macro="requirements" />
     <command detect_errors="exit_code">
         <![CDATA[
-            mkdir tomo_reduce_plots;
             $__tool_directory__/tomo_reduce.py
-            --input_file '$input_file'
-            --output_file 'output.nxs'
-            --galaxy_flag
-            --img_x_bounds $x_bounds.x_bound_low $x_bounds.x_bound_upp
             -l '$log'
         ]]>
     </command>
-    <inputs>
-        <param name="input_file" type="data" optional="false" label="Input file"/>
-    </inputs>
     <outputs>
-        <expand macro="common_outputs"/>
-        <collection name="tomo_reduce_plots" type="list" label="Tomo data reduction images">
-            <discover_datasets pattern="__name_and_ext__" directory="tomo_reduce_plots"/>
-        </collection>
-        <data name="output_file" format="nxs" label="Reduced tomography data" from_work_dir="output.nxs"/>
+        <data name="log" format="txt" label="Log"/>
     </outputs>
     <help>
         <![CDATA[
             Reduce tomography images.
         ]]>
     </help>
-    <expand macro="citations"/>
+    <citations>
+        <citation type="bibtex">
+@misc{tomo,
+  author = {Verberg, Rolf},
+  year = {2022}
+}</citation>
+    </citations>
 </tool>