Skip to contents

This function is part of the MicrobiomeStat package. It updates the sample names in a given data object. The data object should contain three components: a metadata table (`meta.dat`), a feature aggregation list (`feature.agg.list`), and a feature table (`feature.tab`).

Usage

mStat_update_sample_name(data.obj, new.name)

Arguments

data.obj

A list object in a format specific to MicrobiomeStat, which can include components such as feature.tab (matrix), feature.ann (matrix), meta.dat (data.frame), tree, and feature.agg.list (list). The data.obj can be converted from other formats using several functions from the MicrobiomeStat package, including: 'mStat_convert_DGEList_to_data_obj', 'mStat_convert_DESeqDataSet_to_data_obj', 'mStat_convert_phyloseq_to_data_obj', 'mStat_convert_SummarizedExperiment_to_data_obj', 'mStat_import_qiime2_as_data_obj', 'mStat_import_mothur_as_data_obj', 'mStat_import_dada2_as_data_obj', and 'mStat_import_biom_as_data_obj'. Alternatively, users can construct their own data.obj. Note that not all components of data.obj may be required for all functions in the MicrobiomeStat package. `meta.dat`, `feature.agg.list`, and `feature.tab` components.

new.name

A character vector containing the new sample names. The length of new.name should match the number of rows in `meta.dat`, and there should be no duplicates.

Value

A data object with updated sample names. The object is similar to the input object, but the sample names in `meta.dat`, `feature.agg.list`, and `feature.tab` are updated to `new.name`.

Examples

if (FALSE) { # \dontrun{
# Load the required libraries
library(MicrobiomeStat)

data(peerj32.obj)
# Update sample names
new.names <- paste0("new-", colnames(peerj32.obj$feature.tab))
updated_peerj32.obj <- mStat_update_sample_name(data.obj = peerj32.obj,
new.name = new.names)
} # }