General FAQs

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 https://github.com/cafferychen777/MicrobiomeStat/issues, 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.

Last updated