Skip to content

Error in pathway_heatmap(): unused arguments (show_rownames = TRUE, show_colnames = TRUE) and missing "group" argumentΒ #195

@ShahariarArif

Description

@ShahariarArif

❓ 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

  1. 🎯 Specific Questions

  2. Why does pathway_heatmap() throw "unused arguments (show_rownames = TRUE, show_colnames = TRUE)" even though these are listed in some documentation/examples?
  3. When I remove those arguments, I get "argument 'group' is missing, with no default" β€” but my metadata has a column exactly named "group".
  4. Is there a different function or updated syntax/script
Image Image

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.

metadata.tsv

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions