
Validate and Adjust a MicrobiomeStat Data Object
Source:R/mStat_validate_data.R
mStat_validate_data.RdChecks data object structure and consistency, adjusting components if needed.
Arguments
- data.obj
A MicrobiomeStat data object, which is a list containing at minimum the following components:
feature.tab: A matrix of feature abundances (taxa/genes as rows, samples as columns)meta.dat: A data frame of sample metadata (samples as rows)
Optional components include:
feature.ann: A matrix/data frame of feature annotations (e.g., taxonomy)tree: A phylogenetic tree object (class "phylo")feature.agg.list: Pre-aggregated feature tables by taxonomy
Data objects can be created using converters like
mStat_convert_phyloseq_to_data_objor importers likemStat_import_qiime2_as_data_obj.
Details
The function checks if 'meta.dat' is a data frame and converts it to one if it isn't. The function then checks two rules: whether the row names of 'feature.tab' match the row names of 'feature.ann', and whether the column names of 'feature.tab' match the row names of 'meta.dat'. If either of these checks fail, the function adjusts the relevant parts of the data object to meet these rules.
Examples
if (FALSE) { # \dontrun{
# Assume 'data.obj' is your data object
data(peerj32.obj)
mStat_validate_data(peerj32.obj)
mStat_validate_data(mStat_normalize_data(peerj32.obj, "TSS")$data.obj.norm)
} # }