Skip to contents

Apply cv.glmnet() for a list of module IDs and for each prevalence level

Usage

cvglm_to_coeffs_by_object(
  list_dfs,
  test_module = identify_module(),
  seed = NULL,
  ...
)

Arguments

list_dfs

List of dataframe. A normalized dataframe

test_module

List of string. The module IDs

seed

Numeric. The seed number, ensuring reproducibility

...

Additional arguments passed on to find_all_module_neighbors()

Value

Dataframe. Returns the module ID, its detected neighbor and the corresponding coefficient

Examples

data(data)
data(metadata)
# Simple example
normed_JPN <- norm_data(data$CRC_JPN, col_module_id = "msp_id", annotation_level = "species", prev_list = c(0.20, 0.25, 0.30))
neighbors_JPN <- cvglm_to_coeffs_by_object(list_dfs = normed_JPN, test_module = c("msp_0030", "msp_0345"), seed = 20242025)
# Example with covariate
normed_CHN <- norm_data(data$CRC_CHN, col_module_id = "msp_id", annotation_level = "species", prev_list = c(0.20, 0.25, 0.30))
neighbors_CHN <- cvglm_to_coeffs_by_object(list_dfs = normed_CHN, test_module = c("msp_0030", "msp_0345"), seed = 20242025, covar = ~study_accession, meta_df = metadata$CRC_CHN, sample_col = "secondary_sample_accession")