Skip to content

Commit

Permalink
maaslin2: test cases added
Browse files Browse the repository at this point in the history
  • Loading branch information
renu-pal committed Apr 19, 2024
1 parent 8fa089e commit bfc500c
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 4 deletions.
105 changes: 102 additions & 3 deletions tools/maaslin2/maaslin2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## can only return indices with type="data_column"
## using awk so that the file is only parsed on command line execution
#if $fixed_effects
#set idx = []
#for $i in $fixed_effects:
#silent idx.append(f'${i}')
Expand All @@ -20,7 +21,10 @@
fixed_effects=`awk -v OFS=',' -F"\t" 'NR == 1 { print $idx_for_awk}' '$input_metadata'` &&
echo 'Assigned fixed effects as:' \$fixed_effects &&
#end if
#if $random_effects
#set idx = []
#for $i in $random_effects:
#silent idx.append(f'${i}')
Expand All @@ -29,6 +33,7 @@ echo 'Assigned fixed effects as:' \$fixed_effects &&
random_effects=`awk -v OFS=',' -F"\t" 'NR == 1 { print $idx_for_awk}' '$input_metadata'` &&
echo 'Assigned random effects as:' \$random_effects &&
#end if
ln -s '$input_data' 'input_data.tsv'
&&
Expand Down Expand Up @@ -79,9 +84,9 @@ cd outputFolder && mkdir -p figures/ && cp *.pdf figures
<inputs>
<param name="input_data" type="data" format="tabular" label="Data (or features) file"/>
<param name="input_metadata" type="data" format="tabular" label="Metadata file"/>
<param argument="--fixed_effects" type="data_column" data_ref="input_metadata" use_header_names="true" multiple="true" optional="true" label="Interactions: Fixed effects" help="The fixed effects for the model, comma-delimited for multiple effects" />
<param argument="--fixed_effects" type="data_column" data_ref="input_metadata" use_header_names="true" multiple="true" optional="true" label="Interactions: Fixed effects" help="The fixed effects for the model, comma-delimited for multiple effects, Default value: All " />

<param argument="--random_effects" type="data_column" data_ref="input_metadata" use_header_names="true" multiple="true" optional="true" label="Random effects" help="The random effects for the model, comma-delimited for multiple effects" />
<param argument="--random_effects" type="data_column" data_ref="input_metadata" use_header_names="true" multiple="true" optional="true" label="Random effects" help="The random effects for the model, comma-delimited for multiple effects, Default: None" />



Expand All @@ -108,7 +113,7 @@ cd outputFolder && mkdir -p figures/ && cp *.pdf figures
<option value="NEGBIN">NEGBIN</option>
<option value="ZINB">ZINB</option>
</param>
<param argument="--correction" type="select" value="BH" multiple="true" optional="true" label="Correction" help="The correction method for computing the q-value ">
<param argument="--correction" type="select" value="BH" optional="true" label="Correction" help="The correction method for computing the q-value ">
<option value="holm">Holm</option>
<option value="hochberg">Hochberg</option>
<option value="hommel">Hommel</option>
Expand Down Expand Up @@ -332,6 +337,100 @@ cd outputFolder && mkdir -p figures/ && cp *.pdf figures
</element>
</output_collection>
</test>
<test expect_num_outputs="5">
<param name="input_data" value="HMP2_taxonomy.tsv"/>
<param name="input_metadata" value="HMP2_metadata.tsv"/>
<param name="random_effects" value="c3: age" />
<section name="additional_options">
<param name="min_abundance" value="0.0"/>
<param name="min_prevalence" value="0.1"/>
<param name="max_significance" value="0.25"/>
<param name="normalization" value="TSS"/>
<param name="transform" value="LOG"/>
<param name="analysis_method" value="LM"/>
<param name="correction" value="BY"/>
<param name="standardize" value="True"/>
</section>
<section name="output">
<param name="plot_heatmap" value="true"/>
<param name="heatmap_first_n" value="50"/>
<param name="plot_scatter" value="true"/>
<param name="residuals_output" value="true"/>
</section>
<output name="all_results">
<assert_contents>
<has_text text="feature"/>
<has_n_lines n="8092"/>
<has_n_columns n="9"/>
</assert_contents>
</output>
<output name="significant_results">
<assert_contents>
<has_text text="subject"/>
<has_n_lines n="213"/>
<has_n_columns n="9"/>
</assert_contents>
</output>
<output name="residuals">
<assert_contents>
<has_size value="671142" delta="1000"/>
</assert_contents>
</output>
<output_collection name="figures_pdfs" type="list">
<element name="heatmap.pdf" ftype="pdf">
<assert_contents>
<has_size value="7000" delta="1000" />
</assert_contents>
</element>
</output_collection>
</test>
<test expect_num_outputs="5">
<param name="input_data" value="HMP2_taxonomy.tsv"/>
<param name="input_metadata" value="HMP2_metadata.tsv"/>

<section name="additional_options">
<param name="min_abundance" value="0.0"/>
<param name="min_prevalence" value="0.1"/>
<param name="max_significance" value="0.25"/>
<param name="normalization" value="TSS"/>
<param name="transform" value="LOG"/>
<param name="analysis_method" value="LM"/>
<param name="correction" value="BH"/>
<param name="standardize" value="True"/>
</section>
<section name="output">
<param name="plot_heatmap" value="true"/>
<param name="heatmap_first_n" value="50"/>
<param name="plot_scatter" value="true"/>
<param name="residuals_output" value="true"/>
</section>
<output name="all_results">
<assert_contents>
<has_text text="feature"/>
<has_n_lines n="8092"/>
<has_n_columns n="9"/>
</assert_contents>
</output>
<output name="significant_results">
<assert_contents>
<has_text text="subject"/>
<has_n_lines n="880"/>
<has_n_columns n="9"/>
</assert_contents>
</output>
<output name="residuals">
<assert_contents>
<has_size value="670759" delta="1000"/>
</assert_contents>
</output>
<output_collection name="figures_pdfs" type="list">
<element name="heatmap.pdf" ftype="pdf">
<assert_contents>
<has_size value="7900" delta="1000" />
</assert_contents>
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
@HELP_HEADER@
Expand Down
2 changes: 1 addition & 1 deletion tools/maaslin2/macros.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<macros>
<token name="@TOOL_VERSION@">1.7.3</token>
<token name="@TOOL_VERSION@">0.99.12</token>
<token name="@VERSION_SUFFIX@">0</token>
<token name="@PROFILE@">20.01</token>
<xml name="edam_ontology">
Expand Down

0 comments on commit bfc500c

Please sign in to comment.