Skip to content

Commit

Permalink
Merge pull request RECETOX#533 from zargham-ahmad/issue508
Browse files Browse the repository at this point in the history
Update WaveICA to outputs
  • Loading branch information
hechth authored May 7, 2024
2 parents 722ce0a + c039521 commit 84de3bc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
6 changes: 5 additions & 1 deletion tools/waveica/macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@

<xml name="outputs">
<outputs>
<data format_source="data" name="normalized_data"/>
<data name="normalized_data" format="tsv">
<change_format>
<when input_dataset="data" attribute="ext" value="parquet" format="parquet" />
</change_format>
</data>
</outputs>
</xml>

Expand Down
6 changes: 0 additions & 6 deletions tools/waveica/test-data/normalized_data.csv

This file was deleted.

18 changes: 9 additions & 9 deletions tools/waveica/waveica.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="waveica" name="WaveICA" version="@TOOL_VERSION@+galaxy4" python_template_version="3.5">
<tool id="waveica" name="WaveICA" version="@TOOL_VERSION@+galaxy5" profile="21.09">
<description>removal of batch effects for untargeted metabolomics data</description>
<macros>
<import>macros.xml</import>
Expand Down Expand Up @@ -103,7 +103,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.csv"/>
<output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
</test>
<test><!-- TEST 2 -->
<param name="data" value="input_data.tsv" ftype="tsv"/>
Expand All @@ -114,7 +114,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.tsv"/>
<output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
</test>
<test><!-- TEST 3 -->
<param name="data" value="input_data.parquet" ftype="parquet"/>
Expand All @@ -125,7 +125,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.parquet"/>
<output name="normalized_data" file="normalized_data.parquet" ftype="parquet"/>
</test>
<test><!-- TEST 4 -->
<param name="input_choice" value="2"/>
Expand All @@ -138,7 +138,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.csv"/>
<output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
</test>
<test><!-- TEST 5 -->
<param name="input_choice" value="2"/>
Expand All @@ -151,7 +151,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.tsv"/>
<output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
</test>
<test><!-- TEST 6 -->
<param name="input_choice" value="2"/>
Expand All @@ -164,7 +164,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200"/>
<output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200" ftype="parquet"/>
</test>
<test><!-- TEST 7 -->
<param name="input_choice" value="2"/>
Expand All @@ -178,7 +178,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200"/>
<output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200" ftype="parquet"/>
</test>
<test><!-- TEST 8 -->
<param name="input_choice" value="2"/>
Expand All @@ -192,7 +192,7 @@
<param name="t" value="0.05"/>
<param name="t2" value="0.05"/>
<param name="alpha" value="0"/>
<output name="normalized_data" file="normalized_data.csv"/>
<output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
</test>
<!-- The following test has different results on three platform I've tried -->
<!-- <test>
Expand Down
8 changes: 3 additions & 5 deletions tools/waveica/waveica_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,13 @@ exclude_group <- function(data, group) {
}

store_data <- function(data, output, ext) {
if (ext == "csv") {
write.csv(data, file = output, row.names = FALSE, quote = FALSE)
} else if (ext == "tsv") {
if (ext == "parquet") {
arrow::write_parquet(data, output)
} else {
write.table(data,
file = output, sep = "\t",
row.names = FALSE, quote = FALSE
)
} else {
arrow::write_parquet(data, sink = output)
}
cat("Normalization has been completed.\n")
}

0 comments on commit 84de3bc

Please sign in to comment.