|
| 1 | +<tool id="bellavista_prepare" name="Bellavista" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
| 2 | + <description>Prepare large images for bellavista visualizer</description> |
| 3 | + <creator> |
| 4 | + <organization name="European Galaxy Team" url="https://galaxyproject.org/eu/" /> |
| 5 | + < person givenName= "Amirhossein" familyName= "Naghsh Nilchi" email= "[email protected]" /> |
| 6 | + < person givenName= "Pavan" familyName= "Videm" email= "[email protected]" /> |
| 7 | + < person givenName= "Björn" familyName= "Grüning" email= "[email protected]" /> |
| 8 | + </creator> |
| 9 | + <macros> |
| 10 | + <import>macros.xml</import> |
| 11 | + </macros> |
| 12 | + <expand macro="requirements"/> |
| 13 | + <command detect_errors="exit_code"><![CDATA[ |
| 14 | + export TIME_LIMIT_SECONDS=$timeout && |
| 15 | + export BELLAVISTA_DIR=`pwd`/input/ && |
| 16 | + mkdir -p 'input' 'input/BellaVista_output' && |
| 17 | + chmod -R 777 'input/' && |
| 18 | + #if $technology_conditional.plot_genes.plot_transcripts == "true": |
| 19 | + ln -s '$technology_conditional.plot_genes.transcript_filename' './input/${technology_conditional.plot_genes.transcript_filename.element_identifier}.${technology_conditional.plot_genes.transcript_filename.ext}' && |
| 20 | + #end if |
| 21 | + #for $image in $technology_conditional.images: |
| 22 | + ln -s '$image' 'input/${image.element_identifier}.${image.ext}' && |
| 23 | + #end for |
| 24 | + ln -s '$bellavista_config_file' './input/config.json' && |
| 25 | + #if $technology_conditional.plot_cell_segmentation.plot_cell_seg == "true": |
| 26 | + ln -s '$technology_conditional.plot_cell_segmentation.cell_segmentation' './input/${technology_conditional.plot_cell_segmentation.cell_segmentation.element_identifier}.${technology_conditional.plot_cell_segmentation.cell_segmentation.ext}' && |
| 27 | + #end if |
| 28 | + #if $technology_conditional.plot_nuclear_segmentation.plot_nuclear_seg == "true": |
| 29 | + ln -s '$technology_conditional.plot_nuclear_segmentation.nuclear_segmentation' './input/${technology_conditional.plot_nuclear_segmentation.nuclear_segmentation.element_identifier}.${technology_conditional.plot_nuclear_segmentation.nuclear_segmentation.ext}' && |
| 30 | + #end if |
| 31 | + #if $technology_conditional.technology == "MERSCOPE": |
| 32 | + ln -s '$technology_conditional.um_to_px_transform' './input/micron_to_mosaic_pixel_transform.csv' && |
| 33 | + #end if |
| 34 | + cat ./input/config.json && |
| 35 | +
|
| 36 | + cd "\$BELLAVISTA_DIR" && |
| 37 | + bash '$__tool_directory__/bellavista.bash' && |
| 38 | + cd .. && |
| 39 | +
|
| 40 | + tar -czf 'bellavista.tar.gz' 'input/BellaVista_output' |
| 41 | + ]]></command> |
| 42 | + <configfiles> |
| 43 | + <configfile name="bellavista_config_file"><![CDATA[ |
| 44 | + { |
| 45 | + "system": "$technology", |
| 46 | + "data_folder": "./", |
| 47 | + "create_bellavista_inputs": true, |
| 48 | +
|
| 49 | + "visualization_parameters": { |
| 50 | + "plot_image": true, |
| 51 | + #if $technology_conditional.plot_genes.plot_transcripts == "true": |
| 52 | + "plot_transcripts": true, |
| 53 | + #else |
| 54 | + "plot_transcripts": false, |
| 55 | + #end if |
| 56 | + #if $technology_conditional.plot_cell_segmentation.plot_cell_seg == "true": |
| 57 | + "plot_cell_seg": true, |
| 58 | + #else |
| 59 | + "plot_cell_seg": false, |
| 60 | + #end if |
| 61 | + #if $technology_conditional.plot_nuclear_segmentation.plot_nuclear_seg == "true": |
| 62 | + "plot_nuclear_seg": true, |
| 63 | + #else |
| 64 | + "plot_nuclear_seg": false, |
| 65 | + #end if |
| 66 | + "genes_visible_on_startup": false, |
| 67 | + #if $technology_conditional.plot_genes.plot_all_genes.all_genes == "Yes": |
| 68 | + "plot_allgenes": true, |
| 69 | + #else |
| 70 | + "plot_allgenes": false, |
| 71 | + #set $gene_list = ['"' + str(x.strip()) + '"' for x in str($technology_conditional.plot_genes.plot_all_genes.selected_genes).split(',')] |
| 72 | + #set $genes = ','.join($gene_list) |
| 73 | + "selected_genes": $genes, |
| 74 | + #end if |
| 75 | + "rotate_angle": $rotate_angle, |
| 76 | + "transcript_point_size": $transcript_point_size |
| 77 | + }, |
| 78 | +
|
| 79 | + "input_files": { |
| 80 | + #set $last_index = len($technology_conditional.images) - 1 |
| 81 | + "images": [ |
| 82 | + #for $i in range(len($images)): |
| 83 | + "$images[$i].element_identifier.$images[$i].ext"#if $i != $last_index#,#end if |
| 84 | + #end for |
| 85 | + ], |
| 86 | + #if $technology_conditional.plot_cell_segmentation.plot_cell_seg == "true": |
| 87 | + "cell_segmentation": "${technology_conditional.plot_cell_segmentation.cell_segmentation.element_identifier}.${technology_conditional.plot_cell_segmentation.cell_segmentation.ext}", |
| 88 | + #end if |
| 89 | + #if $technology_conditional.plot_nuclear_segmentation.plot_nuclear_seg == "true": |
| 90 | + "nuclear_segmentation": "${technology_conditional.plot_nuclear_segmentation.nuclear_segmentation.element_identifier}.${technology_conditional.plot_nuclear_segmentation.nuclear_segmentation.ext}", |
| 91 | + #end if |
| 92 | + #if $technology_conditional.technology == "MERSCOPE": |
| 93 | + "um_to_px_transform": "micron_to_mosaic_pixel_transform.csv", |
| 94 | + #end if |
| 95 | + #if $technology_conditional.plot_genes.plot_transcripts == "true": |
| 96 | + "transcript_filename": "${technology_conditional.plot_genes.transcript_filename.element_identifier}.${technology_conditional.plot_genes.transcript_filename.ext}", |
| 97 | + #end if |
| 98 | + "z_plane": $technology_conditional.z_plane |
| 99 | + } |
| 100 | + } |
| 101 | + ]]></configfile> |
| 102 | + </configfiles> |
| 103 | + <inputs> |
| 104 | + <conditional name="technology_conditional"> |
| 105 | + <param name="technology" type="select" label="Spatial transcriptomic technology"> |
| 106 | + <option value="Xenium">Xenium</option> |
| 107 | + <option value="MERSCOPE" selected="true">MERSCOPE</option> |
| 108 | + </param> |
| 109 | + <when value="Xenium"> |
| 110 | + <expand macro="common_param"/> |
| 111 | + </when> |
| 112 | + <when value="MERSCOPE"> |
| 113 | + <expand macro="common_param"> |
| 114 | + <param name="um_to_px_transform" type="data" format="csv" optional="false" label="micron to pixel transformations"/> |
| 115 | + </expand> |
| 116 | + </when> |
| 117 | + </conditional> |
| 118 | + <section name="advanced_output" title="Advanced output options"> |
| 119 | + <param name="config" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Output config file?"/> |
| 120 | + </section> |
| 121 | + <param name="timeout" type="hidden" min="0" max="21600" value="3600" label="timeout" help="hidden input to set timeout in seconds" /> |
| 122 | + </inputs> |
| 123 | + <outputs> |
| 124 | + <data name="bellavista_output" format="tar.gz" label="${tool.name} on ${on_string}: Bellavista prepared inputs" from_work_dir="./bellavista.tar.gz" /> |
| 125 | + <data name="config" format="json" label="${tool.name} on ${on_string}: config file" from_work_dir="input/config.json"> |
| 126 | + <filter>advanced_output['config']</filter> |
| 127 | + </data> |
| 128 | + </outputs> |
| 129 | + <tests> |
| 130 | + <test expect_num_outputs="2"> |
| 131 | + <conditional name="technology_conditional"> |
| 132 | + <param name="technology" value="MERSCOPE"/> |
| 133 | + <param name="images" location="https://zenodo.org/records/15319018/files/mosaic_PolyT_z3.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z4.tif"/> |
| 134 | + <conditional name="plot_genes"> |
| 135 | + <param name="plot_transcripts" value="true"/> |
| 136 | + <param name="transcript_filename" location="https://zenodo.org/records/15319018/files/detected_transcripts.csv"/> |
| 137 | + </conditional> |
| 138 | + <conditional name="plot_cell_segmentation"> |
| 139 | + <param name="plot_cell_seg" value="false"/> |
| 140 | + </conditional> |
| 141 | + <conditional name="plot_nuclear_segmentation"> |
| 142 | + <param name="plot_nuclear_seg" value="false"/> |
| 143 | + </conditional> |
| 144 | + <param name="um_to_px_transform" location="https://zenodo.org/records/15319018/files/micron_to_mosaic_pixel_transform.csv"/> |
| 145 | + <param name="z_plane" value="3"/> |
| 146 | + <param name="transcript_point_size" value="1"/> |
| 147 | + <param name="rotate_angle" value="0"/> |
| 148 | + </conditional> |
| 149 | + <section name="advanced_output"> |
| 150 | + <param name="config" value="true"/> |
| 151 | + </section> |
| 152 | + <output name="bellavista_output"> |
| 153 | + <assert_contents> |
| 154 | + <has_archive_member path="input/BellaVista_output/gene_dict.pkl"/> |
| 155 | + <has_archive_member path="input/BellaVista_output/OMEzarrImages"/> |
| 156 | + <has_archive_member path="input/BellaVista_output/um_to_px_transforms.pkl"/> |
| 157 | + </assert_contents> |
| 158 | + </output> |
| 159 | + <output name="config"> |
| 160 | + <assert_contents> |
| 161 | + <has_text text="MERSCOPE"/> |
| 162 | + <has_text text=""create_bellavista_inputs": true"/> |
| 163 | + <has_text text=""plot_cell_seg": false"/> |
| 164 | + </assert_contents> |
| 165 | + </output> |
| 166 | + <assert_stdout> |
| 167 | + <has_text text="Creating Bella Vista input files for Vizgen MERSCOPE"/> |
| 168 | + <has_text text="Bella Vista input files created!"/> |
| 169 | + <not_has_text text="Script completed."/> |
| 170 | + </assert_stdout> |
| 171 | + </test> |
| 172 | + <test expect_num_outputs="0"> |
| 173 | + <conditional name="technology_conditional"> |
| 174 | + <param name="technology" value="MERSCOPE"/> |
| 175 | + <param name="images" location="https://zenodo.org/records/15319018/files/mosaic_PolyT_z3.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z4.tif"/> |
| 176 | + <conditional name="plot_genes"> |
| 177 | + <param name="plot_transcripts" value="true"/> |
| 178 | + <param name="transcript_filename" location="https://zenodo.org/records/15319018/files/detected_transcripts.csv"/> |
| 179 | + </conditional> |
| 180 | + <conditional name="plot_cell_segmentation"> |
| 181 | + <param name="plot_cell_seg" value="false"/> |
| 182 | + </conditional> |
| 183 | + <conditional name="plot_nuclear_segmentation"> |
| 184 | + <param name="plot_nuclear_seg" value="false"/> |
| 185 | + </conditional> |
| 186 | + <param name="um_to_px_transform" location="https://zenodo.org/records/15319018/files/micron_to_mosaic_pixel_transform.csv"/> |
| 187 | + <param name="z_plane" value="3"/> |
| 188 | + <param name="transcript_point_size" value="1"/> |
| 189 | + <param name="rotate_angle" value="0"/> |
| 190 | + </conditional> |
| 191 | + <section name="advanced_output"> |
| 192 | + <param name="config" value="true"/> |
| 193 | + </section> |
| 194 | + <param name="timeout" value="1"/> |
| 195 | + <assert_stdout> |
| 196 | + <has_text text="Time limit of 1 seconds reached. Please contact admins. Stopping the tool..."/> |
| 197 | + <has_text text="Bella Vista stopped"/> |
| 198 | + <not_has_text text="Script completed."/> |
| 199 | + </assert_stdout> |
| 200 | + </test> |
| 201 | + </tests> |
| 202 | + <help><![CDATA[ |
| 203 | +BellaVista is an open-source visualization tool for imaging-based spatial transcriptomics data. It allows users to visualize and explore spatial transcriptomics data in a user-friendly interface. The tool supports MERSCOPE and Xenium imaging-based spatial transcriptomics technologies. |
| 204 | +
|
| 205 | +Users can customize the visualization by selecting specific genes, adjusting image rotation angles, and controlling the size of transcript points. BellaVista also provides options for plotting cell and nuclear segmentation, enhancing the exploration of spatial transcriptomics data. |
| 206 | +
|
| 207 | +.. image:: https://raw.githubusercontent.com/pkosurilab/BellaVista/c8129bb8954c92962a87606595c09b35cc414295/images/bellavista_figure.png |
| 208 | + :height: 500 |
| 209 | + :width: 700 |
| 210 | + ]]> |
| 211 | + </help> |
| 212 | + <expand macro="citations"/> |
| 213 | +</tool> |
0 commit comments