Skip to contents

This function can perform Type I error simulations or Accuracy and False Discovery Rate (ACC/FDR) simulations depending on the specified type. For T1E simulations, it only needs an adjacency matrix and heritability. For ACC/FDR simulations, it requires additional cis gene expression and cis-trans adjacency matrix.

Usage

simulate_trans_expression(
  A_trans,
  phi_gene,
  n = NULL,
  E_cis = NULL,
  A_cis_trans = NULL,
  type = "T1E"
)

Arguments

A_trans

Adjacency matrix among trans genes with dimensions g x g, required for both T1E and ACC/FDR.

phi_gene

Per-gene heritability, required for both T1E and ACC/FDR.

n

Sample size, required only for T1E simulations.

E_cis

Matrix of cis gene expressions with dimensions n x m, required only for ACC/FDR simulations.

A_cis_trans

Adjacency matrix between cis and trans genes with dimensions m x g, required for ACC/FDR simulations.

type

Type of simulation to perform, either 'T1E' or 'ACC'.

Value

A matrix E representing the simulated gene expression.

Examples

# For T1E simulation
g <- 9
n <- 1000
A_trans <- matrix(sample(0:1, g * g, replace = TRUE), nrow = g)
phi_gene <- 0.15
E <- simulate_trans_expression(A_trans, phi_gene, n = n, type = 'T1E')

# For ACC/FDR simulation
m <- 8
E_cis <- matrix(rnorm(n * m), n, m)
A_cis_trans <- matrix(sample(0:1, m * g, replace = TRUE), nrow = m)
E <- simulate_trans_expression(A_trans, phi_gene, E_cis = E_cis, A_cis_trans = A_cis_trans, type = 'ACC')
#> 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