Open bplet01 opened 1 month ago
Also stuck here...
Dear @bplet01 and @Salineraptor,
Thank you for bringing this issue to our attention. I apologize for any confusion this may have caused. I believe I can help clarify the problem you're encountering.
The error you're seeing is likely due to how you're passing the data into the ggpicrust2
function. I notice that you've already read the data using read_delim
before calling ggpicrust2
. In this case, you should use the data
parameter instead of the file
parameter.
Here's how you can modify your code:
# Your existing code to read the file
KO_abundance_file <- read_delim("pred_metagenome_unstrat.tsv", delim = "\t", escape_double = FALSE, trim_ws = TRUE)
metadata <- read_delim("Metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)
# Modified ggpicrust2 call
KO_results_file_input <- ggpicrust2(data = KO_abundance_file, metadata = metadata, group = "Treatment", pathway = "KO", daa_method = "ALDEx2", ko_to_kegg = TRUE, p.adjust = "fdr", order = "pathway_class", p_values_bar = TRUE, x_lab = "pathway_name")
The key change here is replacing file = KO_abundance_file
with data = KO_abundance_file
. The file
parameter is used when you want ggpicrust2
to read the file directly, while the data
parameter is used when you're passing an already-read data frame.
Please try this modification and let me know if it resolves the issue. If you encounter any further problems, don't hesitate to reach out.
Best regards, Chen Yang
I am trying to run ggpicrust2, and am having an issue. Below is the script I'm running:
Load necessary data: abundance data and metadata
KO_abundance_file <- read_delim("pred_metagenome_unstrat.tsv", delim = "\t", escape_double = FALSE, trim_ws = TRUE)
metadata <- read_delim("Metadata.txt", delim = "\t", escape_double = FALSE, trim_ws = TRUE)
Run ggpicrust2 with input file path
KO_results_file_input <- ggpicrust2(file = KO_abundance_file, metadata = metadata, group = "Treatment", pathway = "KO", daa_method = "ALDEx2", ko_to_kegg = TRUE, p.adjust = "fdr", order = "pathway_class", p_values_bar = TRUE, x_lab = "pathway_name")
When I start the analysis, I receive the below error message:
Starting the ggpicrust2 analysis...
Converting KO to KEGG...
Loading data from file... Error in switch(file_format, .txt = abundance <- readr::read_delim(file, : EXPR must be a length 1 vector
Any suggestions on how to resolve this?
Thanks!