Nothing
"PlotGroups" <-
function (data, edesign = NULL, time = edesign[, 1], groups = edesign[,
c(3:ncol(edesign))], repvect = edesign[, 2], show.fit = FALSE,
dis = NULL, step.method = "backward", min.obs = 2, alfa = 0.05, nvar.correction = FALSE,
summary.mode = "median", show.lines = TRUE, groups.vector = NULL,
xlab = "Time", ylab = "Expression value", cex.xaxis = 1, ylim = NULL, main = NULL, cexlab = 0.8,
legend = TRUE, sub = NULL, item = NULL )
{
if (!is.vector(data)) {
if (summary.mode == "representative") {
distances <- apply(as.matrix(dist(data, diag = TRUE,
upper = TRUE)), 1, sum)
representative <- names(distances)[distances == min(distances)]
yy <- as.numeric(data[rownames(data) == representative,
])
sub <- paste("Representative:", representative)
}
else if (summary.mode == "median") {
yy <- apply(as.matrix(data), 2, median, na.rm = TRUE)
if(is.null(sub)){
sub <- paste("Median profile of", nrow(data), item, sep=" ")}
}
else stop("not valid summary.mode")
if (dim(data)[1] == 1) {
sub <- rownames(data)
}
}
else if (length(data) != 0) {
yy <- as.numeric(data)
sub <- rownames(data)
}
else stop("empty data")
if (is.null(ncol(groups))) {
ncol = 1
legend = FALSE
codeg = "group"
}
else {
ncol = ncol(groups)
codeg <- as.character(colnames(groups))
}
reps <- i.rank(repvect)
y <- vector(mode = "numeric", length = length(unique(reps)))
x <- vector(mode = "numeric", length = length(unique(reps)))
g <- matrix(nrow = length(unique(reps)), ncol = ncol)
for (k in 1:length(y)) {
y[k] <- mean(yy[reps == k], na.rm = TRUE)
x[k] <- mean(time[reps == k])
for (j in 1:ncol) {
g[k, j] <- mean(groups[reps == k, j])
}
}
if (is.null(ylim))
ylim = c(min(as.numeric(yy), na.rm = TRUE), max(as.numeric(yy),
na.rm = TRUE))
abcissa <- x
xlim = c(min(abcissa, na.rm = TRUE), max(abcissa, na.rm = TRUE) *
1.3)
color1 <- as.numeric(sort(factor(colnames(groups)))) + 1
color2 <- groups
for (j in 1:ncol) {
color2[, j] <- color2[, j] * j
}
color2 <- as.vector(apply(color2, 1, sum) + 1)
plot(x = time, y = yy, pch = 21, xlab = xlab, ylab = ylab,
xaxt = "n", main = main, sub = sub, ylim = ylim, xlim = xlim,
cex = cexlab, col = color2)
axis(1, at = unique(abcissa), labels = unique(abcissa), cex.axis = cex.xaxis)
if (show.fit) {
rm <- matrix(yy, nrow = 1, ncol = length(yy))
rownames(rm) <- c("ratio medio")
colnames(rm) <- rownames(dis)
fit.y <- T.fit(rm, design = dis, step.method = step.method,
min.obs = min.obs, alfa = alfa, nvar.correction = nvar.correction)
betas <- fit.y$coefficients
}
for (i in 1:ncol(groups)) {
group <- g[, i]
if ((show.fit) && !is.null(betas)) {
li <- c(2:6)
a <- reg.coeffs(coefficients = betas, groups.vector =groups.vector,
group = colnames(groups)[i])
a <- c(a, rep(0, (7 - length(a))))
curve(a[1] + a[2] * x + a[3] * (x^2) + a[4] * (x^3) +
a[5] * (x^4) + a[6] * (x^5) + a[7] * (x^5), from = min(time), to = max(time),
col = color1[i], add = TRUE, lty = li[i])
}
if (show.lines) {
lx <- abcissa[group != 0]
ly <- y[group != 0]
ord <- order(lx)
lxo <- lx[ord]
lyo <- ly[ord]
lines(lxo, lyo, col = color1[i])
}
}
op <- par(bg = "white")
if (legend)
legend(max(abcissa, na.rm = TRUE) * 1.02, ylim[1], legend = codeg,
text.col = color1, col = color1, cex = cexlab, lty = 1,
yjust = 0)
par(op)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.