Mercurial > repos > iuc > ampvis2_heatmap
comparison heatmap.xml @ 0:e88112233ce3 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 9ed0c3078be166bd22136771f517ae91a5198ecf
| author | iuc |
|---|---|
| date | Fri, 16 Aug 2024 08:56:04 +0000 |
| parents | |
| children | b95c7b3f411e |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:e88112233ce3 |
|---|---|
| 1 <tool id="ampvis2_heatmap" name="ampvis2 heatmap" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT"> | |
| 2 <description></description> | |
| 3 <macros> | |
| 4 <import>macros.xml</import> | |
| 5 </macros> | |
| 6 <expand macro="header"/> | |
| 7 <command detect_errors="exit_code"><![CDATA[ | |
| 8 Rscript '$rscript' | |
| 9 ]]></command> | |
| 10 <configfiles> | |
| 11 <configfile name="rscript"><![CDATA[ | |
| 12 #if $tax_add | |
| 13 #set ta='c("' + '", "'.join(str($tax_add).split(",")) + '")' | |
| 14 #else | |
| 15 #set ta='NULL' | |
| 16 #end if | |
| 17 library(ampvis2, quietly = TRUE) | |
| 18 d <- readRDS("$data") | |
| 19 #if $output_options.out_format == "tabular" | |
| 20 raw <- | |
| 21 #else | |
| 22 plot <- | |
| 23 #end if | |
| 24 amp_heatmap( | |
| 25 d | |
| 26 , | |
| 27 #if $group_by | |
| 28 group_by = "$group_by", | |
| 29 #end if | |
| 30 #if $facet_by | |
| 31 facet_by = "$facet_by", | |
| 32 #end if | |
| 33 normalise = $normalise, | |
| 34 tax_aggregate = "$tax_aggregate", | |
| 35 tax_add = $ta, | |
| 36 @TAX_SHOW@ | |
| 37 showRemainingTaxa = $showRemainingTaxa, | |
| 38 ## tax_class = NULL, | |
| 39 tax_empty = "$tax_empty", | |
| 40 ## TODO giving the order of the columns is difficult but "cluster" would be nice I guess | |
| 41 ## order_x_by = NULL, | |
| 42 ## order_y_by = NULL, | |
| 43 plot_values = $plot_values_cond.plot_values, | |
| 44 #if $plot_values_cond.plot_values == "TRUE" | |
| 45 plot_values_size = $plot_values_cond.plot_values_size, | |
| 46 #end if | |
| 47 ## plot_legendbreaks = NULL, | |
| 48 plot_colorscale = "$plot_colorscale", | |
| 49 plot_na = $plot_na, | |
| 50 measure = "$measure", | |
| 51 #if str($min_abundance) != '' | |
| 52 min_abundance = $min_abundance, | |
| 53 #end if | |
| 54 #if str($max_abundance) != '' | |
| 55 max_abundance = $max_abundance, | |
| 56 #end if | |
| 57 #if $sort_by_cond.sort_by_sel != 'no' | |
| 58 sort_by = "$sort_by_cond.sort_by", | |
| 59 #end if | |
| 60 #if $normalise_by | |
| 61 normalise_by = "$normalise_by", | |
| 62 #end if | |
| 63 #if $scale_by | |
| 64 scale_by = "$scale_by", | |
| 65 #end if | |
| 66 ## color_vector = NULL | |
| 67 ## round = 1, | |
| 68 #if $output_options.out_format == "tabular" | |
| 69 textmap = TRUE, | |
| 70 #else | |
| 71 textmap = FALSE, | |
| 72 #end if | |
| 73 #if $plot_functions_cond.plot_functions_sel != "no" | |
| 74 plot_functions = TRUE, | |
| 75 #if $plot_functions_cond.plot_functions_sel == "file" | |
| 76 function_data = read.table("$plot_functions_cond.function_data", header = TRUE, sep = "\t"), | |
| 77 #end if | |
| 78 #set foo='c("' + '", "'.join(str($plot_functions_cond.functions).split(",")) + '")' | |
| 79 functions = $foo, | |
| 80 #end if | |
| 81 rel_widths = c(0.75, 0.25) | |
| 82 ) | |
| 83 #if $output_options.out_format != "tabular" | |
| 84 @OUTPUT_TOKEN@ | |
| 85 #else | |
| 86 write.table(raw, file = "$plot_raw", sep = "\t") | |
| 87 #end if | |
| 88 ]]></configfile> | |
| 89 </configfiles> | |
| 90 <inputs> | |
| 91 <expand macro="rds_metadata_input_macro"/> | |
| 92 <expand macro="metadata_select_discrete" argument="group_by" label="Group samples" help="By a categorical variable in the metadata"/> | |
| 93 <expand macro="metadata_select_discrete" argument="facet_by" label="Facet the samples" help="By a categorical variable in the metadata."/> | |
| 94 <expand macro="normalise_macro" checked="true"/> | |
| 95 <expand macro="taxlevel_macro" argument="tax_aggregate" label="The taxonomic level to aggregate the OTUs"> | |
| 96 <option value="Phylum" selected="true">Phylum</option> | |
| 97 </expand> | |
| 98 <expand macro="taxlevel_macro" argument="tax_add" multiple="true" optional="true" label="Additional taxonomic level(s) to display"/> | |
| 99 <expand macro="tax_show_macro" value="10"/> | |
| 100 <param argument="showRemainingTaxa" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Display sum of remaining taxa" help="Add an additional row at the bottom displaying the sum of all remaining taxa that are not part of the top tax_show most abundant taxa."/> | |
| 101 <expand macro="tax_empty_macro"/> | |
| 102 <conditional name="plot_values_cond"> | |
| 103 <param argument="plot_values" type="select" label="Plot the values on the heatmap"> | |
| 104 <option value="TRUE">Yes</option> | |
| 105 <option value="FALSE">No</option> | |
| 106 </param> | |
| 107 <when value="TRUE"> | |
| 108 <param name="plot_values_size" type="integer" value="4" label="Size of the plotted values"/> | |
| 109 </when> | |
| 110 <when value="FALSE"/> | |
| 111 </conditional> | |
| 112 <param argument="plot_colorscale" type="select" label="Type of scale used for coloring abundances"> | |
| 113 <option value="sqrt">Square root (sqrt)</option> | |
| 114 <option value="log10" selected="true">Log (log10)</option> | |
| 115 </param> | |
| 116 <param argument="plot_na" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Color missing values with the lowest color in the scale"/> | |
| 117 <param argument="measure" type="select" label="Value to show across the groups"> | |
| 118 <option value="mean">Mean</option> | |
| 119 <option value="max">Maximum</option> | |
| 120 <option value="median">Median</option> | |
| 121 </param> | |
| 122 <param argument="min_abundance" type="float" value="0.1" min="0" optional="true" label="Maximum abundance" help="All values below this value are given the same color."/> | |
| 123 <param argument="max_abundance" type="float" value="" min="0" optional="true" label="Maximum abundance" help="All values above this value are given the same color." /> | |
| 124 | |
| 125 <conditional name="sort_by_cond"> | |
| 126 <param name="sort_by_sel" type="select" label="Sort heatmap by most abundant taxa"> | |
| 127 <option value="no">No</option> | |
| 128 <option value="group">in a group of samples</option> | |
| 129 <option value="sample">in a specific sample</option> | |
| 130 </param> | |
| 131 <when value="no"/> | |
| 132 <when value="group"> | |
| 133 <param argument="sort_by" type="select" optional="true" label="Group to sort by"> | |
| 134 <options from_dataset="metadata_list"> | |
| 135 <column name="name" index="1"/> | |
| 136 <column name="value" index="1"/> | |
| 137 <filter type="param_value" column="0" ref="group_by"/> | |
| 138 <filter type="unique_value" column="1"/> | |
| 139 </options> | |
| 140 </param> | |
| 141 </when> | |
| 142 <when value="sample"> | |
| 143 <param argument="sort_by" type="select" optional="true" label="Sample to sort by"> | |
| 144 <options from_dataset="metadata_list"> | |
| 145 <column name="name" index="1"/> | |
| 146 <column name="value" index="1"/> | |
| 147 <filter type="static_value" value="TRUE" column="2"/> <!-- filter samples --> | |
| 148 <filter type="unique_value" column="1"/> | |
| 149 </options> | |
| 150 </param> | |
| 151 </when> | |
| 152 </conditional> | |
| 153 <!-- https://github.com/KasperSkytte/ampvis2/issues/168 | |
| 154 if this is possible again reuse: metadata_sample_or_variable_select ? --> | |
| 155 <expand macro="metadata_sample_select" argument="normalise_by" label="Normalize counts by a variable or a specific sample"/> | |
| 156 <expand macro="metadata_select_discrete" argument="scale_by" label="Scale the abundances by a variable in the metadata"/> | |
| 157 | |
| 158 <conditional name="plot_functions_cond"> | |
| 159 <param name="plot_functions_sel" type="select" label="Show functional information about the Genus-level OTUs" help="Produces a 2-column grid plot, showing known functional information about the Genus-level OTUs next to the heatmap. When using this feature, make sure that either tax_aggregate or tax_add is set to Genus and that Genus is the lowest level in either."> | |
| 160 <option value="no">No</option> | |
| 161 <option value="midasfieldguide">Use data from midasfieldguide.org</option> | |
| 162 <option value="file">Use data from a dataset in the history</option> | |
| 163 </param> | |
| 164 <when value="no"/> | |
| 165 <when value="file"> | |
| 166 <!-- neeed tsv here since tabular does not fill the column_names | |
| 167 metadata and therefore the data_meta filter in the functions | |
| 168 select would not work--> | |
| 169 <param argument="function_data" type="data" format="tsv" label="Tabular dataset with functional information at Genus level" help="See help"/> | |
| 170 <param argument="functions" type="select" multiple="true" label="Function(s) to include"> | |
| 171 <options> | |
| 172 <filter type="data_meta" ref="function_data" key="column_names"/> | |
| 173 <filter type="remove_value" value="Genus"/> | |
| 174 </options> | |
| 175 </param> | |
| 176 </when> | |
| 177 <when value="midasfieldguide"> | |
| 178 <param name="functions" type="select" multiple="true" label="Function(s) to include"> | |
| 179 <option value="MiDAS" selected="true">MiDAS</option> | |
| 180 <option value="Filamentous" selected="true">Filamentous</option> | |
| 181 <option value="AOB" selected="true">AOB</option> | |
| 182 <option value="NOB" selected="true">PAO</option> | |
| 183 <option value="GAO" selected="true">GAO</option> | |
| 184 </param> | |
| 185 </when> | |
| 186 </conditional> | |
| 187 <expand macro="out_format_macro"> | |
| 188 <option value="tabular">Table</option> | |
| 189 </expand> | |
| 190 </inputs> | |
| 191 <outputs> | |
| 192 <expand macro="out_macro"> | |
| 193 <filter>output_options["out_format"] != "tabular"</filter> | |
| 194 </expand> | |
| 195 <data name="plot_raw" format="tabular" label="${tool.name} on ${on_string}: Table"> | |
| 196 <filter>output_options["out_format"] == "tabular"</filter> | |
| 197 </data> | |
| 198 </outputs> | |
| 199 <tests> | |
| 200 <!-- defaults --> | |
| 201 <test expect_num_outputs="1"> | |
| 202 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 203 <output name="plot" value="AalborgWWTPs-heatmap.pdf" ftype="pdf" compare="sim_size"/> | |
| 204 </test> | |
| 205 <!-- group and facet--> | |
| 206 <test expect_num_outputs="1"> | |
| 207 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 208 <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> | |
| 209 <param name="group_by" value="Plant"/> | |
| 210 <param name="facet_by" value="Year"/> | |
| 211 <output name="plot_raw" value="AalborgWWTPs-heatmap-group-facet.pdf" ftype="pdf" compare="sim_size"/> | |
| 212 </test> | |
| 213 <!-- group and facet and test raw output --> | |
| 214 <test expect_num_outputs="1"> | |
| 215 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 216 <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> | |
| 217 <param name="group_by" value="Plant"/> | |
| 218 <param name="facet_by" value="Year"/> | |
| 219 <param name="out_format" value="tabular"/> | |
| 220 <output name="plot_raw" value="AalborgWWTPs-heatmap-group-facet.tsv" ftype="tabular"/> | |
| 221 </test> | |
| 222 <!-- normalise --> | |
| 223 <test expect_num_outputs="1"> | |
| 224 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 225 <param name="normalise" value="true"/> | |
| 226 <output name="plot" value="AalborgWWTPs-heatmap-normalise.pdf" ftype="pdf" compare="sim_size"/> | |
| 227 </test> | |
| 228 <!-- normalise by a specific sample --> | |
| 229 <test expect_num_outputs="1"> | |
| 230 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 231 <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> | |
| 232 <param name="normalise" value="true"/> | |
| 233 <param name="normalise_by" value="16SAMP-747"/> | |
| 234 <output name="plot" value="AalborgWWTPs-heatmap-normalise_by_sample.pdf" ftype="pdf" compare="sim_size"/> | |
| 235 </test> | |
| 236 <!-- normalise by a metadata variable | |
| 237 https://github.com/KasperSkytte/ampvis2/issues/168 --> | |
| 238 <!-- <test expect_num_outputs="1"> | |
| 239 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 240 <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> | |
| 241 <param name="group_by" value="Plant"/> | |
| 242 <conditional name="normalise_by_cond"> | |
| 243 <param name="normalise_by_sel" value="variable"/> | |
| 244 <param name="normalise_by" value="Plant"/> | |
| 245 </conditional> | |
| 246 <output name="plot" value="AalborgWWTPs-heatmap-normalise_by_variable.pdf" ftype="pdf"/> | |
| 247 </test> --> | |
| 248 <!-- tax options --> | |
| 249 <test expect_num_outputs="1"> | |
| 250 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 251 <param name="tax_aggregate" value="Order"/> | |
| 252 <param name="tax_add" value="Class"/> | |
| 253 <param name="tax_show" value="5"/> | |
| 254 <param name="showRemainingTaxa" value="true"/> | |
| 255 <output name="plot" value="AalborgWWTPs-heatmap-tax.pdf" ftype="pdf" compare="sim_size"/> | |
| 256 </test> | |
| 257 <!-- sort by a specific sample --> | |
| 258 <test expect_num_outputs="1"> | |
| 259 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 260 <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> | |
| 261 <conditional name="sort_by_cond"> | |
| 262 <param name="sort_by_sel" value="sample"/> | |
| 263 <param name="sort_by" value="16SAMP-747"/> | |
| 264 </conditional> | |
| 265 <output name="plot" value="AalborgWWTPs-heatmap-sort_by_sample.pdf" ftype="pdf" compare="sim_size"/> | |
| 266 </test> | |
| 267 <!-- sort by a group of samples --> | |
| 268 <test expect_num_outputs="1"> | |
| 269 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 270 <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> | |
| 271 <param name="group_by" value="Period"/> | |
| 272 <conditional name="sort_by_cond"> | |
| 273 <param name="sort_by_sel" value="group"/> | |
| 274 <param name="sort_by" value="Winter"/> | |
| 275 </conditional> | |
| 276 <output name="plot" value="AalborgWWTPs-heatmap-sort_by_group.pdf" ftype="pdf" compare="sim_size"/> | |
| 277 </test> | |
| 278 <test expect_num_outputs="1"> | |
| 279 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 280 <param name="tax_aggregate" value="Genus"/> | |
| 281 <conditional name="plot_functions_cond"> | |
| 282 <param name="plot_functions_sel" value="midasfieldguide"/> | |
| 283 <param name="functions" value="MiDAS,Filamentous,AOB,NOB,GAO"/> | |
| 284 </conditional> | |
| 285 <output name="plot" value="AalborgWWTPs-heatmap-plot_foo_midas.pdf" ftype="pdf" compare="sim_size"/> | |
| 286 </test> | |
| 287 <test expect_num_outputs="1"> | |
| 288 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
| 289 <param name="tax_aggregate" value="Genus"/> | |
| 290 <conditional name="plot_functions_cond"> | |
| 291 <param name="plot_functions_sel" value="file"/> | |
| 292 <param name="function_data" value="AalborgWWTPs-functions.tsv" ftype="tsv"/> | |
| 293 <param name="functions" value="Foo,Bar"/> | |
| 294 </conditional> | |
| 295 <output name="plot" value="AalborgWWTPs-heatmap-plot_foo_file.pdf" ftype="pdf" compare="sim_size"/> | |
| 296 </test> | |
| 297 | |
| 298 </tests> | |
| 299 <help><![CDATA[ | |
| 300 What it does | |
| 301 ============ | |
| 302 | |
| 303 Generates a heatmap of amplicon data by using sample metadata to aggregate | |
| 304 samples and taxonomy to aggregate OTUs. | |
| 305 | |
| 306 The Galaxy tool calls the `amp_heatmap | |
| 307 <https://kasperskytte.github.io/ampvis2/reference/amp_heatmap.html>`_ function | |
| 308 of the ampvis2 package. | |
| 309 | |
| 310 @HELP_RELATIVE_ABUNDANCES@ | |
| 311 | |
| 312 Input | |
| 313 ===== | |
| 314 | |
| 315 @HELP_RDS_INPUT@ | |
| 316 | |
| 317 @HELP_METADATA_LIST_INPUT@ | |
| 318 | |
| 319 Funtional data at genus level can be added to the plot. By default the | |
| 320 information is taken from `midasfieldguide <https://midasfieldguide.org/>`_ but | |
| 321 it can also be given by a dataset (parameter function_data): | |
| 322 | |
| 323 - The first column must be the Genus names and | |
| 324 - any other column(s) can be any property or metabolic function of the individual Genera. | |
| 325 | |
| 326 Output | |
| 327 ====== | |
| 328 | |
| 329 Heatmap in the chosen output format. | |
| 330 If table output is chosen the data presented in the heatmap is written into a tabular dataset. | |
| 331 ]]></help> | |
| 332 <expand macro="citations"/> | |
| 333 </tool> |
