knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
PICRUSt2 (Phylogenetic Investigation of Communities by Reconstruction of Unobserved States) is software that predicts functional abundances from marker gene sequences. It typically focuses on gene families like KEGG orthologs and Enzyme Classification numbers, but can predict any trait. While commonly used with 16S rRNA data, it also supports other marker genes.
The example data is from an article already published link and were sediment core samples that were collected from three zones of mangrove ecosystem: Basin, Fringe and Impaired. The samples were taken during two seasonal conditions, dry and flood seasons, at three sediment depths: surface, mid-layer, and deeper sediment layers, to assess the impact of degradation level or zone, seasonal variation, and sediment depth on microbial communities.
First, load the rbims package.
library(rbims)
The function to use that information is read_picrust2
. This function can parse the information of the KO, EC and pathways data from picrust2. The KEGG analysis is just possible if KO table is used.
KO_picrust2_profile <- read_picrust2("../inst/extdata/KO_metagenome_out/KO_pred_metagenome_unstrat.tsv", database = "KO", profile = T)
The database
argument will parse the database. In this example, I will explore the KO output.
The output format is chosen with the profile
argument. When profile = T, a wide output is obtained.
The write
argument saves the formatted table generated in .tsv extension. When write = F gives you the output but not saves the table in your current directory.
If you want to follow the example you can download the use rbims test file.
head(KO_picrust2_profile)
Or print a long table profile = F.
KO_picrust2_profile_long <- read_picrust2("../inst/extdata/KO_metagenome_out/KO_pred_metagenome_unstrat.tsv", database = "KO", profile = F)
head(KO_picrust2_profile_long)
You can export this to a table like this:
write.table(KO_picrust2_profile_long, "KO_picrust2.tsv", quote = F, sep = "\t", row.names = F, col.names = T)
Or setting write write = T.
Other databases optiones are: "EC" and "pathway":
EC_picrust2_profile <- read_picrust2("../inst/extdata/EC_metagenome_out/EC_pred_metagenome_unstrat.tsv", database = "EC", profile = T) head(EC_picrust2_profile)
pathways_picrust2_profile <- read_picrust2("../inst/extdata/pathways_out/path_abun_unstrat.tsv", database = "pathway", profile = T) head(pathways_picrust2_profile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.