singleModOverlay: Overlay selected module onto mapping.

Usage Arguments Examples

Usage

1
singleModOverlay(base, overlay, n, color)

Arguments

base
overlay
n
color

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
##---- 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 (base, overlay, n, color) 
{
    if (missing(color)) {
        color = n
    }
    cluster = overlay
    map = base
    map$genes = rownames(map)
    cluster$genes = rownames(cluster)
    maxClust = as.numeric(unique(cluster$colors))
    cluster$colors = factor(cluster$colors, levels = 1:length(maxClust))
    cluster.split = split(cluster, cluster$colors)
    cluster.split.sub = cluster.split[n]
    for (i in 1:length(color)) {
        cluster.split.sub[[i]]$colors = color[i]
    }
    cluster.sub = do.call(rbind, cluster.split.sub)
    cluster.color = map
    cluster.color$colors = "light grey"
    cluster.color.sub = cluster.sub
    p = ggplot(cluster.color, aes(x, y)) + theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(), panel.background = element_blank()) + 
        theme(legend.position = "none") + geom_point(data = cluster.color, 
        size = 2.5, color = cluster.color$colors) + geom_point(data = cluster.color.sub, 
        size = 5, pch = 21, fill = cluster.color.sub$colors) + 
        theme(axis.text.x = element_blank()) + theme(axis.text.y = element_blank()) + 
        theme(axis.ticks.x = element_blank()) + theme(axis.ticks.y = element_blank()) + 
        xlab("") + ylab("")
    print(p)
  }

sdrowland/RSMod documentation built on July 17, 2021, 7:16 p.m.