Mercurial > repos > iuc > ampvis2_boxplot
comparison macros.xml @ 0:797603efc62d 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:50:10 +0000 |
| parents | |
| children | 74b728bd018f |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:797603efc62d |
|---|---|
| 1 <macros> | |
| 2 <token name="@TOOL_VERSION@">2.8.6</token> | |
| 3 <token name="@VERSION_SUFFIX@">2</token> | |
| 4 <token name="@PROFILE@">22.01</token> | |
| 5 <xml name="header"> | |
| 6 <xrefs> | |
| 7 <xref type="bio.tools">ampvis</xref> | |
| 8 </xrefs> | |
| 9 <requirements> | |
| 10 <requirement type="package" version="@TOOL_VERSION@">r-ampvis2</requirement> | |
| 11 <requirement type="package" version="2.1.5">r-readr</requirement> | |
| 12 <requirement type="package" version="1.46.0">bioconductor-phyloseq</requirement> | |
| 13 </requirements> | |
| 14 <version_command><![CDATA[ | |
| 15 echo $(R --version | grep "R version")", ampvis2 version" $(R --vanilla --slave -e "library(ampvis2, quietly = TRUE); sessionInfo()\$otherPkgs\$ampvis2\$Version" 2> /dev/null | grep -v -i "WARNING: ") | |
| 16 ]]></version_command> | |
| 17 | |
| 18 </xml> | |
| 19 <xml name="citations"> | |
| 20 <citations> | |
| 21 <citation type="doi">10.1101/299537</citation> | |
| 22 <yield/> | |
| 23 </citations> | |
| 24 </xml> | |
| 25 | |
| 26 <xml name="rds_input_macro" token_multiple="false"> | |
| 27 <param argument="data" type="data" format="ampvis2" multiple="@MULTIPLE@" label="Ampvis2 RDS dataset" help="Generated with ampvis2: load"/> | |
| 28 </xml> | |
| 29 | |
| 30 <xml name="rds_metadata_input_macro" token_metadata_optional="true"> | |
| 31 <expand macro="rds_input_macro"/> | |
| 32 <param name="metadata_list" type="data" optional="@METADATA_OPTIONAL@" format="tabular" label="Metadata list"> | |
| 33 <validator type="expression" message="The metadatalist file must have 3 columns"><![CDATA[value.metadata.columns == 4]]></validator> | |
| 34 </param> | |
| 35 </xml> | |
| 36 | |
| 37 <token name="@SAVE_TAX_LIST@"><![CDATA[ | |
| 38 for(level in colnames(data\$tax)){ | |
| 39 for(u in unique(data\$tax[level])){ | |
| 40 write(paste(u, level, sep="\t"), file="$taxonomy_list_out", append=T) | |
| 41 } | |
| 42 } | |
| 43 ]]></token> | |
| 44 | |
| 45 <token name="@SAVE_METADATA_LIST@"><![CDATA[ | |
| 46 classes <- sapply(data\$metadata, class) | |
| 47 data\$metadata[is.na(data\$metadata)] <- "NA" ##the comparison below fails if NA values are present, see https://stackoverflow.com/questions/7355187/error-in-if-while-condition-missing-value-where-true-false-needed | |
| 48 for(name in names(data\$metadata)){ | |
| 49 ## check if it is the column containing the sample names | |
| 50 ## the additional column in the ist file can the be used | |
| 51 ## to filter SampleIDs from select inputs | |
| 52 ## (check for character columns only .. since data in the column is otherwise converted to the corresponding type .. which fails) | |
| 53 if(classes[[name]] == "character" && all(data\$metadata[[name]] == rownames(data\$metadata))){ | |
| 54 sample_names <- TRUE; | |
| 55 }else{ | |
| 56 sample_names <- FALSE; | |
| 57 } | |
| 58 for(m in unique(data\$metadata[[name]])){ | |
| 59 write(paste(name, m, sample_names, classes[[name]], sep="\t"), file="$metadata_list_out", append=T); | |
| 60 } | |
| 61 } | |
| 62 ]]></token> | |
| 63 | |
| 64 <!-- defaults can be set by redefining an on option with selected="true" --> | |
| 65 <xml name="taxlevel_macro" token_argument="" token_multiple="false" token_optional="false" token_label="" token_help=""> | |
| 66 <param argument="@ARGUMENT@" type="select" optional="@OPTIONAL@" multiple="@MULTIPLE@" label="@LABEL@" help="@HELP@"> | |
| 67 <option value="OTU">OTU/ASV</option> | |
| 68 <option value="Species">Species</option> | |
| 69 <option value="Genus">Genus</option> | |
| 70 <option value="Family">Family</option> | |
| 71 <option value="Order">Order</option> | |
| 72 <option value="Class">Class</option> | |
| 73 <option value="Phylum">Phylum</option> | |
| 74 <option value="Kingdom">Kingdom</option> | |
| 75 <yield/> | |
| 76 </param> | |
| 77 </xml> | |
| 78 | |
| 79 <xml name="tax_empty_macro"> | |
| 80 <param argument="tax_empty" type="select" label="How to show OTUs without taxonomic information"> | |
| 81 <option value="remove">Remove OTUs without taxonomic information</option> | |
| 82 <option value="best" selected="true">Use the best classification possible</option> | |
| 83 <option value="OTU">Display the OTU name</option> | |
| 84 </param> | |
| 85 </xml> | |
| 86 | |
| 87 <token name="@TAX_SHOW@"><![CDATA[ | |
| 88 #if $tax_show_cond.tax_show_sel == "number" | |
| 89 tax_show = $tax_show_cond.tax_show, | |
| 90 #else | |
| 91 #set tax_show_list='c("' + '", "'.join(str($tax_show_cond.tax_show).split(",")) + '")' | |
| 92 tax_show = $tax_show_list | |
| 93 #end if | |
| 94 ]]></token> | |
| 95 <xml name="tax_show_macro" token_value=""> | |
| 96 <conditional name="tax_show_cond"> | |
| 97 <param name="tax_show_sel" type="select" label="Limit the number of shown taxa"> | |
| 98 <option value="number">Select a number of taxa to show</option> | |
| 99 <option value="explicit">Manually select taxa to show</option> | |
| 100 </param> | |
| 101 <when value="number"> | |
| 102 <param argument="tax_show" type="integer" value="@VALUE@" min="1" label="Number of taxa to show"/> | |
| 103 </when> | |
| 104 <when value="explicit"> | |
| 105 <param name="taxonomy_list" format="tabular" type="data" optional="false" label="Taxonomy list" help="Generated with ampvis2: load"/> | |
| 106 <param argument="tax_show" type="select" multiple="true" optional="false" label="Taxa to show"> | |
| 107 <options from_dataset="taxonomy_list"> | |
| 108 <column name="name" index="0"/> | |
| 109 <column name="value" index="0"/> | |
| 110 <!-- TODO filter by tax_aggregate level? --> | |
| 111 </options> | |
| 112 </param> | |
| 113 </when> | |
| 114 </conditional> | |
| 115 </xml> | |
| 116 | |
| 117 <xml name="metadata_select" token_quote="__" tokens="argument,label" token_an="argument" token_optional="true" token_multiple="false" token_help=""> | |
| 118 <param __AN__="__ARGUMENT__" type="select" optional="__OPTIONAL__" multiple="__MULTIPLE__" label="__LABEL__" help="In order to select values a metadata list needs to be selected first. __HELP__"> | |
| 119 <options from_dataset="metadata_list"> | |
| 120 <column name="name" index="0"/> | |
| 121 <column name="value" index="0"/> | |
| 122 <filter type="unique_value" column="0"/> | |
| 123 <yield name="options"/> | |
| 124 </options> | |
| 125 <yield/> | |
| 126 </param> | |
| 127 </xml> | |
| 128 | |
| 129 <xml name="metadata_select_discrete" tokens="argument,label" token_optional="true" token_multiple="false" token_help=""> | |
| 130 <expand macro="metadata_select" argument="@ARGUMENT@" optional="@OPTIONAL@" multiple="@MULTIPLE@" label="@LABEL@" help="@HELP@"> | |
| 131 <token name="options"> | |
| 132 <filter type="static_value" column="3" value="numeric" keep="false"/> | |
| 133 </token> | |
| 134 <yield/> | |
| 135 </expand> | |
| 136 </xml> | |
| 137 | |
| 138 <xml name="metadata_select_numeric" tokens="argument,label" token_optional="true" token_multiple="false" token_help=""> | |
| 139 <expand macro="metadata_select" argument="@ARGUMENT@" optional="@OPTIONAL@" multiple="@MULTIPLE@" label="@LABEL@" help="@HELP@"> | |
| 140 <token name="options"> | |
| 141 <filter type="static_value" column="3" value="character" keep="false"/> | |
| 142 <filter type="static_value" column="3" value="Date" keep="false"/> | |
| 143 </token> | |
| 144 <yield/> | |
| 145 </expand> | |
| 146 </xml> | |
| 147 | |
| 148 <xml name="metadata_select_date" tokens="argument,label" token_optional="true" token_multiple="false" token_help=""> | |
| 149 <expand macro="metadata_select" argument="@ARGUMENT@" optional="@OPTIONAL@" multiple="@MULTIPLE@" label="@LABEL@" help="@HELP@"> | |
| 150 <token name="options"> | |
| 151 <filter type="static_value" column="3" value="Date" keep="true"/> | |
| 152 </token> | |
| 153 <yield/> | |
| 154 </expand> | |
| 155 </xml> | |
| 156 | |
| 157 <!-- metadata_sample_or_variable_select is currently unused (heatmap is documented to allow normalize by | |
| 158 sample or variable, but only sample seems possible https://github.com/KasperSkytte/ampvis2/issues/168 | |
| 159 leaving it for now in case it can be fixed .. then metadata_sample_select could be removed) --> | |
| 160 <xml name="metadata_sample_select" token_argument=""> | |
| 161 <param argument="@ARGUMENT@" type="select" optional="true"> | |
| 162 <options from_dataset="metadata_list"> | |
| 163 <column name="name" index="1"/> | |
| 164 <column name="value" index="1"/> | |
| 165 <filter type="static_value" value="TRUE" column="2"/> <!-- filter samples --> | |
| 166 <filter type="unique_value" column="1"/> | |
| 167 </options> | |
| 168 </param> | |
| 169 </xml> | |
| 170 <xml name="metadata_sample_or_variable_select" token_argument=""> | |
| 171 <conditional name="@ARGUMENT@_cond"> | |
| 172 <param name="@ARGUMENT@_sel" type="select"> | |
| 173 <option value="no">No</option> | |
| 174 <option value="variable">Metadata variable</option> | |
| 175 <option value="sample">Specific sample</option> | |
| 176 </param> | |
| 177 <when value="no"/> | |
| 178 <when value="variable"> | |
| 179 <expand macro="metadata_select" argument="@ARGUMENT@" label="Metadata variable"/> | |
| 180 </when> | |
| 181 <when value="sample"> | |
| 182 <expand macro="metadata_sample_select"/> | |
| 183 </when> | |
| 184 </conditional> | |
| 185 </xml> | |
| 186 | |
| 187 <xml name="taxonomy_select_macro" token_argument="" token_optional="false" token_multiple="true"> | |
| 188 <param argument="@ARGUMENT@" type="select" optional="@OPTIONAL@" multiple="@MULTIPLE@"> | |
| 189 <options from_dataset="taxonomy_list"> | |
| 190 <column name="name" index="0"/> | |
| 191 <column name="value" index="0"/> | |
| 192 <filter type="unique_value" column="0"/> | |
| 193 </options> | |
| 194 <yield/> | |
| 195 </param> | |
| 196 </xml> | |
| 197 | |
| 198 <xml name="facet_scales_macro" token_argument="" token_label="Scales of the facets" token_help=""> | |
| 199 <param argument="@ARGUMENT@" type="select" optional="true" label="@LABEL@" help="@HELP@"> | |
| 200 <option value="fixed">Same scale</option> | |
| 201 <option value="free">Free scale</option> | |
| 202 <option value="free_x">Free x-scale</option> | |
| 203 <option value="free_y">Free y-scale</option> | |
| 204 </param> | |
| 205 </xml> | |
| 206 | |
| 207 <token name="@OUTPUT_TOKEN@"> | |
| 208 ggsave("$plot", | |
| 209 print(plot), | |
| 210 device="$output_options.out_format" | |
| 211 #if str($output_options.plot_width) != '' | |
| 212 , width = $output_options.plot_width | |
| 213 #end if | |
| 214 #if str($output_options.plot_height) != '' | |
| 215 , height = $output_options.plot_height | |
| 216 #end if | |
| 217 ) | |
| 218 </token> | |
| 219 <xml name="out_macro" token_name="plot" token_label=""> | |
| 220 <data name="@NAME@" format="pdf" label="${tool.name} on ${on_string}@LABEL@"> | |
| 221 <yield/> | |
| 222 <change_format> | |
| 223 <when input="output_options.out_format" value="png" format="png" /> | |
| 224 <when input="output_options.out_format" value="svg" format="svg" /> | |
| 225 </change_format> | |
| 226 </data> | |
| 227 </xml> | |
| 228 <xml name="out_format_macro"> | |
| 229 <section name="output_options" title="Output options" expanded="false"> | |
| 230 <param name="out_format" type="select" label="Output format"> | |
| 231 <option value="pdf" selected="true">PDF</option> | |
| 232 <option value="png">PNG</option> | |
| 233 <option value="svg">SVG</option> | |
| 234 <yield/> | |
| 235 </param> | |
| 236 <param name="plot_width" type="float" value="" min="1" optional="true" label="Plot width in cm"/> | |
| 237 <param name="plot_height" type="float" value="" min="1" optional="true" label="Plot height in cm"/> | |
| 238 </section> | |
| 239 </xml> | |
| 240 | |
| 241 <token name="@RAREFY_TOKEN@"> | |
| 242 #if str($rarefy) != "" | |
| 243 , rarefy = $rarefy | |
| 244 #end if | |
| 245 </token> | |
| 246 <xml name="rarefy_macro" token_help=""> | |
| 247 <param argument="rarefy" type="integer" optional="true" value="" min="0" label="Rarefy species richness to this value" help="@HELP@"/> | |
| 248 </xml> | |
| 249 | |
| 250 <xml name="normalise_macro" token_checked="false"> | |
| 251 <param argument="normalise" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="@CHECKED@" label="Normalise read counts" help="Transform the OTU read counts to be in percent per sample."/> | |
| 252 </xml> | |
| 253 | |
| 254 <token name="@HELP_RDS_INPUT@"> | |
| 255 An ampvis2 RDS dataset obtained by the ``ampvis2: load`` tool (or ``ampvis2: mergereplicates`` or one of the | |
| 256 ``ampvis2: subset ...`` tools). | |
| 257 </token> | |
| 258 <token name="@HELP_METADATA_LIST_INPUT@"> | |
| 259 The metadata list output of the ``ampvis2: load`` tool (or ``ampvis2: mergereplicates`` or the | |
| 260 ``ampvis2: subset sample`` tool). This input is only used for providing | |
| 261 values to the parameters alowing to select metadata variables or values. | |
| 262 </token> | |
| 263 | |
| 264 <token name="@HELP_RELATIVE_ABUNDANCES@"> | |
| 265 Preserving relative abundances in a subset of larger data | |
| 266 ========================================================= | |
| 267 | |
| 268 By default the raw read counts in the abundance matrix are normalised | |
| 269 (transformed to percentages) by some ampvis2 plotting tools (for | |
| 270 example ``ampvis2: heatmap``, ``ampvis2: timeseries``, and more). | |
| 271 If this is applied to data generated by one of the ``ampvis2: subset ...`` tools | |
| 272 this means that the relative | |
| 273 abundances shown will be calculated based on the remaining taxa after the | |
| 274 subset, not including the removed taxa, if any. To circumvent this, enable | |
| 275 ``normalise`` when subsetting with the ``ampvis2: subset ...``` tools, | |
| 276 and then disable ``normalise`` in the plotting tool. This will | |
| 277 transform the OTU counts to relative abundances BEFORE the subset. | |
| 278 </token> | |
| 279 </macros> |
