Mercurial > repos > iuc > ampvis2_subset_taxa
comparison subset_taxa.xml @ 7:20a62b3a3038 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit d92935972ac18906154fadf42bd0c008e3c437e2
author | iuc |
---|---|
date | Fri, 25 Oct 2024 14:15:04 +0000 |
parents | 1332619ad9ec |
children |
comparison
equal
deleted
inserted
replaced
6:cf579d6919e8 | 7:20a62b3a3038 |
---|---|
1 <tool id="ampvis2_subset_taxa" name="ampvis2 subset data" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT"> | 1 <tool id="ampvis2_subset_taxa" name="ampvis2 subset data" version="@TOOL_VERSION@+galaxy1" profile="@PROFILE@" license="MIT"> |
2 <description>by taxonomy</description> | 2 <description>by taxonomy</description> |
3 <macros> | 3 <macros> |
4 <import>macros.xml</import> | 4 <import>macros.xml</import> |
5 </macros> | 5 </macros> |
6 <expand macro="header"/> | 6 <expand macro="header"/> |
9 ]]></command> | 9 ]]></command> |
10 <configfiles> | 10 <configfiles> |
11 <configfile name="rscript"><![CDATA[ | 11 <configfile name="rscript"><![CDATA[ |
12 library(ampvis2, quietly = TRUE) | 12 library(ampvis2, quietly = TRUE) |
13 data <- readRDS("$data") | 13 data <- readRDS("$data") |
14 #set tax_vector = 'c("' + '", "'.join(str($tax_vector).split(",")) + '")' | 14 |
15 data <- amp_subset_taxa( | 15 #if $select_param == "option_input_selected_file" |
16 ## Define the file path (assuming it's a text file with one value per line) | |
17 file_path <- "$selected_taxonomy_list" | |
18 | |
19 ## Read the file into a character vector, where each line represents a value | |
20 lines <- readLines(file_path) | |
21 | |
22 ## Remove any leading or trailing whitespace (if necessary) | |
23 tax_vector <- trimws(lines) | |
24 #else | |
25 tax_vector <- unlist(strsplit("$tax_vector", ",")) | |
26 #end if | |
27 data <- amp_subset_taxa( | |
16 data, | 28 data, |
17 tax_vector = $tax_vector, | 29 tax_vector = tax_vector, |
18 normalise = $normalise, | 30 normalise = $normalise, |
19 remove = $remove | 31 remove = $remove |
20 ) | 32 ) |
33 | |
21 saveRDS(data, "$ampvis") | 34 saveRDS(data, "$ampvis") |
22 @SAVE_TAX_LIST@ | 35 @SAVE_TAX_LIST@ |
23 ]]></configfile> | 36 ]]></configfile> |
24 </configfiles> | 37 </configfiles> |
25 <inputs> | 38 <inputs> |
26 <expand macro="rds_input_macro"/> | 39 <expand macro="rds_input_macro"/> |
27 <!-- add validator --> | 40 <!-- add validator --> |
28 <param name="taxonomy_list" type="data" optional="false" format="tabular" label="Taxonomy list" help="Generated with ampvis2: load"/> | 41 <conditional name="taxonomy_select_type"> |
29 <expand macro="taxonomy_select_macro" argument="tax_vector" label="Taxa to keep"/> | 42 <param name="select_param" type="select" label="Choose taxa input option"> |
43 <option value="option_input_file">Select taxa from taxonomy list file</option> | |
44 <option value="option_input_selected_file">Provide a file with selected taxa</option> | |
45 </param> | |
46 | |
47 <when value="option_input_selected_file"> | |
48 <param name="selected_taxonomy_list" type="data" optional="false" format="tabular" label="Selected taxonomy list" help="A file containing the taxa to subsample. One taxa per line."/> | |
49 </when> | |
50 | |
51 <when value="option_input_file"> | |
52 <param name="taxonomy_list" type="data" optional="false" format="tabular" label="Taxonomy list" help="Generated with ampvis2: load"/> | |
53 <expand macro="taxonomy_select_macro" argument="tax_vector" label="Taxa to keep"/> | |
54 </when> | |
55 </conditional> | |
56 | |
30 <expand macro="normalise_macro"/> | 57 <expand macro="normalise_macro"/> |
31 <param argument="remove" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Remove" help="Selected taxa will be removed instead of being the only ones kept in the data."/> | 58 <param argument="remove" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Remove" help="Selected taxa will be removed instead of being the only ones kept in the data."/> |
32 </inputs> | 59 </inputs> |
33 <outputs> | 60 <outputs> |
34 <data name="ampvis" format="ampvis2"/> | 61 <data name="ampvis" format="ampvis2"/> |
35 <data name="taxonomy_list_out" format="tabular" label="${tool.name} on ${on_string}: taxonomy list"/> | 62 <data name="taxonomy_list_out" format="tabular" label="${tool.name} on ${on_string}: taxonomy list"/> |
36 </outputs> | 63 </outputs> |
64 <!-- Test cases --> | |
37 <tests> | 65 <tests> |
38 <!-- defaults --> | 66 <!-- Test case for using comma-separated taxonomy list --> |
39 <test expect_num_outputs="2"> | 67 <test expect_num_outputs="2"> |
40 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | 68 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> |
69 <param name="select_param" value="option_input_file"/> | |
41 <param name="taxonomy_list" value="AalborgWWTPs-taxonomy.list"/> | 70 <param name="taxonomy_list" value="AalborgWWTPs-taxonomy.list"/> |
42 <param name="tax_vector" value="f__Caldilineaceae,p__Elusimicrobia"/> | 71 <param name="tax_vector" value="f__Caldilineaceae,p__Elusimicrobia"/> |
43 <output name="ampvis" value="AalborgWWTPs-subset_taxa.rds" ftype="ampvis2" compare="sim_size"/> | 72 <output name="ampvis" value="AalborgWWTPs-subset_taxa.rds" ftype="ampvis2" compare="sim_size"/> |
44 <output name="taxonomy_list_out" ftype="tabular"> | 73 <output name="taxonomy_list_out" ftype="tabular"> |
45 <assert_contents> | 74 <assert_contents> |
46 <has_text text="f__Caldilineaceae"/> | 75 <has_text text="f__Caldilineaceae"/> |
47 <has_text text="p__Elusimicrobia"/> | 76 <has_text text="p__Elusimicrobia"/> |
48 </assert_contents> | 77 </assert_contents> |
49 </output> | 78 </output> |
50 </test> | 79 </test> |
51 <!-- defaults --> | 80 |
81 <!-- Test case for using comma-separated taxonomy list and remove=true --> | |
52 <test expect_num_outputs="2"> | 82 <test expect_num_outputs="2"> |
53 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | 83 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> |
84 <param name="select_param" value="option_input_file"/> | |
54 <param name="taxonomy_list" value="AalborgWWTPs-taxonomy.list"/> | 85 <param name="taxonomy_list" value="AalborgWWTPs-taxonomy.list"/> |
55 <param name="tax_vector" value="f__Caldilineaceae,p__Elusimicrobia"/> | 86 <param name="tax_vector" value="f__Caldilineaceae,p__Elusimicrobia"/> |
87 <param name="remove" value="true"/> | |
88 <output name="ampvis" value="AalborgWWTPs-subset_taxa.rds" ftype="ampvis2" compare="sim_size"/> | |
89 <output name="taxonomy_list_out" ftype="tabular"> | |
90 <assert_contents> | |
91 <not_has_text text="f__Caldilineaceae"/> | |
92 <not_has_text text="p__Elusimicrobia"/> | |
93 </assert_contents> | |
94 </output> | |
95 </test> | |
96 | |
97 <!-- Test case for using selected taxonomy list from a file --> | |
98 <test expect_num_outputs="2"> | |
99 <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> | |
100 <param name="select_param" value="option_input_selected_file"/> | |
101 <param name="selected_taxonomy_list" value="AalborgWWTPs-selected.taxonomy.list"/> | |
56 <param name="remove" value="true"/> | 102 <param name="remove" value="true"/> |
57 <output name="ampvis" value="AalborgWWTPs-subset_taxa.rds" ftype="ampvis2" compare="sim_size"/> | 103 <output name="ampvis" value="AalborgWWTPs-subset_taxa.rds" ftype="ampvis2" compare="sim_size"/> |
58 <output name="taxonomy_list_out" ftype="tabular"> | 104 <output name="taxonomy_list_out" ftype="tabular"> |
59 <assert_contents> | 105 <assert_contents> |
60 <not_has_text text="f__Caldilineaceae"/> | 106 <not_has_text text="f__Caldilineaceae"/> |
71 | 117 |
72 The Galaxy tool calls the `amp_subset_taxa | 118 The Galaxy tool calls the `amp_subset_taxa |
73 <https://kasperskytte.github.io/ampvis2/reference/amp_filter_taxa.html>`_ function | 119 <https://kasperskytte.github.io/ampvis2/reference/amp_filter_taxa.html>`_ function |
74 of the ampvis2 package. | 120 of the ampvis2 package. |
75 | 121 |
122 This tool provides two options for specifying the `subset`: | |
123 | |
124 1. **Provide taxa names matching the taxonomy table**: | |
125 | |
76 The taxonomy subset is done by providing a tax_vector of taxa names which are | 126 The taxonomy subset is done by providing a tax_vector of taxa names which are |
77 then matched to the taxonomy table, where all other taxa not matching the | 127 then matched to the taxonomy table, where all other taxa not matching the |
78 "Taxa to keep" (``tax_vector``) are removed. If "Remove" is enabled, then the | 128 "Taxa to keep" (``tax_vector``) are removed. If "Remove" is enabled, then the |
79 matching taxa are the ones being removed instead. The taxa names | 129 matching taxa are the ones being removed instead. The taxa names |
80 will be matched in all columns of the taxonomy table. | 130 will be matched in all columns of the taxonomy table. |
131 | |
132 2. **Provide a file of selected taxonomies**: | |
133 | |
134 In this option, you can upload a file containing the taxa you wish to subset. | |
135 The file should contain one taxon name per line. | |
136 This option is useful when you have a pre-defined list of taxa stored in a file. | |
137 This is useful if you want to use the tool in a workflow or if you automatically generate | |
138 a taxonomy selection e.g. with differential abundance tools like MaAsLi2 and you only want to | |
139 plot these taxa. | |
140 | |
81 | 141 |
82 @HELP_RELATIVE_ABUNDANCES@ | 142 @HELP_RELATIVE_ABUNDANCES@ |
83 | 143 |
84 Input | 144 Input |
85 ===== | 145 ===== |