cobra: Run COBRA in R

View source: R/COBRA.R

cobraR Documentation

Run COBRA in R

Description

Description: COBRA decomposes a (partial) gene co-expression matrix as a linear combination of covariate-specific components. It can be applied for batch correction, differential co-expression analysis controlling for variables, and to understand the impact of variables of interest to the observed co-expression.

Usage

cobra(X, expressionData, method = "pearson")

Arguments

X

: design matrix of size (n, q), n = number of samples, q = number of covariates

expressionData

: gene expression as a matrix of size (g, n), g = number of genes

method

: if pearson, the decomposition of the co-expression matrix is compouted. If pcorsh, COBRA decomposes the regularized partial co-expression

Outputs:

Details

Inputs:

Value

psi : impact of each covariate on the eigenvalues as a matrix of size (q, n)

Q : eigenvectors corresponding to non-zero eigenvalues as a matrix of size (g, n)

D : non-zero eigenvalues as a list of length n

G : (standardized) gene expression as a matrix of size (g, n)

Examples


g <- 100 # number of genes
n <- 10 # number of samples
q <- 2 # number of covariates
X <- X <- cbind(rep(1, n), rbinom(n, 1, 0.5))
expressionData=matrix(rnorm(g*n, 1, 1), ncol = n, nrow = g)

# Run COBRA algorithm
cobra_output <- cobra(X, expressionData)


netZoo/netZooR documentation built on Oct. 16, 2024, 10:23 p.m.