prepare_sim_weights: Prepare weights for simulation

Description Usage Arguments Examples

View source: R/find_most_active.R

Description

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.

Usage

1
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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  # 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")

valeriabonapersona/abc4d documentation built on Dec. 23, 2021, 2:09 p.m.