Comments (12)
Hello,
Thank you for bringing this issue to my attention. In order to troubleshoot this problem effectively, I would need a bit more context. Could you possibly provide the dataset you are working with? This would allow me to replicate the issue on my end and hopefully identify a solution more swiftly.
Just to remind you, if your dataset contains sensitive or private information, please make sure to anonymize or de-identify it before sharing.
Thank you for your cooperation and patience while we work to resolve this issue.
Best regards.
from ggpicrust2.
Dear @Lacona ,
Thank you for reaching out regarding the error you encountered while creating pathway error bar plots using ggpicrust2.
I noticed that you're using the "LinDA" method in your code. When dealing with multiple groups in the metadata, I recommend switching to the "ALDEx2" method for creating pathway error bar plots. From my experience, LinDA can sometimes fail to produce accurate visualizations in cases of comparisons involving multiple groups.
Please try modifying your code as follows:
results_file <- ggpicrust2(file = abundance_file,
metadata = metadata,
group = "treatment",
pathway = "KO",
daa_method = "ALDEx2",
ko_to_kegg = TRUE,
order = "pathway_class",
p_values_bar = TRUE,
x_lab = "pathway_name")
Please let me know if this resolves the issue or if you have any further questions.
Best regards,
Chen
from ggpicrust2.
from ggpicrust2.
Dear Andrea,
Thank you for reaching out and for your patience. I understand that you have been exploring the ALDEx2 method and are having trouble figuring out how to perform multiple group comparisons. Unfortunately, the $results
output does not provide the desired information.
To address this issue, you can try the following code snippet:
library(readr)
library(ggpicrust2)
library(tibble)
library(tidyverse)
library(ggprism)
library(patchwork)
# Load metadata as a tibble
metadata <- read_delim("/Users/apple/Microbiome/ggpicrust2总/ggpicrust2测试/ggpicrust2_test/Lacona/Salmonella22_metadata_42R.tsv", delim = "\t", escape_double = FALSE, trim_ws = TRUE)
# Load KEGG pathway abundance
kegg_abundance <- ko2kegg_abundance("/Users/apple/Microbiome/ggpicrust2总/ggpicrust2测试/ggpicrust2_test/Lacona/pred_metagenome_unstrat (2).tsv")
# Perform pathway differential abundance analysis (DAA) using ALDEx2 method
daa_results_df <- pathway_daa(abundance = kegg_abundance, metadata = metadata, group = "treatment", daa_method = "ALDEx2", select = NULL, reference = NULL)
# Filter results for ALDEx2_Welch's t-test method
daa_sub_method_results_df <- daa_results_df[daa_results_df$method == "ALDEx2_Kruskal-Wallace test", ]
# Annotate pathway results using KO to KEGG conversion
daa_annotated_sub_method_results_df <- pathway_annotation(pathway = "KO", daa_results_df = daa_sub_method_results_df, ko_to_kegg = TRUE)
# Generate pathway error bar plot
pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_sub_method_results_df %>%
filter(!is.na(pathway_class)), Group = metadata$treatment, p_values_threshold = 0.05, order = "pathway_class", select = c("ko00561", "ko00310", "ko00604", "ko04973", "ko01051", "ko00300", "ko00591", "ko00253", "ko00380", "ko00625", "ko00627", "ko00270", "ko00941", "ko04910", "ko00363", "ko02010", "ko00361", "ko00362", "ko01040", "ko04626", "ko05020", "ko05146", "ko00051"), ko_to_kegg = TRUE, p_value_bar = FALSE, colors = NULL, x_lab = "pathway_name")
# Perform pathway PCA
pathway_pca(abundance = kegg_abundance, metadata = metadata, group = "treatment")
# Filter features with p-value < 0.05
feature_with_p_0.05 <- daa_annotated_sub_method_results_df %>% filter(p_adjust < 0.05) %>% filter(!is.na(pathway_class))
# Generate pathway heatmap
pathway_heatmap(abundance = kegg_abundance %>% filter(rownames(.) %in% feature_with_p_0.05$feature) %>% rownames_to_column("feature") %>% left_join(daa_annotated_sub_method_results_df %>% select(all_of(c("feature","pathway_name"))), by
= "feature") %>% column_to_rownames("pathway_name") %>% select(-"feature"), metadata = metadata, group = "treatment")
Please ensure that you modify the file paths in the code snippet to match your actual data file locations. This code will help you perform multiple group comparisons using the ALDEx2 method and generate pathway error bar plots, pathway PCA plots, and pathway heatmaps based on your metadata and KEGG abundance data.
If you have any further questions or need additional assistance, please don't hesitate to ask. I'm here to help.
from ggpicrust2.
from ggpicrust2.
from ggpicrust2.
from ggpicrust2.
from ggpicrust2.
from ggpicrust2.
from ggpicrust2.
Subsetting the dataset is a very easy thing. Maybe you guys should exercise your R skills instead of keeping telling something that is not related to ggpicrust.
from ggpicrust2.
from ggpicrust2.
Related Issues (20)
- error with MicrobiomeStat HOT 5
- Error in `guide_transform()`: ! <Guide> classes have been rewritten as <ggproto> classes. HOT 3
- undefined columns selected and ‘round’ not meaningful for factors HOT 3
- How to obtain log-fold change values? HOT 3
- curl_fetch_memory HOT 4
- The 'method' column in the 'daa_results_df' data frame contains more than one method. HOT 2
- All my pathway results are NA
- Help needed using sample dada Math.factor ‘round’ not meaningful for factors HOT 2
- pathway_pca HOT 4
- pathway_errorbar no longer working to graph data HOT 1
- Is this package compatible with other ggplot functions? HOT 1
- Error pathway_errorbar "`$<-.data.frame`(`*tmp*`, "group", value = c(2L, 2L, 2L, 2L, : replacement has 20 rows, data has 1" HOT 2
- Error in switch(file_format, .txt = abundance <- readr::read_delim(file, : EXPR must be a length 1 vector** HOT 2
- pathway_annotation error "An error occurred. Retrying......" HOT 3
- # Perform pathway DAA using ALDEx2 method not working with example dataset HOT 1
- add a title to errorbar and heatmap HOT 9
- Installation issues with Rfast HOT 2
- Issue with pathway_errorbar : "The `legend.text.align` theme element is not defined in the element hierarchy." HOT 6
- Error in ggpicrust2 (There are no statistically significant biomarkers in the dataset) HOT 4
- Error in `plot_theme()`: ! The `legend.text.align` theme element is not defined in the element hierarchy. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggpicrust2.