Mercurial > repos > iuc > ampvis2_subset_samples
view subset_samples.xml @ 8:ff07f41b8e54 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 9fe04d29ea604a152144908dbd20c0754695a025
author | iuc |
---|---|
date | Sat, 16 Nov 2024 19:59:22 +0000 |
parents | 317728cb0f8a |
children |
line wrap: on
line source
<tool id="ampvis2_subset_samples" name="ampvis2 subset samples" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT"> <description>by sample metadata</description> <macros> <import>macros.xml</import> </macros> <expand macro="header"/> <command detect_errors="exit_code"><![CDATA[ Rscript '$rscript' ]]></command> <configfiles> <configfile name="rscript"><![CDATA[ library(ampvis2, quietly = TRUE) data <- readRDS("$data") #set vals = 'c("' + '", "'.join(str($vals).split(",")) + '")' data <- amp_subset_samples( data, $invert $var %in% $vals, minreads = $minreads @RAREFY_TOKEN@, normalise = $normalise, removeAbsents = $removeAbsents ) saveRDS(data, "$ampvis") @SAVE_METADATA_LIST@ ]]></configfile> </configfiles> <inputs> <expand macro="rds_metadata_input_macro"/> <expand macro="metadata_select" an="name" argument="var" optional="false" multiple="false" label="Metadata variable"/> <param name="vals" type="select" optional="false" multiple="true" label="Metadata value(s)"> <options from_dataset="metadata_list"> <column name="name" index="1"/> <column name="value" index="1"/> <filter type="param_value" ref="var" column="0"/> <filter type="unique_value" column="1"/> </options> </param> <param name="invert" type="boolean" truevalue="!" falsevalue="" checked="false"/> <param argument="minreads" type="integer" value="0" min="0" label="Minimum number of reads" help="Per sample. Samples below this value will be removed initially"/> <expand macro="rarefy_macro" help="This is done initially, but after filtering based on the minreads value, if set."/> <expand macro="normalise_macro"/> <param argument="removeAbsents" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="true"/> </inputs> <outputs> <data name="ampvis" format="ampvis2"/> <data name="metadata_list_out" format="tabular" label="${tool.name} on ${on_string}: metadata list"/> </outputs> <tests> <!-- defaults --> <test expect_num_outputs="2"> <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> <param name="var" value="Plant"/> <param name="vals" value="Aalborg East"/> <output name="ampvis" value="AalborgWWTPs-subset_samples.rds" ftype="ampvis2" compare="sim_size"/> <output name="metadata_list_out" ftype="tabular"> <assert_contents> <has_line line="Plant	Aalborg East	FALSE	character"/> <not_has_text text="Plant	Aalborg West	FALSE	character"/> <has_n_lines n="85"/> <has_n_columns n="4"/> </assert_contents> </output> </test> <!-- test NA values in metadata --> <test expect_num_outputs="2"> <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> <param name="metadata_list" value="AalborgWWTPs-metadata_NA.list"/> <param name="var" value="Plant"/> <param name="vals" value="Aalborg East"/> <output name="ampvis" value="AalborgWWTPs-subset_samples.rds" ftype="ampvis2" compare="sim_size"/> <output name="metadata_list_out" ftype="tabular"> <assert_contents> <has_line line="Plant	Aalborg East	FALSE	character"/> <not_has_text text="SampleID	NA	TRUE	character"/> <has_n_lines n="85"/> <has_n_columns n="4"/> </assert_contents> </output> </test> <!-- invert --> <test expect_num_outputs="2"> <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> <param name="metadata_list" value="AalborgWWTPs-metadata.list"/> <param name="var" value="Plant"/> <param name="vals" value="Aalborg East"/> <param name="invert" value="true"/> <output name="ampvis" value="AalborgWWTPs-subset_samples.rds" ftype="ampvis2" compare="sim_size"/> <output name="metadata_list_out" ftype="tabular"> <assert_contents> <not_has_text text="Plant	Aalborg East	FALSE	character"/> <has_line line="Plant	Aalborg West	FALSE	character"/> <has_n_lines n="79"/> <has_n_columns n="4"/> </assert_contents> </output> </test> </tests> <help><![CDATA[ What it does ============ Subsets the data in ampvis2 objects based on metadata and returns the subsetted object. The Galaxy tool calls the `amp_subset_samples <https://kasperskytte.github.io/ampvis2/reference/amp_filter_samples.html>`_ function of the ampvis2 package. The subset is performed on the metadata by ``subset()`` and the abundance- and taxonomy tables are then adjusted accordingly. @HELP_RELATIVE_ABUNDANCES@ Input ===== @HELP_RDS_INPUT@ @HELP_METADATA_LIST_INPUT@ Output ====== An ampvis2_rds dataset containing subsetted data and an updated metadata list dataset. ]]></help> <expand macro="citations"/> </tool>