Skip to contents

Construct MetaboSet objects from input read by read_from_excel. Returns a list of MetaboSet objects, one per mode. The modes are separated by the "Split" column in feature data.

Usage

construct_metabosets(
  exprs,
  pheno_data,
  feature_data,
  group_col = NA_character_,
  time_col = NA_character_,
  subject_col = NA_character_,
  split_data = TRUE
)

Arguments

exprs

matrix, the feature abundances, size features x samples

pheno_data

data frame, sample information, size sample info variables x samples

feature_data

data frame, information about the features, size features x feature info columns

group_col

character, the name of the column in pheno_data to use as the grouping variable

time_col

character, the name of the column in pheno_data to use as the time variable

subject_col

character, the name of the column in pheno_data to use as the subject ID variable

split_data

logical, whether to split data by analytical mode recorded in the "Split" column of feature data. If TRUE (the default), will return a list of MetaboSet objects, one per analytical mode. If FALSE, will return a single MetaboSet object.

Value

A list of MetaboSet objects or a single MetaboSet object.

See also

Examples

data <- read_from_excel(
  file = system.file("extdata", "example_set.xlsx", 
  package = "notame"), sheet = 1, corner_row = 11, corner_column = "H",
  split_by = c("Column", "Ion_mode"))
#> INFO [2025-06-23 22:36:30] Corner detected correctly at row 11, column H
#> INFO [2025-06-23 22:36:30] 
#> Extracting sample information from rows 1 to 11 and columns I to BF
#> INFO [2025-06-23 22:36:30] Replacing spaces in sample information column names with underscores (_)
#> INFO [2025-06-23 22:36:30] Naming the last column of sample information "Datafile"
#> INFO [2025-06-23 22:36:30] 
#> Extracting feature information from rows 12 to 91 and columns A to H
#> INFO [2025-06-23 22:36:30] 
#> Extracting feature abundances from rows 12 to 91 and columns I to BF
#> INFO [2025-06-23 22:36:30] Pheno data was cleaned
#> INFO [2025-06-23 22:36:30] Feature data was cleaned
#> INFO [2025-06-23 22:36:30] 
#> Checking sample information
#> INFO [2025-06-23 22:36:30] Checking 'Injection_order' column in feature data
#> INFO [2025-06-23 22:36:30] Checking 'Sample_ID' column in pheno data
#> INFO [2025-06-23 22:36:30] Checking 'QC' column in feature data
#> INFO [2025-06-23 22:36:30] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:30] 
#> Checking feature information
#> INFO [2025-06-23 22:36:30] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:30] Checking that m/z and retention time values are reasonable.
#> INFO [2025-06-23 22:36:30] Identified m/z column Average_Mz and retention time column Average_Rt_min
#> INFO [2025-06-23 22:36:30] Identified m/z column Average_Mz and retention time column Average_Rt_min
#> INFO [2025-06-23 22:36:30] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:30] Checking that feature data includes a 'Flag' column

modes <- construct_metabosets(exprs = data$exprs, 
  pheno_data = data$pheno_data, feature_data = data$feature_data,
  group_col = "Group")
#> INFO [2025-06-23 22:36:30] 
#> Checking feature information
#> INFO [2025-06-23 22:36:30] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:30] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:30] Checking that feature data includes a 'Flag' column
#> INFO [2025-06-23 22:36:30] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:30] Setting row and column names of exprs based on feature and pheno data