comparison vegan_rarefaction.xml @ 0:3d1d965b6423 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/vegan/vegan_rarefaction commit 0e04a4c237677c1f5be1950babcf8591097996a9
author iuc
date Wed, 23 Dec 2015 13:55:57 -0500
parents
children dd2705a31239
comparison
equal deleted inserted replaced
-1:000000000000 0:3d1d965b6423
1 <tool id="vegan_rarefaction" name="Vegan Rarefaction" version="0.0.2">
2 <description>
3 curve and statistics
4 </description>
5 <macros>
6 <import>vegan_macros.xml</import>
7 </macros>
8 <expand macro="requirements" />
9 <expand macro="stdio" />
10 <expand macro="version_command" />
11 <command><![CDATA[
12 #if "output_r_script" in str( $include_outputs ).split( "," ):
13 cp "${vegan_rarefaction_script}" "${output_r_script}" &&
14 #end if
15 Rscript "${vegan_rarefaction_script}"
16 ]]>
17 </command>
18 <configfiles>
19 <configfile name="vegan_rarefaction_script"><![CDATA[
20 @RSCRIPT_PREAMBLE@
21 @RSCRIPT_LOAD_TABULAR_FILE@
22 #set $include_files = str( $include_outputs ).split( "," )
23
24 #if str( $sample_size ) == '':
25 raremax <- min(rowSums(input_abundance))
26 raremax_offset <- -1
27 sprintf("Automatically determining subsampling size, will apply offset to slope calculation and species probabilities.")
28 #else:
29 raremax = $sample_size
30 raremax_offset <- 0
31 #end if
32 sprintf("Using sample size: %i", raremax)
33 Srare <- rarefy(input_abundance, sample=raremax, se=FALSE, MARGIN=1)
34 #if "output_richness" in $include_files:
35 write.table(Srare, "${output_richness}", col.names=NA, sep = "\t")
36 #end if
37
38 #if "output_slope" in $include_files:
39 write.table(rareslope(input_abundance, sample=raremax+raremax_offset), "${output_slope}", sep = "\t")
40 #end if
41
42 S <- specnumber(input_abundance)
43 #if "output_species_count" in $include_files:
44 write.table(S, "${ output_species_count }", col.names=NA, sep="\t" )
45 #end if
46
47 #if "output_species_frequency" in $include_files:
48 write.table(specnumber(input_abundance, MARGIN=2), "${ output_species_frequency }", col.names=NA, sep="\t" )
49 #end if
50
51 #if "output_species_probabilities" in $include_files:
52 write.table(drarefy(input_abundance, sample=raremax+raremax_offset), "${ output_species_probabilities }", col.names=NA, sep="\t" )
53 #end if
54
55 #if "output_plot" in $include_files:
56 png('${output_plot}', width=1020, height=800, units='px')
57 rarecurve(input_abundance, step = ${step_size}, sample = raremax, xlab = "${xlab}", ylab = "${ylab}", label="${label}", col = "blue", cex = 0.6)
58 invisible(dev.off())
59 #end if
60 ]]>
61 </configfile>
62 </configfiles>
63 <inputs>
64 <expand macro="params_load_tabular_file" />
65 <param name="sample_size" type="integer" value="" min="1" optional="True" label="Subsample size for rarefying community" help="Leave empty to subsample by community size for the smallest sample."/>
66 <param name="step_size" type="integer" value="1" min="1" label="Step size for sample sizes"/>
67 <param name="xlab" type="text" value="Sample Size" label="X-axis label"/>
68 <param name="ylab" type="text" value="Species" label="Y-axis label"/>
69 <param name="label" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Label rarefaction curves by rownames of X"/>
70 <param name="include_outputs" type="select" multiple="True" label="Datasets to create">
71 <option value="output_species_count" selected="true">Count of species</option>
72 <option value="output_species_frequency" selected="true">Species frequency</option>
73 <option value="output_richness" selected="true">Richness</option>
74 <option value="output_species_probabilities" selected="true">Species probabilities</option>
75 <option value="output_slope" selected="true">Slope of rarefaction curve</option>
76 <option value="output_r_script" selected="false">R script</option>
77 <option value="output_plot" selected="true">Rarefaction plot</option>
78 </param>
79 </inputs>
80 <outputs>
81 <data format="tabular" name="output_species_count" label="${tool.name} on ${on_string} (number of species)">
82 <filter>"output_species_count" in include_outputs</filter>
83 </data>
84 <data format="tabular" name="output_species_frequency" label="${tool.name} on ${on_string} (frequency of species)">
85 <filter>"output_species_frequency" in include_outputs</filter>
86 </data>
87 <data format="tabular" name="output_richness" label="${tool.name} on ${on_string} (estimated richness)">
88 <filter>"output_richness" in include_outputs</filter>
89 </data>
90 <data format="tabular" name="output_species_probabilities" label="${tool.name} on ${on_string} (species probabilities)">
91 <filter>"output_species_probabilities" in include_outputs</filter>
92 </data>
93 <data format="tabular" name="output_slope" label="${tool.name} on ${on_string} (slope of curve)">
94 <filter>"output_slope" in include_outputs</filter>
95 </data>
96 <data format="txt" name="output_r_script" label="${tool.name} on ${on_string} (Rscript)">
97 <filter>"output_r_script" in include_outputs</filter>
98 </data>
99 <data format="png" name="output_plot" label="${tool.name} on ${on_string} (plot)">
100 <filter>"output_plot" in include_outputs</filter>
101 </data>
102 </outputs>
103 <tests>
104 <test>
105 <param name="input_abundance" ftype="tabular" value="vegan_in.tabular"/>
106 <param name="species_column" value="6"/>
107 <param name="sample_columns" value="2"/>
108 <param name="sample_size" value=""/>
109 <param name="step_size" value="1"/>
110 <param name="xlab" value="Sample Size"/>
111 <param name="ylab" value="Species"/>
112 <param name="label" value="TRUE"/>
113 <output name="output_species_count" ftype="tabular" file="vegan_output_species_count.tabular" />
114 <output name="output_species_frequency" ftype="tabular" file="vegan_output_species_frequency.tabular" />
115 <output name="output_richness" ftype="tabular" file="vegan_output_richness.tabular" />
116 <output name="output_species_probabilities" ftype="tabular" file="vegan_output_species_probabilities.tabular" />
117 <output name="output_slope" ftype="tabular" file="vegan_output_slope.tabular" />
118 </test>
119 </tests>
120 <help>
121 <![CDATA[
122
123 Gives the expected species richness in random subsamples of size sample from the community. The size of sample should be smaller than total community size, but the function will work for larger sample as well (with a warning) and return non-rarefied species richness (and standard error = 0). Rarefaction can be performed only with genuine counts of individuals. The function rarefy is based on Hurlbert’s (1971) formulation, and the standard errors on Heck et al. (1975).
124
125 Returns probabilities that species occur in a rarefied community of size sample.
126
127 Draws a rarefaction curve for each row of the input data. The rarefaction curves are evaluated using the interval of step sample sizes, always including 1 and total sample size. If sample is specified, a vertical line is drawn at sample with horizontal lines for the rarefied species richnesses.
128
129
130 .. class:: warningmark
131
132 When subsampling by community size, slope of the rarefaction curve and species probabilities are computed using community size-1
133 ]]>
134 </help>
135 <citations>
136 </citations>
137 </tool>