col.pvalues: Color-coding based on significance

Description Usage Arguments Details Author(s) References Examples

Description

This function is implemented in the unique function for univariate statistical analysis 'univariate'. This function generates a vector of characters specifying a color-code based on the significance (p-values < 0.05) of each variable.

Usage

1

Arguments

file

a connection or a character string giving the name of the file containing the variables (matrix columns) to test.

Details

For details see the function 'univariate'.

Author(s)

Edoardo Gaude, Dimitrios Spiliotopoulos, Francesca Chignola, Silvia Mari, Andrea Spitaleri and Michela Ghitti

References

Goodpaster, AM, et al. Statistical Significance analysis of nuclear magnetic resonance-based metabonomics data. (2010) Anal Biochem. 401:134-143.

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
## The function is currently defined as
function (file) 
{
    pwdfile = paste(getwd(), "/Univariate/DataTable.csv", sep = "")
    file = pwdfile
    x <- read.csv(file, sep = ",", header = TRUE)
    x.x = x[, 3:ncol(x)]
    rownames(x.x) = x[, 2]
    k = matrix(x[, 1], ncol = 1)
    x.n = cbind(k, x.x)
    sorted = x.n[order(x.n[, 1]), ]
    g = c()
    for (i in 1:nrow(sorted)) {
        if (any(g == sorted[i, 1])) {
            g = g
        }
        else {
            g = matrix(c(g, sorted[i, 1]), ncol = 1)
        }
    }
    NoF = nrow(g)
    all.pvalues = matrix(rep(1, ncol(sorted) - 1), ncol = 1)
    dirout.col = paste(getwd(), "/Univariate/Pvalues/", sep = "")
    fin = ncol(sorted) - 1
    for (i in 1:NoF) {
        for (j in 1:NoF) {
            if (i < j) {
                ni = paste("Pvalues_", i, "vs", j, ".csv", sep = "")
                pwdi = paste(getwd(), "/Univariate/Pvalues/", 
                  ni, sep = "")
                I = read.csv(pwdi, header = TRUE)
                I = matrix(I[, -1])
                for (q in 1:fin) {
                  if (I[q, ] < 0.05 & all.pvalues[q, ] == 1) {
                    all.pvalues[q, ] = I[q, ]
                  }
                  else {
                    all.pvalues[q, ] = all.pvalues[q, ]
                  }
                }
            }
        }
    }
    colp = matrix(rep(NA, ncol(sorted) - 1), ncol = 1)
    for (i in 1:fin) {
        if (all.pvalues[i, ] < 1) {
            colp[i, ] = "red"
        }
        else {
            colp[i, ] = "black"
        }
        colnam = "Colors_Pvalues"
        assign(colnam, colp)
        write.csv(colp, paste(dirout.col, colnam, sep = ""))
    }
  }

muma documentation built on May 2, 2019, 9:45 a.m.