Skip to content

Commit

Permalink
update XML files and test-data
Browse files Browse the repository at this point in the history
  • Loading branch information
Minamehr committed Oct 30, 2024
1 parent 8565e82 commit ad09a29
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions tools/ampvis2/alpha_diversity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,32 @@
<configfile name="rscript"><![CDATA[
#set m='"' + '", "'.join(str($measure).split(",")) + '"'
library(ampvis2, quietly = TRUE)
d <- readRDS("$data")
a <- amp_alphadiv(d,
measure = c($m),
richness = $richness
@RAREFY_TOKEN@
@RAREFY_TOKEN@,
)
b <- amp_alphadiv(d,
measure = c($m),
richness = $richness
@RAREFY_TOKEN@,
plot = TRUE,
plot_group_by = "$group_by",
plot_scatter = $plot_scatter
)
write.table(a, file='$alphadiv', quote=FALSE, sep='\t', row.names=FALSE)
write.table(a, file='$alphadiv', quote=FALSE, sep='\t', row.names=FALSE)
ggsave("$alphadiv_plot",
plot = b,
device = "$output_options.out_format"
#if str($output_options.plot_width) != ''
, width = $output_options.plot_width
#end if
#if str($output_options.plot_height) != ''
, height = $output_options.plot_height
#end if
)
]]></configfile>
</configfiles>
<inputs>
Expand All @@ -30,13 +49,19 @@
</param>
<param argument="richness" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Calculate sample richness estimates" help="Chao1 and ACE"/>
<expand macro="rarefy_macro" help="before calculating alpha diversity and/or richnes"/>
<param argument="group_by" type="text" label="Group by metadata field (for plotting)" help="Specify the metadata field to group the plot by"/>
<param argument="plot_scatter" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Scatter plot instead of boxplot?" help="Select to generate a scatter plot instead of a boxplot"/>
<expand macro="out_format_macro"/>
</inputs>
<outputs>
<data name="alphadiv" format="tabular"/>
<expand macro="out_macro" name="alphadiv_plot" label=": alpha diversity plot"/>
</outputs>
<tests>
<test>
<param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/>
<param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/>
<param name="group_by" value="Plant"/>
<param name="plot_scatter" value="false"/>
<output name="alphadiv">
<assert_contents>
<has_line line="SampleID&#9;Plant&#9;Date&#9;Year&#9;Period&#9;Reads&#9;uniqueOTUs&#9;Shannon&#9;Simpson&#9;invSimpson"/>
Expand All @@ -46,12 +71,15 @@
<has_n_columns n="10"/>
</assert_contents>
</output>
<output name="alphadiv_plot" value="AalborgWWTPs-alpha_diversity_plot.pdf" ftype="pdf" compare="sim_size"/>
</test>
<test>
<param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/>
<param name="measure" value="observed,shannon"/>
<param name="richness" value="true"/>
<param name="rarefy" value="500"/>
<param name="group_by" value="Plant"/>
<param name="plot_scatter" value="true"/>
<output name="alphadiv">
<assert_contents>
<has_line line="SampleID&#9;Plant&#9;Date&#9;Year&#9;Period&#9;RawReads&#9;Reads&#9;uniqueOTUs&#9;Shannon&#9;Simpson&#9;invSimpson&#9;Chao1&#9;ACE"/>
Expand All @@ -62,6 +90,8 @@
<has_text text="&#9;500&#9;"/>
</assert_contents>
</output>
<output name="alphadiv_plot" value="AalborgWWTPs-alpha_diversity_plot2.pdf" ftype="pdf" compare="sim_size"/>

</test>
</tests>
<help><![CDATA[
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit ad09a29

Please sign in to comment.