Skip to contents

This function simulates trans gene expression considering different cell types, each with its own gene-gene regulatory network.

Usage

simulate_trans_mixture_celltype(
  E_cis,
  phi_gene,
  A_cell_1,
  A_cell_2 = NULL,
  omega = NULL,
  p = c(1/3, 2/3)
)

Arguments

E_cis

Matrix of cis gene expressions with dimensions n x m.

phi_gene

Per-gene heritability.

A_cell_1

List containing adjacency matrices for cell-type 1 (A_cis_trans and A_trans).

A_cell_2

Optionally, a similar list for cell-type 2.

omega

Optionally, a weight for combining cell types. If NULL, drawn from U(0.2, 0.8).

Value

A list containing matrices E_trans, E_trans_cell_1, and E_trans_cell_2.

Examples

n <- 1000
m <- 8
g <- 9
phi_gene <- 0.20
E_cis <- matrix(rnorm(n * m), n, m)
A_cell_1 <- list(A_cis_trans = matrix(sample(0:1, m * g, replace = TRUE), nrow = m),
                A_trans = matrix(sample(0:1, g * g, replace = TRUE), nrow = g))
result <- simulate_trans_mixture_celltype(E_cis, phi_gene, A_cell_1)
#> Error in while (sigma2_gene <= 0) {    phi_gene <- phi_gene - 0.01    sigma2_gene <- var(E_comb[, affecting_genes[1]] * beta[affecting_genes[1]])/phi_gene -         variance_sum}: missing value where TRUE/FALSE needed