densityplot: Function to make density plots

Usage Arguments Examples

View source: R/densityplot.R

Usage

1
densityplot(ds, strt = NULL, nd = NULL, lab, parameters)

Arguments

ds
strt
nd
lab
parameters

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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (ds, strt = NULL, nd = NULL, lab, parameters) 
{
    if (is.null(strt) & is.null(nd)) {
        strt <- 1
        nd <- length(ds)
    }
    else if (is.null(strt)) {
        strt <- 1
    }
    else if (is.null(nd)) {
        nd <- length(ds)
    }
    yvalues <- vector()
    for (o in strt:nd) {
        fitxer <- getFile(ds, idx = o)
        dl <- log(aroma.affymetrix::getData(fitxer, fields = "intensities", 
            indices = 1:nbrOfCells(fitxer))$intensities, base = 2)
        ycoor <- ceiling(max(density(dl)$y))
        yvalues <- c(yvalues, ycoor)
    }
    colors <- rainbow(nd - strt + 1)
    fitxer <- getFile(ds, idx = strt)
    dl <- log(aroma.affymetrix::getData(fitxer, fields = "intensities", 
        indices = 1:nbrOfCells(fitxer))$intensities, base = 2)
    plot(density(dl), col = colors[1], main = paste("Samples", 
        strt, "to", nd), xlab = "log2(y)", ylim = c(0, max(yvalues)), 
        lty = strt, ylab = "")
    for (e in (strt + 1):nd) {
        fitxer <- getFile(ds, idx = e)
        dl <- log(aroma.affymetrix::getData(fitxer, fields = "intensities", 
            indices = 1:nbrOfCells(fitxer))$intensities, base = 2)
        lines(density(dl), col = colors[(e - strt) + 1], lty = e)
    }
    if (length(lab) < 15) {
        legend("topright", legend = lab, cex = 0.6, col = colors[1:nd], 
            lty = strt:nd, lwd = 1.6)
    }
    else {
        legend("topright", legend = lab, cex = parameters$ce, 
            col = colors[1:nd], lty = strt:nd, lwd = 1.6)
    }
  }

machalen/QualityGraphs documentation built on Oct. 22, 2019, 8:29 p.m.