Mercurial > repos > watsocam > palom
comparison palom_svs.xml @ 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 |
comparison
equal
deleted
inserted
replaced
| 1:69f8e01b2e17 | 2:e30f622ef2c3 |
|---|---|
| 1 <tool id="palom" name="palom" version="2021.12.0.1"> | 1 <tool id="palom" name="palom" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
| 2 <description>Piecewise alignment for layers of mosaics. A tool for registering whole-slide images with different IHC stainings</description> | 2 <description>Piecewise alignment for layers of image mosaics.</description> |
| 3 | |
| 3 <macros> | 4 <macros> |
| 4 <import>macros.xml</import> | 5 <import>macros.xml</import> |
| 5 </macros> | 6 </macros> |
| 7 | |
| 6 <expand macro="requirements" /> | 8 <expand macro="requirements" /> |
| 9 | |
| 7 <command detect_errors="exit_code"><![CDATA[ | 10 <command detect_errors="exit_code"><![CDATA[ |
| 8 | 11 |
| 9 ln -s "$reference_image" ./ref.svs && | 12 ln -s '$reference_image' './ref.svs' && |
| 10 | 13 |
| 11 ln -s "$channels" ./channels.csv && | 14 ln -s '$channels' './channels.csv' && |
| 12 | 15 |
| 13 #for $i in $moving_images: | 16 #for $i in $moving_images: |
| 14 ln -s "$i" "${i.name}" && | 17 ln -s '$i' '${i.name}' && |
| 15 #end for | 18 #end for |
| 16 | 19 |
| 17 python "$script" | 20 python '$script' |
| 18 | 21 |
| 19 ]]></command> | 22 ]]></command> |
| 20 <configfiles> | 23 <configfiles> |
| 21 <configfile name = "script"> | 24 <configfile name = "script"> |
| 22 import os | 25 import os |
| 23 import pathlib | 26 import pathlib |
| 24 import pandas as pd | 27 import pandas as pd |
| 28 import matplotlib.pyplot as plt | |
| 25 import palom | 29 import palom |
| 26 from palom.cli.svs import run_palom | 30 from palom.cli.svs import run_palom |
| 27 | 31 |
| 32 plt.switch_backend('agg') | |
| 33 | |
| 28 cwd = os.getcwd() | 34 cwd = os.getcwd() |
| 29 | 35 |
| 30 ref_img = pathlib.Path(os.path.join(cwd,"ref.svs")) | 36 ref_img = pathlib.Path(os.path.join(cwd,'ref.svs')) |
| 31 | 37 |
| 32 images = [ref_img] | 38 images = [ref_img] |
| 33 channels = ["hematoxylin"] | 39 channels = ['hematoxylin'] |
| 34 modes = ["hematoxylin"] | 40 modes = ['hematoxylin'] |
| 35 | 41 |
| 36 #for $i in $moving_images: | 42 #for $i in $moving_images: |
| 37 img = pathlib.Path("${i.name}") | 43 img = pathlib.Path('${i.name}') |
| 38 images.append(img) | 44 images.append(img) |
| 39 #end for | 45 #end for |
| 40 | 46 |
| 41 channel_df = pd.read_csv(os.path.join(cwd, "channels.csv")) | 47 channel_df = pd.read_csv(os.path.join(cwd, 'channels.csv')) |
| 42 channel_df = channel_df.astype({'channel':'string'}) | 48 channel_df = channel_df.astype({'channel':'string'}) |
| 43 channels += list(channel_df['channel']) | 49 channels += list(channel_df['channel']) |
| 44 modes += list(channel_df['mode']) | 50 modes += list(channel_df['mode']) |
| 45 | 51 |
| 46 pixel_size = None | 52 pixel_size = None |
| 47 | 53 |
| 48 #if $pixel_size: | 54 #if $pixel_size: |
| 49 pixel_size = float($pixel_size) | 55 pixel_size = float($pixel_size) |
| 50 #end if | 56 #end if |
| 51 | 57 |
| 52 level = 0 | 58 level = int($level) |
| 59 downscale_factor = int($downscale_factor) | |
| 53 | 60 |
| 54 #if $level: | 61 output_path = pathlib.Path(os.path.join(cwd, 'registered.ome.tiff')) |
| 55 level = int($level) | |
| 56 #end if | |
| 57 | |
| 58 output_path = pathlib.Path(os.path.join(cwd, "registered.ome.tiff")) | |
| 59 | 62 |
| 60 qc_path = output_path.parent / 'qc' | 63 qc_path = output_path.parent / 'qc' |
| 61 | 64 |
| 62 os.mkdir(qc_path) | 65 os.mkdir(qc_path) |
| 63 | 66 |
| 66 img_modes = modes, | 69 img_modes = modes, |
| 67 pixel_size = pixel_size, | 70 pixel_size = pixel_size, |
| 68 channel_names = channels, | 71 channel_names = channels, |
| 69 output_path = output_path, | 72 output_path = output_path, |
| 70 qc_path = qc_path, | 73 qc_path = qc_path, |
| 71 level = level | 74 level = level, |
| 75 downscale_factor = downscale_factor | |
| 72 ) | 76 ) |
| 73 </configfile> | 77 </configfile> |
| 74 </configfiles> | 78 </configfiles> |
| 75 <inputs> | 79 <inputs> |
| 76 <param name="reference_image" type="data" format="tiff" label="Hematoxylin reference image" help="An H+E image in .svs format"/> | 80 <param name="reference_image" type="data" format="tiff" label="Hematoxylin reference image" help=".svs format image to align to"/> |
| 77 <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"/> | 81 <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"/> |
| 78 <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"/> | 82 <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"/> |
| 79 <param name="pixel_size" type="float" optional="true" label="Pixel Size" help="defaults to px size of reference image"/> | 83 <param name="pixel_size" type="float" optional="true" label="Pixel size (optional)" help="defaults to px size of reference image"/> |
| 80 <param name="level" type="integer" optional="true" label="Level" help="pyramid level, defaults to 0 (lowest level)"/> | 84 <param name="level" type="integer" value="0" label="Pyramid level" help="pyramid level, defaults to 0 (lowest level)"/> |
| 85 <param name="downscale_factor" type="integer" value="2" label="Pyramid downscale factor" help="Default of 2 makes pyramid downscaling compatible with Avivator and Vitessce"/> | |
| 81 </inputs> | 86 </inputs> |
| 82 <outputs> | 87 <outputs> |
| 83 <collection name="qc_plots" type="list" label="${tool.name}: qc_plots"> | 88 <collection name="qc_plots" type="list" label="${tool.name}: qc_plots"> |
| 84 <discover_datasets pattern="__name_and_ext__" directory="qc" ext="png" visible="false"/> | 89 <discover_datasets pattern="__name_and_ext__" directory="qc" ext="png" visible="false"/> |
| 85 </collection> | 90 </collection> |
| 86 <data name="registered" from_work_dir="registered.ome.tiff" format="ome.tiff"/> | 91 <data name="registered" from_work_dir="registered.ome.tiff" format="ome.tiff"/> |
| 87 </outputs> | 92 </outputs> |
| 93 <tests> | |
| 94 <test> | |
| 95 <param name="reference_image" value="test_ref.svs"/> | |
| 96 <param name="moving_images"> | |
| 97 <collection type="list"> | |
| 98 <element name="m1" value="test_moving.svs"/> | |
| 99 </collection> | |
| 100 </param> | |
| 101 <param name="channels" value="test_channels.csv"/> | |
| 102 <param name="level" value="1"/> | |
| 103 <output_collection name="qc_plots" type="list"> | |
| 104 <element name="01-test_moving.svs" ftype="png"> | |
| 105 <assert_contents> | |
| 106 <has_size value="277000" delta="100000" /> | |
| 107 </assert_contents> | |
| 108 </element> | |
| 109 </output_collection> | |
| 110 <output name="registered" ftype="ome.tiff"> | |
| 111 <assert_contents> | |
| 112 <has_size value="59000000" delta="20000000" /> | |
| 113 </assert_contents> | |
| 114 </output> | |
| 115 </test> | |
| 116 </tests> | |
| 88 <help><![CDATA[ | 117 <help><![CDATA[ |
| 89 # PALOM | 118 ------ |
| 90 registration of whole-slide images with different IHC stainings | 119 PALOM |
| 120 ------ | |
| 121 **PALOM** performs registration of whole-slide images with different IHC stainings. | |
| 122 **Inputs** | |
| 123 1.) Reference image for aligning image mosiacs to | |
| 124 2.) A collection of images to be aligned | |
| 125 3.) File describing the channels/targets | |
| 91 | 126 |
| 92 Tool github: https://github.com/Yu-AnChen/palom | 127 **Outputs** |
| 128 1.) Registered image as ome.tiff | |
| 129 2.) Colleciton of QC plots | |
| 93 | 130 |
| 94 # Main developer | 131 More details on Github: https://github.com/Yu-AnChen/palom |
| 95 | 132 |
| 96 Yu-An Chen (https://github.com/Yu-AnChen) | |
| 97 ]]></help> | 133 ]]></help> |
| 98 <expand macro="citations" /> | 134 <expand macro="citations" /> |
| 99 </tool> | 135 </tool> |
