-
Notifications
You must be signed in to change notification settings - Fork 26
Description
β Question / Help Request
π What do you need help with?
- [+] Understanding how to use a specific function
- Choosing the right analysis method
- Interpreting results
- Data preparation and formatting
- Installation or setup issues
- Best practices for my research question
- Troubleshooting unexpected results
- Other: ___________
π¬ Research Context
Briefly describe your research question and study design:
Study type:
- Case-control study
- Time series / longitudinal
- Cross-sectional
- [+] Experimental design
- Other: ___________
π Your Data
Data source:
- [ +] PICRUSt2 output (
pred_metagenome_unstrat.tsv) - Processed abundance data
- Example data from package
- Other: ___________
Data characteristics:
- Number of samples: 9
- Number of groups/conditions: 3
- Sample size per group: 3
- Type of microbiome data: [16S]
π» What you've tried
Current approach:
# Please share your current code (even if it's not working)
library(ggpicrust2)
# Your code here...library(ggpicrust2)
library(tidyverse)
library(patchwork)
library(RColorBrewer)
Paths
path_abun <- "/home/arif/16S_QIIME2/picrust2_input/picrust2_out/pathways_out/path_abun_unstrat.tsv"
path_meta <- "/home/arif/16S_QIIME2/metadata.tsv"
Load abundance
abundance <- read_tsv(path_abun, show_col_types = FALSE)
Load metadata β force "group" column
metadata <- read_tsv(path_meta, show_col_types = FALSE) %>%
column_to_rownames("sample-id") %>%
select(group) # β exactly "group"
Color palette
my_colors <- colorRampPalette(rev(brewer.pal(11, "RdYlBu")))(100)
Level 1
p1 <- pathway_heatmap(
abundance = abundance,
metadata = metadata,
cluster_rows = TRUE,
cluster_cols = TRUE
) + ggtitle("KEGG Level 1 Pathways")
Level 2
p2 <- pathway_heatmap(
abundance = abundance,
metadata = metadata,
cluster_rows = TRUE,
cluster_cols = TRUE
) + ggtitle("KEGG Level 2 Pathways")
Level 3 (top 50)
top50 <- abundance %>%
column_to_rownames("pathway") %>%
rowSums() %>%
sort(decreasing = TRUE) %>%
names() %>%
head(50)
p3 <- pathway_heatmap(
abundance = abundance %>% filter(pathway %in% top50),
metadata = metadata,
cluster_rows = TRUE,
cluster_cols = TRUE
) + ggtitle("KEGG Level 3 (Top 50)")
Combine
combined <- p1 + p2 + p3 + plot_layout(ncol = 1)
Save
dir.create("kegg_heatmaps", showWarnings = FALSE)
ggsave("kegg_heatmaps/Level1.png", p1, width = 12, height = 10, dpi = 300)
ggsave("kegg_heatmaps/Level2.png", p2, width = 16, height = 14, dpi = 300)
ggsave("kegg_heatmaps/Level3_Top50.png", p3, width = 20, height = 18, dpi = 300)
ggsave("kegg_heatmaps/All_Levels.png", combined, width = 20, height = 30, dpi = 300)
cat("Heatmaps saved! Check folder: kegg_heatmaps/\n")
Current results or issues:
Describe what you're getting vs. what you expected.
π― Specific Questions
-
π― Specific Questions
- Why does pathway_heatmap() throw "unused arguments (show_rownames = TRUE, show_colnames = TRUE)" even though these are listed in some documentation/examples?
- When I remove those arguments, I get "argument 'group' is missing, with no default" β but my metadata has a column exactly named "group".
- Is there a different function or updated syntax/script
for creating level-wise (Level 1/2/3) KEGG pathway heatmaps in the current version?
4. What is the recommended way to create clustered heatmaps grouped by sample metadata (e.g., Control vs Treatment groups)?
π Background Research
- I've read the package documentation
- I've reviewed the vignettes
- [ +] I've searched existing issues
- I've consulted relevant literature
Helpful resources you've already checked:
π₯οΈ Environment (if relevant)
- **Operating System: Ubuntu 24.04.3 LTS
- **R Version: 4.5.2
- **ggpicrust2 Version: 2.5.2
π Analysis Goals
What do you ultimately want to achieve?
- Identify differentially abundant pathways
- [ +] Create publication-quality figures
- Compare different methods
- Perform statistical analysis
- Data exploration and visualization
- Other: ___________
β° Timeline
- This is urgent for a deadline
- [+] I have some flexibility with timing
- This is for future planning
π Additional Context
Any other information that might be helpful for understanding your question or providing better guidance.