diff main_macros.xml @ 0:9f60ef2d586e draft

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/vitessce commit 9b2dc921e692af8045773013d9f87d4d790e2ea1
author goeckslab
date Thu, 08 Sep 2022 17:23:33 +0000
parents
children 4bf852448b5d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main_macros.xml	Thu Sep 08 17:23:33 2022 +0000
@@ -0,0 +1,84 @@
+<macros>
+    <token name="@TOOL_VERSION@">1.0.4</token>
+    <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@PROFILE@">20.01</token>
+
+    <xml name="vitessce_requirements">
+        <requirements>
+            <container type="docker">quay.io/goeckslab/vitessce:@TOOL_VERSION@</container>
+        </requirements>
+    </xml>
+
+    <xml name="macro_stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error occurred. Please check Tool Standard Error" />
+        </stdio>
+    </xml>
+
+    <xml name="vitessce_cmd" token_tool_id="vitessce_spatial">
+        <command>
+        <![CDATA[
+        export BF_MAX_MEM="\${GALAXY_MEMORY_MB}m" &&
+        mkdir -p '${output.files_path}/A/0' &&
+        ln -sf '$image' '${output.files_path}/A/0/image01.ome.tiff' &&
+        #if $masks
+            info=\$(showinf -nopix -nometa -noflat '${output.files_path}/A/0/image01.ome.tiff') &&
+            echo '>showinf -nopix -nometa -noflat \$image' &&
+            echo "\$info\n" &&
+            masks_info=\$(showinf -nopix -nometa -noflat '$masks') &&
+            echo '>showinf -nopix -nometa -noflat \$masks' &&
+            echo "\$masks_info\n" &&
+            masks_n_resolutions=\$(echo "\$masks_info" | grep '^\s*Resolutions\s*=' -m1 | cut -d'=' -f2 | xargs) &&
+            if [ -z \$masks_n_resolutions ]; then
+                n_resolutions=\$(echo "\$info" | grep '^\s*Resolutions\s*=' -m1 | cut -d'=' -f2 | xargs) &&
+                pyramid_scale=1 &&
+                if [ -z "\$n_resolutions" ]; then
+                    echo "Warning: Failded to retrieve the number of pyramid resolutions. Set pyramid resolutions to 4 and scale to 2!";
+                    n_resolutions=4;
+                    pyramid_scale=2;
+                else
+                    echo "Found the number of pyramid resolutions: \$n_resolutions";
+                    if [ "\$n_resolutions" -gt 1 ]; then
+                        sizeX0=\$(echo "\$info" | grep '^\s*sizeX\[0\]\s*=' -m1 | cut -d'=' -f2 | xargs) ;
+                        sizeX1=\$(echo "\$info" | grep '^\s*sizeX\[1\]\s*=' -m1 | cut -d'=' -f2 | xargs) ;
+                        if [ "\$sizeX0" -gt 0 ] && [ "\$sizeX1" -gt 0 ]; then
+                            pyramid_scale=\$(((\$sizeX0 + \$sizeX1 / 2 ) / \$sizeX1));
+                            echo "Calculate pyramid scale: \$sizeX0 / \$sizeX1 ~= \$pyramid_scale.";
+                        else
+                            pyramid_scale=2;
+                            echo "Warning: Failed to calculate the pyramid scale; set it to 2!";
+                        fi;
+                    fi;
+                fi;
+                tile_info=\$(showinf -nopix -nometa -noflat '${output.files_path}/A/0/image01.ome.tiff' | grep '^\s*Tile\ssize\s*=' -m1);
+                tile_x=\$(echo "\$tile_info" | cut -d' ' -f4);
+                tile_y=\$(echo "\$tile_info" | cut -d' ' -f6);
+                convert_cmd="bfconvert -pyramid-resolutions \$n_resolutions -pyramid-scale \$pyramid_scale -noflat -tilex \$tile_x -tiley \$tile_y '$masks' '${output.files_path}/A/0/masks01.ome.tiff'";
+                echo "\n>\$convert_cmd";
+                eval \$convert_cmd;
+                masks_info_new=\$(showinf -nopix -nometa -noflat '${output.files_path}/A/0/masks01.ome.tiff');
+                echo "\n>showinf -nopix -nometa -noflat '${output.files_path}/A/0/masks01.ome.tiff'";
+                echo "\$masks_info_new\n";
+            else
+                ln -sf '$masks' '${output.files_path}/A/0/masks01.ome.tiff';
+            fi &&
+        #end if
+        python '$__tool_directory__/@TOOL_ID@.py'
+            --inputs '$inputs'
+            --output '${output.files_path}'
+            --image '${output.files_path}/A/0/image01.ome.tiff'
+            #if $masks
+                --masks '${output.files_path}/A/0/masks01.ome.tiff'
+            #end if
+            #if $do_phenotyping.phenotyping_choice
+            --anndata '$anndata'
+            #end if
+            &&
+        cp -R '$__tool_directory__/static' '${output.files_path}' &&
+        cp '$__tool_directory__/index.html' '$output';
+
+        ]]>
+        </command>
+    </xml>
+
+</macros>