changeset 2:e30f622ef2c3 draft default tip

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/palom commit 08d9f2d59c26e67a162d75ae6e8b5fa734ab7b3c
author goeckslab
date Tue, 06 Sep 2022 21:15:56 +0000
parents 69f8e01b2e17
children
files Dockerfile macros.xml palom_svs.xml test-data/test_channels.csv test-data/test_moving.svs test-data/test_ref.svs
diffstat 6 files changed, 90 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Dockerfile	Tue Sep 06 21:15:56 2022 +0000
@@ -0,0 +1,18 @@
+FROM python:3.7.12
+
+ENV OPS_VERSION=3.4.1
+
+ENV PALOM_VERSION=2022.8.2
+
+RUN apt update -y && apt install -y openslide-tools python3-opencv
+
+RUN cd /opt && \
+    wget https://github.com/openslide/openslide/releases/download/v$OPS_VERSION/openslide-$OPS_VERSION.tar.gz && \
+    tar -zxvf openslide-$OPS_VERSION.tar.gz  && \
+    cd openslide-$OPS_VERSION
+
+RUN /opt/openslide-$OPS_VERSION/configure  && \
+    make && \
+    make install
+
+RUN pip install zarr==2.10.3 pandas palom==$PALOM_VERSION
\ No newline at end of file
--- a/macros.xml	Wed May 18 22:55:21 2022 +0000
+++ b/macros.xml	Tue Sep 06 21:15:56 2022 +0000
@@ -1,7 +1,7 @@
 <macros>
     <xml name="requirements">
         <requirements>
-            <container type="docker">quay.io/goeckslab/palom:2021.12.0</container>
+            <container type="docker">quay.io/goeckslab/palom:@TOOL_VERSION@</container>
         </requirements>
     </xml>
     <xml name="citations">
@@ -9,4 +9,7 @@
             <yield />
         </citations>
     </xml>
-</macros>
\ No newline at end of file
+    <token name="@TOOL_VERSION@">2022.8.2</token>
+    <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@PROFILE@">20.01</token>
+</macros>
--- a/palom_svs.xml	Wed May 18 22:55:21 2022 +0000
+++ b/palom_svs.xml	Tue Sep 06 21:15:56 2022 +0000
@@ -1,20 +1,23 @@
-<tool id="palom" name="palom" version="2021.12.0.1">
-    <description>Piecewise alignment for layers of mosaics. A tool for registering whole-slide images with different IHC stainings</description>
+<tool id="palom" name="palom" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
+    <description>Piecewise alignment for layers of image mosaics.</description>
+    
     <macros>
         <import>macros.xml</import>
     </macros>
+    
     <expand macro="requirements" />
+    
     <command detect_errors="exit_code"><![CDATA[
         
-        ln -s "$reference_image" ./ref.svs &&
+        ln -s '$reference_image' './ref.svs' &&
 
-        ln -s "$channels" ./channels.csv &&
+        ln -s '$channels' './channels.csv' &&
 
         #for $i in $moving_images:
-            ln -s "$i" "${i.name}" &&
+            ln -s '$i' '${i.name}' &&
         #end for
 
-        python "$script"
+        python '$script'
 
     ]]></command>
     <configfiles>
@@ -22,23 +25,26 @@
 import os
 import pathlib
 import pandas as pd
+import matplotlib.pyplot as plt 
 import palom
 from palom.cli.svs import run_palom
 
+plt.switch_backend('agg')
+
 cwd = os.getcwd()
 
-ref_img = pathlib.Path(os.path.join(cwd,"ref.svs"))
+ref_img = pathlib.Path(os.path.join(cwd,'ref.svs'))
 
 images = [ref_img]
-channels = ["hematoxylin"]
-modes = ["hematoxylin"]
+channels = ['hematoxylin']
+modes = ['hematoxylin']
 
 #for $i in $moving_images:
-img = pathlib.Path("${i.name}")
+img = pathlib.Path('${i.name}')
 images.append(img)
 #end for
 
-channel_df = pd.read_csv(os.path.join(cwd, "channels.csv"))
+channel_df = pd.read_csv(os.path.join(cwd, 'channels.csv'))
 channel_df = channel_df.astype({'channel':'string'})
 channels += list(channel_df['channel'])
 modes += list(channel_df['mode'])
@@ -49,13 +55,10 @@
 pixel_size = float($pixel_size)
 #end if
 
-level = 0
+level = int($level)
+downscale_factor = int($downscale_factor)
 
-#if $level:
-level = int($level)
-#end if
-
-output_path = pathlib.Path(os.path.join(cwd, "registered.ome.tiff"))
+output_path = pathlib.Path(os.path.join(cwd, 'registered.ome.tiff'))
 
 qc_path = output_path.parent / 'qc'
 
@@ -68,16 +71,18 @@
     channel_names = channels,
     output_path = output_path,
     qc_path = qc_path,
-    level = level
+    level = level,
+    downscale_factor = downscale_factor
 )
         </configfile>
     </configfiles>
     <inputs>
-        <param name="reference_image" type="data" format="tiff" label="Hematoxylin reference image" help="An H+E image in .svs format"/>
-        <param name="moving_images" type="data_collection" label="Moving Images (data collection)" help="A collection of svs-format images to align to the reference image"/>
-        <param name="channels" type="data" label="Channel and mode dataframe" help="A CSV file with 'channel' and 'mode' columns, with a row corresponding to each moving image"/>
-        <param name="pixel_size" type="float" optional="true" label="Pixel Size" help="defaults to px size of reference image"/>
-        <param name="level" type="integer" optional="true" label="Level" help="pyramid level, defaults to 0 (lowest level)"/>
+        <param name="reference_image" type="data" format="tiff" label="Hematoxylin reference image" help=".svs format image to align to"/>
+        <param name="moving_images" type="data_collection" label="Moving Images (data collection)" help="A collection of .svs format images to align to the reference image"/>
+        <param name="channels" type="data" label="Channel and mode dataframe" help="A CSV file with 'channel' and 'mode' columns, with a row for each moving image"/>
+        <param name="pixel_size" type="float" optional="true" label="Pixel size (optional)" help="defaults to px size of reference image"/>
+        <param name="level" type="integer" value="0" label="Pyramid level" help="pyramid level, defaults to 0 (lowest level)"/>
+        <param name="downscale_factor" type="integer" value="2" label="Pyramid downscale factor" help="Default of 2 makes pyramid downscaling compatible with Avivator and Vitessce"/>
     </inputs>
     <outputs>
         <collection name="qc_plots" type="list" label="${tool.name}: qc_plots">
@@ -85,15 +90,46 @@
         </collection>
         <data name="registered" from_work_dir="registered.ome.tiff" format="ome.tiff"/>
     </outputs>
+    <tests>
+        <test>
+            <param name="reference_image" value="test_ref.svs"/>
+            <param name="moving_images">
+                <collection type="list">
+                    <element name="m1" value="test_moving.svs"/>
+                </collection>
+            </param>
+            <param name="channels" value="test_channels.csv"/>
+            <param name="level" value="1"/>
+            <output_collection name="qc_plots" type="list">
+                <element name="01-test_moving.svs" ftype="png">
+                    <assert_contents>
+                        <has_size value="277000" delta="100000" />
+                    </assert_contents>
+                </element>
+            </output_collection>
+            <output name="registered" ftype="ome.tiff">
+                <assert_contents>
+                    <has_size value="59000000" delta="20000000" />
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
     <help><![CDATA[
-# PALOM
-registration of whole-slide images with different IHC stainings
+------
+PALOM
+------
+**PALOM** performs registration of whole-slide images with different IHC stainings.
+**Inputs**
+1.) Reference image for aligning image mosiacs to
+2.) A collection of images to be aligned
+3.) File describing the channels/targets
 
-Tool github: https://github.com/Yu-AnChen/palom
+**Outputs**
+1.) Registered image as ome.tiff
+2.) Colleciton of QC plots
 
-# Main developer 
+More details on Github: https://github.com/Yu-AnChen/palom
 
-Yu-An Chen (https://github.com/Yu-AnChen)
     ]]></help>
     <expand macro="citations" />
-</tool>
\ No newline at end of file
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_channels.csv	Tue Sep 06 21:15:56 2022 +0000
@@ -0,0 +1,2 @@
+channel,mode
+test,hematoxylin
Binary file test-data/test_moving.svs has changed
Binary file test-data/test_ref.svs has changed