changeset 4:a4c6fcf2c456 draft

"planemo upload commit 0584e8878deaf91614c6bb3c0122975300132c25"
author gregor.m
date Thu, 26 Nov 2020 16:40:47 +0000
parents 4d7f30a7e2f6
children d5a4180410c4
files OutputReport.html SpyBOAT.xml __pycache__/output_report.cpython-38.pyc amplitude_frame0.png amplitude_frame16.png amplitude_frame18.png amplitude_frame2.png amplitude_frame20.png amplitude_frame32.png amplitude_frame34.png amplitude_frame40.png amplitude_frame48.png amplitude_frame50.png amplitude_frame60.png amplitude_frame64.png amplitude_frame66.png amplitude_frame80.png amplitude_frame82.png amplitude_frame96.png amplitude_twosines_out.tif input_frame0.png input_frame16.png input_frame18.png input_frame2.png input_frame20.png input_frame32.png input_frame34.png input_frame40.png input_frame48.png input_frame50.png input_frame60.png input_frame64.png input_frame66.png input_frame80.png input_frame82.png input_frame96.png notes.md output_report.py period_distr.png period_frame0.png period_frame16.png period_frame18.png period_frame2.png period_frame20.png period_frame32.png period_frame34.png period_frame40.png period_frame48.png period_frame50.png period_frame60.png period_frame64.png period_frame66.png period_frame80.png period_frame82.png period_frame96.png period_twosines_out.tif phase_distr.png phase_frame0.png phase_frame16.png phase_frame18.png phase_frame2.png phase_frame20.png phase_frame32.png phase_frame34.png phase_frame40.png phase_frame48.png phase_frame50.png phase_frame60.png phase_frame64.png phase_frame66.png phase_frame80.png phase_frame82.png phase_frame96.png phase_twosines_out.tif power_distr.png power_twosines_out.tif preproc_two_sines.tif run_tests.sh spyboat_cli.py test-data/test-movie.tif
diffstat 80 files changed, 130 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/OutputReport.html	Tue Nov 24 13:06:26 2020 +0000
+++ b/OutputReport.html	Thu Nov 26 16:40:47 2020 +0000
@@ -1,5 +1,6 @@
 
     <html>
+    <!-- this file got automatically created by 'output_report.py' -->
     <title>SpyBOAT Output Report</title>
     <head>
         <!-- that doesn't work with galaxy.. -->
@@ -83,139 +84,162 @@
     <!-- defines all elements of the "FrameSlides" class --->
     
         <div class="FrameSlides"> 
-        <h3 style="text-align:center; color=#363333"> Frame Nr. 2 </h3>
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 20 </h3>
 
             <div class="snapshot_gallery">
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
-                 <img src="input_frame2.png" alt="The Input" class="snapshot_gallery__img">
+                 <img src="input_frame20.png" alt="The Input" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
-                 <img src="phase_frame2.png" alt="Phase" class="snapshot_gallery__img">
+                 <img src="phase_frame20.png" alt="Phase" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
-                 <img src="period_frame2.png" alt="Period" class="snapshot_gallery__img">
+                 <img src="period_frame20.png" alt="Period" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
-                 <img src="amplitude_frame2.png" alt="Amplitude" class="snapshot_gallery__img">
+                 <img src="amplitude_frame20.png" alt="Amplitude" class="snapshot_gallery__img">
                </figure>
             </div>
         </div>
         
         <div class="FrameSlides"> 
-        <h3 style="text-align:center; color=#363333"> Frame Nr. 18 </h3>
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 29 </h3>
 
             <div class="snapshot_gallery">
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
-                 <img src="input_frame18.png" alt="The Input" class="snapshot_gallery__img">
+                 <img src="input_frame29.png" alt="The Input" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
-                 <img src="phase_frame18.png" alt="Phase" class="snapshot_gallery__img">
+                 <img src="phase_frame29.png" alt="Phase" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
-                 <img src="period_frame18.png" alt="Period" class="snapshot_gallery__img">
+                 <img src="period_frame29.png" alt="Period" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
-                 <img src="amplitude_frame18.png" alt="Amplitude" class="snapshot_gallery__img">
+                 <img src="amplitude_frame29.png" alt="Amplitude" class="snapshot_gallery__img">
+               </figure>
+            </div>
+        </div>
+        
+        <div class="FrameSlides"> 
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 38 </h3>
+
+            <div class="snapshot_gallery">
+
+               <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
+                 <img src="input_frame38.png" alt="The Input" class="snapshot_gallery__img">
+               </figure>
+
+               <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
+                 <img src="phase_frame38.png" alt="Phase" class="snapshot_gallery__img">
+               </figure>
+
+               <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
+                 <img src="period_frame38.png" alt="Period" class="snapshot_gallery__img">
+               </figure>
+
+               <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
+                 <img src="amplitude_frame38.png" alt="Amplitude" class="snapshot_gallery__img">
                </figure>
             </div>
         </div>
         
         <div class="FrameSlides"> 
-        <h3 style="text-align:center; color=#363333"> Frame Nr. 34 </h3>
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 47 </h3>
 
             <div class="snapshot_gallery">
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
-                 <img src="input_frame34.png" alt="The Input" class="snapshot_gallery__img">
+                 <img src="input_frame47.png" alt="The Input" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
-                 <img src="phase_frame34.png" alt="Phase" class="snapshot_gallery__img">
+                 <img src="phase_frame47.png" alt="Phase" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
-                 <img src="period_frame34.png" alt="Period" class="snapshot_gallery__img">
+                 <img src="period_frame47.png" alt="Period" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
-                 <img src="amplitude_frame34.png" alt="Amplitude" class="snapshot_gallery__img">
+                 <img src="amplitude_frame47.png" alt="Amplitude" class="snapshot_gallery__img">
                </figure>
             </div>
         </div>
         
         <div class="FrameSlides"> 
-        <h3 style="text-align:center; color=#363333"> Frame Nr. 50 </h3>
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 56 </h3>
 
             <div class="snapshot_gallery">
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
-                 <img src="input_frame50.png" alt="The Input" class="snapshot_gallery__img">
+                 <img src="input_frame56.png" alt="The Input" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
-                 <img src="phase_frame50.png" alt="Phase" class="snapshot_gallery__img">
+                 <img src="phase_frame56.png" alt="Phase" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
-                 <img src="period_frame50.png" alt="Period" class="snapshot_gallery__img">
+                 <img src="period_frame56.png" alt="Period" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
-                 <img src="amplitude_frame50.png" alt="Amplitude" class="snapshot_gallery__img">
+                 <img src="amplitude_frame56.png" alt="Amplitude" class="snapshot_gallery__img">
                </figure>
             </div>
         </div>
         
         <div class="FrameSlides"> 
-        <h3 style="text-align:center; color=#363333"> Frame Nr. 66 </h3>
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 65 </h3>
 
             <div class="snapshot_gallery">
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
-                 <img src="input_frame66.png" alt="The Input" class="snapshot_gallery__img">
+                 <img src="input_frame65.png" alt="The Input" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
-                 <img src="phase_frame66.png" alt="Phase" class="snapshot_gallery__img">
+                 <img src="phase_frame65.png" alt="Phase" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
-                 <img src="period_frame66.png" alt="Period" class="snapshot_gallery__img">
+                 <img src="period_frame65.png" alt="Period" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
-                 <img src="amplitude_frame66.png" alt="Amplitude" class="snapshot_gallery__img">
+                 <img src="amplitude_frame65.png" alt="Amplitude" class="snapshot_gallery__img">
                </figure>
             </div>
         </div>
         
         <div class="FrameSlides"> 
-        <h3 style="text-align:center; color=#363333"> Frame Nr. 82 </h3>
+        <h3 style="text-align:center; color=#363333"> Frame Nr. 74 </h3>
 
             <div class="snapshot_gallery">
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--1">
-                 <img src="input_frame82.png" alt="The Input" class="snapshot_gallery__img">
+                 <img src="input_frame74.png" alt="The Input" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--2">
-                 <img src="phase_frame82.png" alt="Phase" class="snapshot_gallery__img">
+                 <img src="phase_frame74.png" alt="Phase" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--3">
-                 <img src="period_frame82.png" alt="Period" class="snapshot_gallery__img">
+                 <img src="period_frame74.png" alt="Period" class="snapshot_gallery__img">
                </figure>
 
                <figure class=”snapshot_gallery__item snapshot_gallery__item--4">
-                 <img src="amplitude_frame82.png" alt="Amplitude" class="snapshot_gallery__img">
+                 <img src="amplitude_frame74.png" alt="Amplitude" class="snapshot_gallery__img">
                </figure>
             </div>
         </div>
--- a/SpyBOAT.xml	Tue Nov 24 13:06:26 2020 +0000
+++ b/SpyBOAT.xml	Thu Nov 26 16:40:47 2020 +0000
@@ -1,6 +1,11 @@
-<tool id="SpyBOAT" name="SpyBOAT" version="0.1.0">
+<tool id="spyboat" name="SpyBOAT" version="@TOOL_VERSION@">
+<description>wavelet transforms image stacks</description>
+  <macros>
+    <token name="@TOOL_VERSION@">0.1.1</token>
+  </macros>
+  
     <requirements>
-        <requirement type="package" version="0.1.0">spyboat</requirement>
+      <requirement type="package" version="@TOOL_VERSION@">spyboat</requirement>
     </requirements>
     <version_command>python $__tool_directory__/spyboat_cli.py --version</version_command>
     <command detect_errors="exit_code"><![CDATA[
@@ -47,10 +52,11 @@
           --ncpu "\${GALAXY_SLOTS:-8}"
           > $log
 
-    ]]></command>
+	  ]]></command>
+    <!-- "\${GALAXY_SLOTS:-8}" -->
     <inputs>
-        <param name="movie" type="data" format="tiff" label="Movie to process"
-               help="Select a movie to Wavelet process"/>
+        <param name="movie" type="data" format="tiff" label="Movie to analyze"
+               help="Select a movie to wavelet analyze"/>
 
         <!--
         The following Wavelet parameters must have the same numerical type as defined in the
@@ -74,6 +80,8 @@
                 <option value="create_static_mask">Create a static mask</option>
 		<option value="create_dynamic_mask">Create a dynamic mask</option>
 	    </param>
+            <when value="no_masking">
+	    </when>
             <when value="create_static_mask">
                 <param name="mask_frame" type="integer" value="1" label="Create mask from frame"
                        help="Creates a static mask from the chosen frame of the input movie.">
@@ -95,12 +103,12 @@
         <param name="dt" type="float" value="1" label="Sampling interval" help="Time span between two frames">
             <validator type="in_range" min="0" max="9999999"/>
         </param>
-        <param name="tmin" type="float" value="2" label="Smallest period" help="Minimal period to scan for">
+        <param name="tmin" type="float" value="20" label="Smallest period" help="Lowest period for the wavelet transform">
             <validator type="in_range" min="0" max="9999999"/>
         </param>
 
         <param name="tmax" type="float" value="30" label="Largest period"
-               help="Maximal period to scan for">
+               help="Largest period for the wavelet transform">
             <validator type="in_range" min="0" max="9999999"/>
         </param>
 
@@ -125,26 +133,31 @@
                 <option selected="true" value="No">No</option>
                 <option value="Yes">Yes</option>
 	    </param>
+	    <!-- there is an output filter picking up the choice -->
+	    <when value="No">
+	    </when>
+	    <when value="Yes">
+	    </when>	    
 	</conditional>
     </inputs>
 
     <outputs>
-        <data name="phase_out" format="tiff" label="phase_${movie.name}"/>
-        <data name="period_out" format="tiff" label="period_${movie.name}"/>
-        <data name="power_out" format="tiff" label="power_${movie.name}"/>
-        <data name="amplitude_out" format="tiff" label="amplitude_${movie.name}"/>
-	<data name="preprocessed_out" format="tiff" label="preproc_${movie.name}">
+        <data name="phase_out" format="tiff" label="${movie.name[:-4]}_phase"/>
+        <data name="period_out" format="tiff" label="${movie.name[:-4]}_period"/>
+        <data name="power_out" format="tiff" label="${movie.name[:-4]}_power"/>
+        <data name="amplitude_out" format="tiff" label="${movie.name[:-4]}_amplitude"/>
+	<data name="preprocessed_out" format="tiff" label="${movie.namee[:-4]}_preproc">
 	  <filter>save_preprocessed['selection'] == 'Yes'</filter>
 	</data>
 	
-        <data name="log" format="txt" label="log_${movie.name}.txt"/>
-	<data format="html" name="html_out" label="Report_${movie.name}"/>
+        <data name="log" format="txt" label="log ${movie.name[:-4]}.txt"/>
+	<data format="html" name="html_out" label="Report ${movie.name[:-4]}"/>
 
     </outputs>
 
     <tests>
         <test>
-            <param name="movie" value="test_movie.tif" ftype="tiff"/>
+            <param name="movie" value="test-movie.tif" ftype="tiff"/>
             <output name="phase_out" file="phase_out.tif" ftype="tiff" compare="sim_size"/>
             <output name="period_out" file="period_out.tif" ftype="tiff" compare="sim_size"/>
             <output name="power_out" file="power_out.tif" ftype="tiff" compare="sim_size"/>
@@ -220,5 +233,16 @@
         advantage is that signal with strong amplitude trends will have more
 	meaningful Wavelet powers after normalization.
 
-    ]]></help>
+	]]></help>
+    <citations>
+
+     <citation type="bibtex"> @article{monke2020optimal,
+  title={Optimal time frequency analysis for biological data-pyBOAT},
+  author={M{\"o}nke, Gregor and Sorgenfrei, Frieda A and Schmal, Christoph and Granada, Adri{\'a}n E},
+  journal={bioRxiv},
+  year={2020},
+  publisher={Cold Spring Harbor Laboratory}
+}      
+   </citation>
+ </citations>
 </tool>
Binary file __pycache__/output_report.cpython-38.pyc has changed
Binary file amplitude_frame0.png has changed
Binary file amplitude_frame16.png has changed
Binary file amplitude_frame18.png has changed
Binary file amplitude_frame2.png has changed
Binary file amplitude_frame20.png has changed
Binary file amplitude_frame32.png has changed
Binary file amplitude_frame34.png has changed
Binary file amplitude_frame40.png has changed
Binary file amplitude_frame48.png has changed
Binary file amplitude_frame50.png has changed
Binary file amplitude_frame60.png has changed
Binary file amplitude_frame64.png has changed
Binary file amplitude_frame66.png has changed
Binary file amplitude_frame80.png has changed
Binary file amplitude_frame82.png has changed
Binary file amplitude_frame96.png has changed
Binary file amplitude_twosines_out.tif has changed
Binary file input_frame0.png has changed
Binary file input_frame16.png has changed
Binary file input_frame18.png has changed
Binary file input_frame2.png has changed
Binary file input_frame20.png has changed
Binary file input_frame32.png has changed
Binary file input_frame34.png has changed
Binary file input_frame40.png has changed
Binary file input_frame48.png has changed
Binary file input_frame50.png has changed
Binary file input_frame60.png has changed
Binary file input_frame64.png has changed
Binary file input_frame66.png has changed
Binary file input_frame80.png has changed
Binary file input_frame82.png has changed
Binary file input_frame96.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/notes.md	Thu Nov 26 16:40:47 2020 +0000
@@ -0,0 +1,27 @@
+## Notes for setting up the SpyBOAT Galaxy tool
+
+### Toolshed(s)
+
+Register at:
+
+- https://testtoolshed.g2.bx.psu.edu/
+- https://toolshed.g2.bx.psu.edu/
+
+
+### commands
+
+First put toolshed account details into `.planemo.yml`
+
+- planemo lint [tool.xml]
+- planemo shed_init --name spyboat
+- planemo shed_create --shed_target testtoolshed
+- planemo shed_update --shed_target toolshed
+
+
+### Hosting repo
+
+- https://github.com/galaxyproject/tools-iuc
+
+#### Guidelines
+
+- https://galaxy-iuc-standards.readthedocs.io/en/latest/best_practices/tool_xml.html
\ No newline at end of file
--- a/output_report.py	Tue Nov 24 13:06:26 2020 +0000
+++ b/output_report.py	Thu Nov 26 16:40:47 2020 +0000
@@ -48,7 +48,7 @@
     ppl.close(fig)
 
     spyplot.period_snapshot(results['period'][frame],
-                            Wkwargs,
+                            Wkwargs['Tmin'],Wkwargs['Tmax'],
                             time_unit = 'a.u.')
     
     fig = ppl.gcf()
@@ -130,6 +130,7 @@
     
     html_string =f'''
     <html>
+    <!-- this file got automatically created by 'output_report.py' -->
     <title>SpyBOAT Output Report</title>
     <head>
         <!-- that doesn't work with galaxy.. -->
Binary file period_distr.png has changed
Binary file period_frame0.png has changed
Binary file period_frame16.png has changed
Binary file period_frame18.png has changed
Binary file period_frame2.png has changed
Binary file period_frame20.png has changed
Binary file period_frame32.png has changed
Binary file period_frame34.png has changed
Binary file period_frame40.png has changed
Binary file period_frame48.png has changed
Binary file period_frame50.png has changed
Binary file period_frame60.png has changed
Binary file period_frame64.png has changed
Binary file period_frame66.png has changed
Binary file period_frame80.png has changed
Binary file period_frame82.png has changed
Binary file period_frame96.png has changed
Binary file period_twosines_out.tif has changed
Binary file phase_distr.png has changed
Binary file phase_frame0.png has changed
Binary file phase_frame16.png has changed
Binary file phase_frame18.png has changed
Binary file phase_frame2.png has changed
Binary file phase_frame20.png has changed
Binary file phase_frame32.png has changed
Binary file phase_frame34.png has changed
Binary file phase_frame40.png has changed
Binary file phase_frame48.png has changed
Binary file phase_frame50.png has changed
Binary file phase_frame60.png has changed
Binary file phase_frame64.png has changed
Binary file phase_frame66.png has changed
Binary file phase_frame80.png has changed
Binary file phase_frame82.png has changed
Binary file phase_frame96.png has changed
Binary file phase_twosines_out.tif has changed
Binary file power_distr.png has changed
Binary file power_twosines_out.tif has changed
Binary file preproc_two_sines.tif has changed
--- a/run_tests.sh	Tue Nov 24 13:06:26 2020 +0000
+++ b/run_tests.sh	Thu Nov 26 16:40:47 2020 +0000
@@ -4,9 +4,8 @@
 INPUT_PATH='./test-data/test-movie.tif'
 SCRIPT_PATH='.'
 
-python3 $SCRIPT_PATH/spyboat_cli.py --input_path $INPUT_PATH --phase_out phase_twosines_out.tif --period_out period_twosines_out.tif --power_out power_twosines_out.tif  --amplitude_out amplitude_twosines_out.tif --dt 1 --Tmin 2 --Tmax 30 --nT 200 --ncpu 6 --masking dynamic --preprocessed_out preproc_two_sines.tif --gauss_sigma 3 --rescale 80 --Tcutoff 40 --masking static --mask_frame 10 --mask_thresh 8
+python3 $SCRIPT_PATH/spyboat_cli.py --input_path $INPUT_PATH --phase_out phase_test-movie.tif --period_out period_test-movie.tif --power_out power_test-movie.tif  --amplitude_out amplitude_test-movie.tif --dt 1 --Tmin 20 --Tmax 30 --nT 200 --ncpu 6 --masking dynamic --preprocessed_out preproc_two_sines.tif --gauss_sigma 2 --rescale 80 --Tcutoff 40 --masking static --mask_frame 10 --mask_thresh 300
 
 printf "\n"
 # printf "\nError examples:\n"
 
-# python3 $SCRIPT_PATH/cl_wrapper.py --input_path $INPUT_PATH --phase_out phase_twosines_out.tif --period_out period_twosines_out.tif --power_out power_twosines_out.tif  --amplitude_out amplitude_twosines_out.tif --dt 2. --Tmin 20 --Tmax 30 --nT 200 --ncpu 6 --save_input True --masking fixed
--- a/spyboat_cli.py	Tue Nov 24 13:06:26 2020 +0000
+++ b/spyboat_cli.py	Thu Nov 26 16:40:47 2020 +0000
@@ -12,7 +12,7 @@
 import output_report
 
 logging.basicConfig(level=logging.INFO, stream=sys.stdout, force=True)
-logger = logging.getLogger('wrapper')
+logger = logging.getLogger('spyboat-cli')
 
 # ----------command line parameters ---------------
 
@@ -79,9 +79,10 @@
     movie = spyboat.open_tif(arguments.input_path)
 except FileNotFoundError:
     logger.critical(f"Couldn't open {arguments.input_path}, check movie storage directory!")
-
     sys.exit(1)
-
+# problems get logged in 'open_tif'
+if movie is None:
+    sys.exit(1)
 # -------- Do (optional) spatial downsampling ---------------------------
 
 scale_factor = arguments.rescale
@@ -162,8 +163,8 @@
         logger.info(f'Creating report directory {arguments.report_img_path}')
         os.mkdir(arguments.report_img_path)    
 
-    # make 6 times 4 snapshots each
-    Nsnap = 6
+    # 4 snapshots each
+    Nsnap = 7
     NFrames = movie.shape[0]
     # show only frames at least one Tmin
     # away from the edge (-effects)
Binary file test-data/test-movie.tif has changed