Skip to contents

Merges two or more MetaboSet objects together. Can be used to merge analytical modes or batches.

Usage

merge_metabosets(..., merge = c("features", "samples"))

Arguments

...

MetaboSet objects or a list of MetaboSet objects

merge

what to merge? features is used for combining analytical modes, samples is used for batches

Value

A merged MetaboSet object.

Details

When merging samples, sample IDs that beging with "QC" or "Ref" are combined so that they have running numbers on them. This means that if both batches have samples called "QC_1", this will not result in an error, but the sample IDs will be adjusted so that they are unique.

Examples

# Merge analytical modes
data(hilic_neg_sample, hilic_pos_sample, rp_neg_sample, rp_pos_sample)
modes <- list(hilic_neg_sample, hilic_pos_sample, 
              rp_neg_sample, rp_pos_sample)
modes <- lapply(modes, function(mode) as(mode, "MetaboSet"))
#> INFO [2025-06-23 22:36:45] 
#> Checking feature information
#> INFO [2025-06-23 22:36:45] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Flag' column
#> INFO [2025-06-23 22:36:45] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:45] Setting row and column names of exprs based on feature and pheno data
#> INFO [2025-06-23 22:36:45] 
#> Checking feature information
#> INFO [2025-06-23 22:36:45] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Flag' column
#> INFO [2025-06-23 22:36:45] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:45] Setting row and column names of exprs based on feature and pheno data
#> INFO [2025-06-23 22:36:45] 
#> Checking feature information
#> INFO [2025-06-23 22:36:45] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Flag' column
#> INFO [2025-06-23 22:36:45] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:45] Setting row and column names of exprs based on feature and pheno data
#> INFO [2025-06-23 22:36:45] 
#> Checking feature information
#> INFO [2025-06-23 22:36:45] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:45] Checking that feature data includes a 'Flag' column
#> INFO [2025-06-23 22:36:45] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:45] Setting row and column names of exprs based on feature and pheno data
merged <- merge_metabosets(modes)

# Merge batches
data(example_set)
batch1 <- example_set[, example_set$Batch == 1]
batch2 <- example_set[, example_set$Batch == 2]
merged <- merge_metabosets(batch1, batch2, merge = "samples")