Skip to content

Commit

Permalink
fix inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaraBesemer committed Dec 1, 2024
1 parent b89f35c commit 79169e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
10 changes: 2 additions & 8 deletions tools/phyloseq/phyloseq_plot_bar.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ option_list <- list(
help = "Variable for x-axis (e.g., 'Sample', 'Phylum')"
),
make_option(c("--fill"),
action = "store", dest = "fill",
help = "Variable for fill color (e.g., 'Genus', 'Order')"
action = "store", dest = "fill", default = NULL,
help = "Variable for fill color (e.g., 'Genus', 'Order') (optional)"
),
make_option(c("--facet"),
action = "store", dest = "facet", default = NULL,
Expand All @@ -41,9 +41,6 @@ if (is.null(opt$input) || opt$input == "") {
if (is.null(opt$x) || opt$x == "") {
stop("Error: X-axis variable is required.")
}
if (is.null(opt$fill) || opt$fill == "") {
stop("Error: Fill variable is required.")
}
if (is.null(opt$output) || opt$output == "") {
stop("Error: Output file is required.")
}
Expand All @@ -57,9 +54,6 @@ sample_vars <- colnames(sample_data(physeq))
if (!opt$x %in% sample_vars) {
stop(paste("Error: X-axis variable", opt$x, "does not exist in the sample data."))
}
if (!opt$fill %in% sample_vars) {
stop(paste("Error: Fill variable", opt$fill, "does not exist in the sample data."))
}

# Generate bar plot
p <- plot_bar(physeq, x = opt$x, fill = opt$fill)
Expand Down
11 changes: 2 additions & 9 deletions tools/phyloseq/phyloseq_plot_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ Rscript '${__tool_directory__}/phyloseq_plot_bar.R'
</assert_contents>
</output>
</test>
<!-- Test 2: Missing x and fill parameters -->
<test>
<param name="input" value="output.phyloseq" ftype="phyloseq"/>
<param name="x" value="Number"/>
<param name="fill" value=""/>
<expect_exit_code>1</expect_exit_code>
</test>
<!-- Test 3: Valid parameters without facet -->
<!-- Test 2: Valid parameters without facet -->
<test>
<param name="input" value="output.phyloseq" ftype="phyloseq"/>
<param name="x" value="Property"/>
Expand All @@ -67,7 +60,7 @@ Rscript '${__tool_directory__}/phyloseq_plot_bar.R'

- **Input**: A phyloseq object in RDS format.
- **X-axis variable**: The variable to use for the x-axis (e.g., Sample, Phylum).
- **Fill variable**: The variable to use for the bar fill colors (e.g., Genus, Order).
- **Fill variable**: (Optional) The variable to use for the bar fill colors (e.g., Genus, Order).
- **Facet by variable**: (Optional) A variable to facet the bar chart (e.g., SampleType).

**Outputs**
Expand Down

0 comments on commit 79169e6

Please sign in to comment.