Wrapper around dplyr functions to to prepared weights for simulation study, by considering aba expression levels as well as increase in protein expression due to the experimental manipulation. It returns a dataframe in long format with one brain area "my_grouping" per group ("group") with the expression levels ("mean_expression" and "sd_expression") as well as the median ratio of expression against the against_group ("weight") have been summarized.

prepare_sim_weights(region_df, classifications, aba_api_summary, against_group)

Arguments

region_df

region_based dataframe. Each row is a brain area ("my_grouping") per sample ("sample_id"), where corrected cell count ("cells_perthousand") has been summarized. It contains a variable "batch" that identifies the unit where to perform the calculation. If from a block design, "batch" identifies a unique set control and experimental groups (var "group"), with 1 sample each. It can be output from summarize_per_region() or preprocess_per_region().

classifications

dataframe with one brain area per row ("my_grouping") classified according to categorizations ("parents") found in Allen Brain Atlas expression levels of the mRNA of interest. For an example of how to create this dataframe see X.

aba_api_summary

dataframe where each row is a brain area "acronym" for which the average Allen Brain Atlas expression levels ("mean_expression") and deviation ("sd_expression") have been summarized. It can be the output of from_aba_api_to_df

against_group

group from "group" of region_df against which comparisons will be made

Value

Examples

# create dataframes x <- data.frame( batch = rep(c(1,1,2,2), each = 5), group = rep(c("control", "exp", "exp", "control"), each = 5), sample_id = rep(c("a", "b", "c", "d"), each = 5), my_grouping = rep(c("CA1", "CA2", "CA3", "DG", "BLA"), 4), intensity_ave = sample(10000, 20, replace = TRUE), cells_perthousand = abs(rnorm(20)) ) y <- data.frame( my_grouping = c("CA1", "CA2", "CA3", "DG", "BLA"), parents = c(rep("hippocampus",4), "cortical subplate") ) z <- data.frame( acronym = c("hippocampus", "cortical subplate"), mean_expression = rnorm(2, 10, 1), sd_expression = abs(rnorm(2)) ) # run prepare_sim_weights(x,y,z, "control")
#> Error in classifications %>% dplyr::left_join(aba_api_summary %>% dplyr::rename(parents = acronym), by = "parents") %>% dplyr::mutate(mean_expression = ifelse(is.na(mean_expression), mean(mean_expression, na.rm = TRUE), mean_expression), sd_expression = ifelse(is.na(sd_expression), 0, sd_expression)): could not find function "%>%"