# cofVar: Calculating the coefficient of variation for expression... In juancholkovich/coexnet: coexnet: An R package to build CO-EXpression NETworks from Microarray Data

## Description

This function calculates the mean and the coefficient of variation to each row (genes or probesets) in an expression matrix in two ways: i) in the whole matrix ii) for the specific phenotype (case or control).

## Usage

 `1` ```cofVar(expData, complete = TRUE, treatment = NULL, type = NULL) ```

## Arguments

 `expData` The whole normalized expression matrix, rows: genes or probeset, columns: samples, it may be stored in a SummarizedExperiment object. `complete` Boolean to define if the function uses the whole expression matrix, by default TRUE. `treatment` A numeric vector with 0s and 1s for each sample in the expression matrix, the 0 expresses the control samples and 1 expresses the case samples, by default is NULL. `type` It can be "case" to calculate the mean and the coefficient of variation for the case samples or, otherwise, "control" to obtain these two values for the control samples.

## Value

The expression matrix with two new columns, the first one with the averages and the other one with the coefficient of variation values.

## Author(s)

Juan David Henao <judhenaosa@unal.edu.co>

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27``` ```## Creating the expression matrix # The matrix have 200 genes and 20 samples n <- 200 m <- 20 # The vector with treatment and control samples treat <- c(rep(0,10),rep(1,10)) # Calculating the expression values normalized mat <- as.matrix(rexp(n, rate = 1)) norm <- t(apply(mat, 1, function(nm) rnorm(m, mean=nm, sd=1))) ## Calculating the mean and the coefficient of variation # For the whole expression matrix complete <- cofVar(norm) head(complete) # For the case samples case <- cofVar(expData = norm,complete = FALSE,treatment = treat,type = "case") head(case) ```

juancholkovich/coexnet documentation built on May 20, 2019, 3:18 a.m.