Skip to content

Commit

Permalink
patch krakentools beta_diversity.xml (#6553)
Browse files Browse the repository at this point in the history
* patch krakentools beta_diversity.xml

* add re.sub to beta_diversity.xml

* patch beta_diversity.xml

* update test unit in beta_diversity.xml

* make output tabular and improve assertions

* fix re.sub in beta diversity

* Update tools/krakentools/beta_diversity.xml

---------

Co-authored-by: mthang <[email protected]>
Co-authored-by: Matthias Bernt <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2024
1 parent 6db2d98 commit 60eb96a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
6 changes: 2 additions & 4 deletions tools/krakentools/alpha_diversity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
<import>macros.xml</import>
</macros>
<expand macro="biotools"/>
<expand macro="requirements">
<requirement type="package" version="1.9.3">scipy</requirement>
</expand>
<expand macro="requirements"/>
<expand macro="version"/>
<command detect_errors="exit_code"><![CDATA[
alpha_diversity.py
Expand All @@ -33,7 +31,7 @@ alpha_diversity.py
<param name="alpha" value="Sh"/>
<output name="output" ftype="txt">
<assert_contents>
<has_text text="Shannon's diversity: 4.194127607417342"/>
<has_text text="Shannon's diversity: 4.194127607417341"/>
</assert_contents>
</output>
</test>
Expand Down
37 changes: 26 additions & 11 deletions tools/krakentools/beta_diversity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
<expand macro="requirements"/>
<expand macro="version"/>
<command detect_errors="exit_code"><![CDATA[
#import re
#set input_names=[]
#for $input in $inputs
#set identifier = re.sub('[^\s\w\-.]', '_', str($input.element_identifier))
#silent $input_names.append($identifier)
ln -s '$input' '${identifier}' &&
#end for
beta_diversity.py
--inputs
#for $input in $inputs
'$input'
#for $input_name in $input_names
'${input_name}'
#end for
--type '$sample.type'
#if $sample.type == 'kreport'
Expand Down Expand Up @@ -43,37 +52,43 @@ beta_diversity.py

</inputs>
<outputs>
<data name="output" format="txt" />
<data name="output" format="tabular" />
</outputs>
<tests>
<test>
<param name="inputs" value="beta_bracken_1.tabular,beta_bracken_2.tabular,beta_bracken_3.tabular"/>
<param name="type" value="bracken"/>
<output name="output" ftype="txt">
<output name="output" ftype="tabular">
<assert_contents>
<has_text_matching expression="#[012]&#9;beta_[a-z]+_[123].tabular \([0-9]+ reads\)" n="3"/>
<has_n_columns n="4" comment="#"/>
<has_n_lines n="7"/>
<has_text text="0.629"/>
<has_text text="0.993"/>
<has_text text="0.995"/>
</assert_contents>
</output>
</test>
<test>
<param name="inputs" value="beta_kreport_1.tabular,beta_kreport_2.tabular,beta_kreport_3.tabular"/>
<param name="type" value="kreport"/>
<output name="output" ftype="txt">
<output name="output" ftype="tabular">
<assert_contents>
<has_text text="beta_kreport_1.tabular"/>
<has_text_matching expression="#[012]&#9;beta_[a-z]+_[123].tabular \([0-9]+ reads\)" n="3"/>
<has_n_columns n="4" comment="#"/>
<has_n_lines n="7"/>
<has_text text="0.584"/>
<has_text text="0.996"/>
<has_text text="0.995"/>
</assert_contents>
</output>
</test>
<test>
<param name="inputs" value="beta_krona_1.tabular,beta_krona_2.tabular"/>
<param name="type" value="krona"/>
<param name="level" value="G"/>
<output name="output" ftype="txt">
<assert_contents>
<output name="output" ftype="tabular">
<assert_contents>
<has_text_matching expression="#[01]&#9;beta_[a-z]+_[12].tabular \([0-9]+ reads\)" n="2"/>
<has_n_columns n="3" comment="#"/>
<has_n_lines n="5"/>
<has_text text="0.993"/>
</assert_contents>
</output>
Expand Down
2 changes: 1 addition & 1 deletion tools/krakentools/macros.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<macros>
<token name="@TOOL_VERSION@">1.2</token>
<token name="@VERSION_SUFFIX@">1</token>
<token name="@VERSION_SUFFIX@">2</token>
<token name="@PROFILE@">21.01</token>
<xml name="biotools">
<xrefs>
Expand Down

0 comments on commit 60eb96a

Please sign in to comment.