plot.haplovalidate | R Documentation |
under construction
plot.haplovalidate(blocks, cmh, label = TRUE)
blocks |
|
cmh |
|
label |
##---- 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 (blocks, cmh, label = TRUE) { neuefarbe.raw <- unique(c(brewer.pal(8, "Set1"), brewer.pal(7, "Dark2"), brewer.pal(7, "Set2"), brewer.pal(12, "Set3"), brewer.pal(12, "Paired"), brewer.pal(7, "Accent"), brewer.pal(7, "Spectral"))) neuefarbe <- colorRampPalette(neuefarbe.raw)(max(as.numeric(factor(blocks$tag)), na.rm = TRUE)) col.sub <- neuefarbe[as.numeric(factor(blocks$tag))] blocks[, `:=`(groupcol, col.sub)] for (j in unique(blocks$chr)) { cluster.sub <- blocks[chr == j, ] png(paste(j, "_haplovalidate.png", sep = ""), 2400, 1200) maxy <- round(max(as.numeric(cmh[chr == j, score]), na.rm = TRUE), -1) + round(max(as.numeric(cmh[chr == j, score]), na.rm = TRUE), -1) * 0.05 cmh[chr == j, plot(pos/1e+06, as.numeric(score), pch = 19, col = "#414547", ylim = c(0, maxy), xlab = "position Mb", ylab = "cmh score", lwd = 3, cex.axis = 1.5, cex.lab = 2, main = paste("sim ", no, " merge chr", j, sep = ""), xaxp = c(0, 50, 50))] cluster.sub[, points(as.numeric(pos)/1e+06, as.numeric(score), cex = 2, lwd = 3, pch = 19, col = groupcol)] count <- 0 cluster.sub.ord <- cluster.sub[order(score, decreasing = TRUE), ] for (k in na.exclude(unique(cluster.sub.ord$groupcol))) { group.sub <- cluster.sub.ord[groupcol == k, ] distance <- group.sub$pos/1e+06 levi <- maxy - count points(distance, rep(levi, length(distance)), col = k, pch = 19, cex = 3) if (label) text(distance[1], levi, unique(group.sub[, tag]), cex = 2) count <- count + round(max(as.numeric(cmh[chr == j, score]), na.rm = TRUE), -1) * 0.01 } dev.off() } }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.