Converting Data from Phyloseq into MicrobiomeStat
Learn the process for converting Phyloseq data format into MicrobiomeStat data format.
Last updated
Learn the process for converting Phyloseq data format into MicrobiomeStat data format.
Last updated
The guide illustrates the procedure to convert a Phyloseq data object into a MicrobiomeStat data object.
Before converting your Phyloseq object to a MicrobiomeStat data object, it is crucial to ensure that the taxa are represented as rows in your Phyloseq object. This is a requirement for the conversion process to work correctly.
To check if your Phyloseq object has taxa as rows, you can use the phyloseq::taxa_are_rows()
function:
If the function returns TRUE
, your Phyloseq object is ready for conversion. If it returns FALSE
, you need to transpose your Phyloseq object to have taxa as rows before proceeding with the conversion.
If your Phyloseq object contains a phylogenetic tree, you also need to load the phangorn
package for midpoint rooting:
First, let's take a look at the original structure of our Phyloseq data:
Now, initiate the conversion:
After the conversion, the Phyloseq object is transformed into a MicrobiomeStat data object. Let's examine the structure post-conversion:
During the conversion, there might be changes in the levels of factors in the metadata. This can potentially alter the order or even result in missing levels.
Recommendation: It's important to verify the factors after conversion to ensure data consistency. If there are any changes, the factor levels should be reset:
Reorder the factor levels of the sex
column。
The function mStat_convert_phyloseq_to_data_obj
returns a MicrobiomeStat data object, which includes:
feature.tab: A matrix representing the feature table (OTU table). Rows with a sum of zero are excluded, retaining only the features present in the samples.
meta.dat: A data frame containing the sample data.
feature.ann: A matrix of the feature annotation table (taxonomy table). Only the rows corresponding to the feature table are included.
tree: A rooted phylogenetic tree. If the tree is not rooted, it will be rooted using the midpoint method. Tips not present in the OTU table are pruned.
After converting the Phyloseq object to the MicrobiomeStat format, the data is now compatible with MicrobiomeStat's analysis tools.