MicrobiomeStat Tutorial
  • Track, Analyze, Visualize: Unravel Your Microbiome's Temporal Pattern with MicrobiomeStat.
  • INTRODUCTION
    • Exploring MicrobiomeStat: A Consideration for Your Research Toolkit
  • Setting Up MicrobiomeStat: Installation and Data Preparation
    • Installation Guide
    • Creating the MicrobiomeStat Data Object
      • Building MicrobiomeStat from Matrix and Data.frame
      • Converting Data from Phyloseq into MicrobiomeStat
      • Importing Data from QIIME2 into MicrobiomeStat
      • Importing Data from BIOM into MicrobiomeStat
      • Converting SummarizedExperiment into MicrobiomeStat
      • Converting DGEList Data into MicrobiomeStat
      • Converting DESeqDataSet into MicrobiomeStat
      • Importing Data from DADA2 into MicrobiomeStat
      • Importing Data from Mothur into MicrobiomeStat
  • Single-Point Analysis
    • Introduction
    • Alpha Diversity Analysis
    • Beta Diversity Analysis
    • Feature-level Analysis
    • One-Click Reports Generation
  • Paired Samples Analysis
    • Introduction
    • Alpha Diversity Analysis
    • Beta Diversity Analysis
    • Feature-level Analysis
    • One-Click Reports Generation
  • Longitudinal Analysis
    • Introduction
    • Alpha Diversity Analysis
    • Beta Diversity Analysis
    • Feature-level Analysis
    • One-Click Reports Generation
  • Data Manipulation and Transformation
    • Data Summary
    • Data Aggregation
    • Data Normalization
    • Data Filtering
    • Data Validation
    • Data Combination
    • Metadata Management
    • Color Palette
  • Frequently Asked Questions (FAQ)
    • General FAQs
Powered by GitBook
On this page
  • I'm having an issue converting a phyloseq object to a MicrobiomeStat object using mStat_convert_phyloseq_to_data_obj()
  • Accessing Bray-Curtis distances from generate_beta_ordination_pair
  • Difference between generate_beta_ordination_pair and generate_beta_change_spaghettiplot_long
  • Error with generate_beta_test_single()
  • Error with generate_alpha_trend_test_long
  • Error normalizing data with GMPR method
  • Missing timepoints in generate_taxa_areaplot_long visualization
  • Reason for feature.mt.method option in generate_taxa_volcano_single()
  • Issue with Corrupted Lazy-Load Database for MicrobiomeStat Package
  • Windows Installation Error: "System command 'Rcmd.exe' failed"

Was this helpful?

Edit on GitHub
  1. Frequently Asked Questions (FAQ)

General FAQs

PreviousColor Palette

Last updated 5 months ago

Was this helpful?

This document is a collection of frequently asked questions (FAQs) and their solutions regarding the use of the MicrobiomeStat package in R. These FAQs are based on common issues and inquiries encountered by users in the past. For additional questions or if you encounter new issues, please feel free to visit the GitHub issues section of the MicrobiomeStat repository at , where you can post your questions and receive support from the community and the package developers.

I'm having an issue converting a phyloseq object to a MicrobiomeStat object using mStat_convert_phyloseq_to_data_obj()

Despite installing the latest version of MicrobiomeStat from GitHub, I'm still getting the error "could not find function 'mStat_convert_phyloseq_to_data_obj'". Any suggestions?

Solution:

It appears there may have been an issue with the installation. After downloading and installing, pay attention to the version numbers. The current CRAN version is 1.1, while the GitHub version is 1.1.3. If the installation of the GitHub version is unsuccessful, this issue may arise. Ensure you have installed all necessary dependencies before attempting to install from GitHub:

packages_to_install <- c(
  "rlang", "tibble", "ggplot2", "matrixStats", "lmerTest", "foreach", 
  "modeest", "dplyr", "pheatmap", "tidyr", "ggh4x", "GUniFrac", "stringr",
  "rmarkdown", "knitr", "pander", "tinytex", "vegan", "scales", "ape",
  "ggrepel", "parallel", "ggprism", "aplot", "yaml", "biomformat", "Biostrings"
)
install.packages(packages_to_install)

Then install MicrobiomeStat: devtools::install_github("cafferychen777/MicrobiomeStat")

If issues persist, check for error messages during installation.

Accessing Bray-Curtis distances from generate_beta_ordination_pair

I successfully plotted Bray-Curtis distance over time, but cannot access the calculated distances. Will this option be included in the future?

Solution:

The distances are accessible in the object generated by generate_beta_ordination_pair:

plot <- generate_beta_ordination_pair(data.obj = your_data_object, ...)
bray_curtis_data <- plot$BC$data

We continuously improve MicrobiomeStat and appreciate suggestions for new features.

Difference between generate_beta_ordination_pair and generate_beta_change_spaghettiplot_long

I can get BC distance data with the former but not the latter when dist.name = c("BC") is included. Are they equivalent?

Solution:

No, the two methods differ:

  • generate_beta_ordination_pair uses PC1 and PC2 from multidimensional scaling (MDS)

  • generate_beta_change_spaghettiplot_long calculates distances relative to original points

To get BC distances from generate_beta_change_spaghettiplot_long:

a <- generate_beta_change_spaghettiplot_long(data.obj = your_data_object, dist.name = c("BC"), ...)
a$BC$layers[[1]]$data

Error with generate_beta_test_single()

When running the tutorial, I got: Error in colnames<-(*tmp*, value = colnames(lhs)) : attempt to set 'colnames' on an object with less than two dimensions. Any idea what's happening?

Solution:

This could be due to conflicts/issues with your setup. Try:

  1. Reinstall MicrobiomeStat package

  2. Reinstall GUniFrac package

  3. Ensure latest versions of all dependencies

If issues persist, provide more details on your system and error messages.

Error with generate_alpha_trend_test_long

I get Error in vec_data() : ! 'x' must be a vector, not a <sample_data> object when running this function. Time variable is numeric, any idea what's wrong?

Solution:

The feature.tab, meta.dat, and feature.ann components may not be in expected R matrix/data.frame format. Convert them:

ms_rare$feature.tab <- as.data.frame(ms_rare$feature.tab) %>% as.matrix()
ms_rare$meta.dat <- as.matrix(ms_rare$meta.dat) %>% as.data.frame() 
ms_rare$feature.ann <- ms_rare$feature.ann %>% as.data.frame() %>% as.matrix()

This should ensure the components are in the correct format. Reach out if issues persist.

Error normalizing data with GMPR method

I get Error in GMPR(otu_tab) : could not find function "GMPR" when trying to normalize using the GMPR method. How to resolve?

Solution:

This error occurs when the required GUniFrac package is not loaded. Load it first:

library(GUniFrac) 

Then you should be able to normalize using GMPR without the error.

Missing timepoints in generate_taxa_areaplot_long visualization

I'm missing some timepoints and subject.var values when visualizing taxa changes across timepoints. My timepoints are 0, 1, 2, 3, 5, 6, 7, 8, 10, 12, 18, 24 (not all present in each sample). Suggestions?

Solution:

Try pairing mStat_subset_data with generate_taxa_areaplot_long in a loop to generate plots for each subject:

data(subset_T2D.obj)
unique.subject.id <- subset_T2D.obj$meta.dat$subject_id

plot.list <- lapply(unique.subject.id, function(subject.id){
  sample.ids <- rownames(subset_T2D.obj$meta.dat[subset_T2D.obj$meta.dat$subject_id == subject.id, ])
  sub_subset_T2D.obj <- mStat_subset_data(subset_T2D.obj, sample.ids)
  
  generate_taxa_areaplot_long(sub_subset_T2D.obj,
                              subject.var = "subject_id",
                              time.var = "visit_number_num", 
                              feature.level = c("Genus"),
                              feature.dat.type = "count",
                              file.ann = subject.id)
})

Modify group.var as needed to group data by specific variables.

Reason for feature.mt.method option in generate_taxa_volcano_single()

The linda() function already accounts for FDR, but generate_taxa_volcano_single() has a feature.mt.method option to use "none" or "fdr". Why add another FDR layer?

Solution:

FDR adjustment is crucial for high-dimensional data to control multiple testing issues, which linda() inherently does.

The feature.mt.method parameter allows users to choose between adjusted p-values (via FDR) or raw p-values for visualization in the volcano plot. Using raw p-values is for aesthetic reasons to improve plot clarity and interpretability.

While FDR adjustment is integral to MicrobiomeStat's statistical procedures, feature.mt.method offers flexibility in visualization without compromising statistical rigor.

Issue with Corrupted Lazy-Load Database for MicrobiomeStat Package

Problem: When running functions from the MicrobiomeStat package, the following error is encountered:

Warning: restarting interrupted promise evaluation 
Warning: internal error -3 in R_decompress1
Error in FUN(X[[i]], ...) : The lazy-load database '/R/x86_64-pc-linux-gnu-library/4.2/MicrobiomeStat/R/MicrobiomeStat.rdb' is corrupted.

Solution:

  1. Restart the R session: This often resolves issues related to the lazy-load database.

  2. Reinstall the MicrobiomeStat package: If restarting the R session does not work, try reinstalling the package using:

devtools::install_github("cafferychen777/MicrobiomeStat")

If these steps do not resolve the issue, please provide more detailed information for further troubleshooting.

Windows Installation Error: "System command 'Rcmd.exe' failed"

Problem: Users encountering "System command 'Rcmd.exe' failed" error or issues with file path lengths during Windows installation.

Solution:

Several approaches can resolve this issue:

  1. Using pak Package (Recommended):

if (!requireNamespace("pak", quietly = TRUE)) {
  install.packages("pak")
}
pak::pkg_install("cafferychen777/MicrobiomeStat", dependencies = TRUE)
  1. Using Shorter Temporary Directory Path:

# Set temporary directory to a shorter path
dir.create("C:/Rtemp", showWarnings = FALSE)
Sys.setenv(TMPDIR = "C:/Rtemp")

# Install the package
devtools::install_github("cafferychen777/MicrobiomeStat", build_vignettes = FALSE)
  1. Modify Windows Path Length Limit:

    • Open PowerShell as Administrator

    • Run: Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1

    • Restart computer

If issues persist, check:

# Check temporary directory
Sys.getenv("TMPDIR")

# Check working directory
getwd()

Ensure latest Rtools is installed and try running R/RStudio as administrator.

https://github.com/cafferychen777/MicrobiomeStat/issues