-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStabilityM.R
More file actions
45 lines (33 loc) · 1.23 KB
/
StabilityM.R
File metadata and controls
45 lines (33 loc) · 1.23 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## StabilityM.R ##
#' @export
#'
##############################################
## Author Information ##
# * Author: E.Frolli
# * Orginization: UniveristZ of Texas Marine Science Institute
# * Contact: frolli.erin@utexas.edu
# * Date: 12 May 2017
##############################################
## The Code ##
StabilityM <-function(qPCRData) {
##############################################################
# Warnings - make sure that they have all the corect values
##############################################################
n <- ncol(qPCRData)
if (n <= 1) {stop("At least two genes are needed for this method")}
##############################################################
# Main Function
##############################################################
# Create the pairwise variation
Mj <- rep(0,n) # blank vector for the final gene-staility Measure Mj
#
for (i in 1:n) {
Ajk <- log2(qPCRData[, i]/qPCRData[, -i]) # Equation 2 in sumplemental material for Vandesompele et al.
if (n > 2){
Mj[i] <- mean(apply(Ajk, 2, sd)) # Equation 2 & 3 in sumplemental material for Vandesompele et al.
}else{
Mj[i] <- sd(Ajk)
}
}
return(Mj)
}