Importing Data from Mothur into MicrobiomeStat

Steps for importing Mothur-generated data into the MicrobiomeStat framework.

This guide details the procedure to seamlessly import data generated by Mothur into the MicrobiomeStat environment.

This compressed file contains the list file from Mothur, which typically encompasses OTU clustering information for various thresholds.
The shared file provides a breakdown of the abundance of OTUs in each sample.
Group file indicating the sample assignment for each sequence.
Phylogenetic tree file representing the evolutionary relationships among OTUs.
# Make sure the plyr package is installed
if (!require(plyr)) {
    install.packages("plyr")
    library(plyr)
} else {
    library(plyr)
}

# Specify the paths to your Mothur files
path_to_list_file <- "/path_to_your_files/esophagus.fn.list.gz"
path_to_group_file <- "/path_to_your_files/esophagus.good.groups.gz"
path_to_tree_file <- "/path_to_your_files/esophagus.tree.gz"
path_to_shared_file <- "/path_to_your_files/esophagus.fn.shared.gz"

# Import Mothur data into a MicrobiomeStat data object
data_obj <- mStat_import_mothur_as_data_obj(
    mothur_list_file = path_to_list_file,
    mothur_group_file = path_to_group_file,
    mothur_tree_file = path_to_tree_file,
    mothur_shared_file = path_to_shared_file
)

# After constructing data_obj, detach the plyr package to avoid conflicts with dplyr
if ("package:plyr" %in% search()) {
    detach("package:plyr", unload = TRUE)
    message("Detached plyr package to avoid potential conflicts with dplyr.")
}

The mStat_import_mothur_as_data_obj function facilitates the conversion of the Mothur dataset to the basic MicrobiomeStat data objects. Here are the key components:

  • mothur_list_file (Optional): Mothur-generated list file.

  • mothur_group_file (Optional): Group designation file from Mothur.

  • mothur_tree_file (Optional): Phylogenetic tree representation.

  • mothur_shared_file (Optional): OTU Abundance data across samples.

  • mothur_constaxonomy_file (Optional): Classification of OTUs at various taxonomic levels.

  • parseFunction (Optional): Custom function for taxonomy parsing, with 'parse_taxonomy_default' as an available option.

Structural overview of the `data_obj` generated after importing Mothur datasets into MicrobiomeStat.

Last updated

Was this helpful?