picrust2_plot.R - juanravm/MicroSeqProfiler GitHub Wiki
Metagenomic pathway differential activity analysis and graphical representation (picrust2_plot.R)
Finally, after inferring on metagenomic composition with PICRUSt2, this script performs an ANOVA-like differential expression analysis through ALDEx2 tool with Benjamini-Hochberg (BH) p-values adjustment. Also, this tool generates two graphical visualizations through ggpicrust2 package:
- An errorbar visualization with significant metagenomic pathways between groups
- A PCA visualization of the metagenomic pathways composition comparing groups
As well as we did in the other R scripts, you must deactivate conda picrust2 enviroment prior to make this analysis in R:
conda deactivate
You can run this script as shown below:
Rscript /file_path/picrust2_plot.R \
--metadata_fp /file_path/metadata.tsv \
--col Comparison \
--ref_group Healthy \
--method MetaCyc \
--picrust_dir /directory_path/picrust2/output \
--Visualizations /directory_path/picrust2/Visualizations
Specifying the variables:
--metadata_fp- Metadata file path--col- A character string indicating the metadata column where the groups to compare are--ref_group- Reference group for statistical analysis--method- Selected PICRUSt2 inference method for statistical analysis. These methods can be:KOfor KEGG Orthologs,ECfor Enzyme Commission Numbers andMetaCycfor MetaCyc pathways inference.--picrust_dir- PICRUSt2 output directory for detecting input files. It is generated automatically with picrust2.sh script--Visualizations- PICRUSt2 "Visualizations" directory for output files generation. It is generated automatically with picrust2.sh script
This script returns:
method.tsv- A data frame with the results of pathway differential abundance analysis with p-values corrected by BH method. This file is called KO, EC or MetaCyc depending on the selected method.method.png- A graphical errorbar visualization with the significant features (only if there are significant pathways).method_PCA.pngA graphical PCA visualization comparing metagenomic pathway composition of groups