longitudinalMetabolomics_df
A simulated data set of longitudinal concentration tables of metabolites. In contrast to "longitudinalMetabolomics" this dataset is in data frame format. It was simulated with a different seed compared to longitudinalMetabolomics so the results can deviate.
Bundled with MetaboDynamics · exported, loads via data()
Class
tibble
grouped_df/tbl_df/tbl/data.frame
Dimensions
2,352 × 8
Missing
24
Format
rda · bzip2
version 3 · 63 KB
File
data/longitudinalMetabolomics_df.rda
Fingerprint
b3bc0eab
Format documented
Yes
Source
**Script used to create simulated data** # load KEGG database for assignment of metabolite names: data("metabolite_modules") # metabolite_db <- metabolite_modules # Group <- middle_hierarchy library(dplyr) library(SummarizedExperiment) # Parameters (as before) n_features <- 98 n_groups <- 8 # Number of groups (randomly choose between 6-8) n_time_points <- 4 # Number of time points n_replicates <- 3 # Number of replicates for all features and time points n_conditions <- 2 # Number of experimental conditions x_varying_groups <- 4 # Number of groups with varying dynamics across conditions condition_names <- c("A","B") # Probability matrix for assigning metabolites from different database groups to dynamic groups # For simplicity, we assume equal probability; customize as needed group_probabilities <- matrix(c(0.8,rep(0.01,7), #amino acid metabolism rep(0.01,7),0.8, #nucleotide metabolism 0.1,0.8,0.8,rep(0.1,5), # energy and carbohydrate metabolism runif(5 * length(unique(metabolite_modules$middle_hierarchy)))), nrow = n_groups, ncol = length(unique(metabolite_modules$middle_hierarchy))) # Generate group dynamics (base trends over time) for each condition group_dynamics <- list() # Define the base group dynamics for condition 1 group_dynamics[[1]] <- lapply(1:n_groups, function(g) trend <- rnorm(n_time_points, mean = g * 2, sd = 0.5) return(trend) ) # Define varying dynamics for selected groups across other conditions varying_groups <- sample(1:n_groups, x_varying_groups, replace = FALSE) for (cond in 2:n_conditions) group_dynamics[[cond]] <- group_dynamics[[1]] for (g in varying_groups) group_dynamics[[cond]][[g]] <- rnorm(n_time_points, mean = g * 2, sd = 1) # Assign each feature to a group feature_to_group <- sample(1:n_groups, n_features, replace = TRUE) # Initialize a list to store the simulated data simulated_data <- list() # Assign metabolite names to features available_metabolites <- metabolite_modules # Copy of metabolite database to keep track of unused names # Simulate data for each feature across all conditions for (feature in 1:n_features) # Get the group for this feature group <- feature_to_group[feature] # Determine probability of each metabolite database group for this dynamic group group_probs <- group_probabilities[group, ] # Subset the metabolite database for selection based on group probabilities metabolite_candidates <- available_metabolites group_by(middle_hierarchy) mutate(Probability = group_probs[match(middle_hierarchy, unique(metabolite_modules$middle_hierarchy))]) ungroup() filter(metabolite # Randomly sample a metabolite based on these probabilities metabolite_name <- sample(metabolite_candidates$metabolite, 1, prob = metabolite_candidates$Probability) # Remove this metabolite from available pool available_metabolites <- available_metabolites[available_metabolites$metabolite != metabolite_name, ] # Generate a random base mean for this feature between 0.001 and 1000 base_mean <- runif(1, min = 0.001, max = 1000) # Generate feature-specific variances for each time point feature_variances <- runif(n_time_points, min = 0.1, max = 2) # Store data for each condition for (cond in 1:n_conditions) trend <- group_dynamics[[cond]][[group]] feature_means <- base_mean * trend / max(abs(trend)) feature_data <- data.frame( metabolite = metabolite_name, # Assign metabolite name here condition = paste0(condition_names[[cond]]), time = rep(1:n_time_points, each = n_replicates), replicate = rep(1:n_replicates, times = n_time_points) ) # Generate the actual data points with strictly positive concentrations feature_data$measurement <- unlist(lapply(1:n_time_points, function(t) rlnorm(n_replicates, meanlog = log(feature_means[t]), sdlog = feature_variances[t]) )) simulated_data[[length(simulated_data) + 1]] <- feature_data rm(base_mean,cond,feature,feature_means,feature_to_group,feature_variances, g,group,group_probs,metabolite_name,n_conditions,n_features,n_groups,n_replicates, n_time_points,trend,varying_groups,x_varying_groups,available_metabolites,feature_data,group_dynamics, group_probabilities,metabolite_candidat
About this object
A tibble with a grouping so later operations run per group. R object catalogue
Declared attributes
Grouped by
metabolite, condition 196 groups
Other attributes
Read by name, kind and length, with the value where it is short enough to show. No rule here knows what any of them means.
| Attribute | Holds | Length | |
|---|---|---|---|
| groups | tbl_df/tbl/data.frame | 3 |
Columns
Column
Type
Distinct
Missing
Summary
integer401 – 4mean 2.5
Min.
1
1st Qu.
1.75
Median
2.5
Mean
2.5
3rd Qu.
3.25
Max.
4
Std. dev
1.1183
Skewness
2.655e-16
Kurtosis
-1.361
integer301 – 3mean 2
Min.
1
1st Qu.
1
Median
2
Mean
2
3rd Qu.
3
Max.
3
Std. dev
0.8167
Skewness
1.309e-15
Kurtosis
-1.501
numeric2,35202.2243 – 2.07615e+7mean 1.32e+5
Min.
2.2243
1st Qu.
13623.2
Median
42718
Mean
132029
3rd Qu.
93718.1
Max.
2.07615e+7
Std. dev
689452
Skewness
20.36
Kurtosis
505.2
Outliers
2320 low · 232 high
numeric2,35200.3472 – 7.3173mean 4.515
Min.
0.3472
1st Qu.
4.1343
Median
4.6306
Mean
4.5152
3rd Qu.
4.9718
Max.
7.3173
Std. dev
0.7546
Skewness
-0.7366
Kurtosis
1.838
Outliers
10687 low · 19 high
numeric2,3520-2.809 – 2.8731mean -3.493e-18
Min.
-2.809
1st Qu.
-0.5755
Median
-0.0133
Mean
-3.4931e-18
3rd Qu.
0.5702
Max.
2.8731
Std. dev
0.9576
Skewness
0.0112
Kurtosis
0.2612
Outliers
5228 low · 24 high
Version history
| Version | Released | Size | Change | Stored as | Confidence |
|---|---|---|---|---|---|
| 3.23 | 2026-09-07 | 2,352 × 8 | Unchanged | rda · bzip2 version 3 · 63 KB | exact |
| 3.22 | 2025-12-11 | 2,352 × 8 | – | rda · bzip2 version 3 · 63 KB | exact |