You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I am using ggpicrust2 in R from the PICRUST output files. I am interested to look some of the specific pathways from metacyc output. Below, code I used for plotting heatmap showing the pathways that are significant (< 0.05). I am wondering how to choose selective pathway to make heatmap that are interested for example (Aromatic compound degradation, Pathogenecity).
Could you help me in this regard.. How can I do it with the code. Thanks.
Thank you for your question about selecting specific MetaCyc pathways in ggpicrust2. I can help you modify your code to visualize only the pathways you're interested in (like aromatic compound degradation and pathogenicity). Here are several approaches:
Using keyword filtering:
# Filter pathways by keywordsinterested_pathways<-metacyc_daa_annotated_results_dfnew %>%
filter(
# Use regex to match descriptions you're interested in
grepl("aromatic|degradation|pathogen", description, ignore.case=TRUE)
)
# Create heatmap with filtered pathways
pathway_heatmap(
abundance=metacyc_abundancenew %>%
right_join(
metacyc_daa_annotated_results_dfnew %>%
select(all_of(c("feature","description"))),
by= c("pathway"="feature")
) %>%
# Filter to include only pathways of interest
filter(pathway%in%interested_pathways$feature) %>%
select(-"pathway") %>%
column_to_rownames("description"),
metadata=metadata,
group="sample"
)
For more precise filtering, you can create a vector of specific keywords:
# Define keywords of interestkeywords<- c(
"aromatic compound degradation",
"pathogenicity",
"virulence",
# Add more keywords as needed...
)
# Filter using keywordsinterested_pathways<-metacyc_daa_annotated_results_dfnew %>%
filter(
sapply(keywords, function(x) grepl(x, description, ignore.case=TRUE)) %>%
apply(1, any)
)
If you know the specific pathway IDs, you can filter directly:
# Use specific pathway IDspathway_ids<- c("PWY-6261", "PWY-6126") # Replace with your pathways of interestinterested_pathways<-metacyc_daa_annotated_results_dfnew %>%
filter(feature%in%pathway_ids)
Tips:
You can first view all pathway descriptions using View(metacyc_daa_annotated_results_dfnew) to help identify the ones you're interested in
The ignore.case = TRUE parameter ensures case-insensitive matching
Adjust the keywords or filtering criteria based on your specific needs
You can combine these methods as needed
Let me know if you need any clarification or have additional questions!
Hello
I am using ggpicrust2 in R from the PICRUST output files. I am interested to look some of the specific pathways from metacyc output. Below, code I used for plotting heatmap showing the pathways that are significant (< 0.05). I am wondering how to choose selective pathway to make heatmap that are interested for example (Aromatic compound degradation, Pathogenecity).
Could you help me in this regard.. How can I do it with the code. Thanks.
The text was updated successfully, but these errors were encountered: