私はRが初めてで、質問に固執しています。の頂点にヒートマップを印刷することはできiGraph
ますか? 色付きの四角や丸ができることを知っています。しかし、小さなヒートマップは可能でしょうか? これは、現在のグラフを描画するコードです。
# create graph
graph <- graph.data.frame(network[,1:2])
vertex_names <- get.vertex.attribute(graph,"name")
# define node attributes
V(graph)$label.font <- 1
V(graph)$label.font[which(element_types[vertex_names,"type"]=="PRIMARIES")] <- 2
V(graph)$label.font[which(element_types[vertex_names,"type"]=="REACTION")] <- 2
V(graph)$label <- element_types[vertex_names,"label"]
V(graph)$color <- element_types[vertex_names,"color"]
V(graph)$size <- as.integer(element_types[vertex_names,"size"]*20)
V(graph)$label.cex <- element_types[vertex_names,"weight"]
V(graph)$frame.color <- "gray"
V(graph)$frame.color[which(element_types[vertex_names,"type"]=="PRIMARIES")] <- "white"
V(graph)$frame.color[which(element_types[vertex_names,"type"]=="PATHWAY")] <- "white"
V(graph)$frame.color[which(element_types[vertex_names,"type"]=="PRODUCTS")] <- "white"
V(graph)$frame.width <- 10
V(graph)$shape <- "square"
V(graph)$shape[which(element_types[vertex_names,"type"]=="REACTION")] <- "circle"
V(graph)$label.color <- "black"
V(graph)$label.color[which(element_types[vertex_names,"type"]=="PRIMARIES")] <- "darkred"
V(graph)$label.color[which(element_types[vertex_names,"type"]=="PATHWAY")] <- "darkgreen"
V(graph)$label.color[which(element_types[vertex_names,"type"]=="REACTION")] <- "darkorange3"
E(graph)$color <- "red"
E(graph)$color[which(network[,3]=="out")] <- "blue"
E(graph)$color[which(network[,3]=="external")] <- "darkgreen"
E(graph)$arrow.size <- 0.5
layout <- layout.auto(graph)
plot.igraph(graph,layout=layout,main=pathways[pathway_id,"COMMON-NAME"])
さらに、ヒートマップに描画できるリストにマトリックスがあります。これらの行列は次のようになります。
[[1]]
TotalSNP HighSNP ModerateSNP PromotorSNP
[1,] 1 0 0 1
[2,] 3 0 2 1
[3,] 5 0 2 3
[4,] 1 0 0 1
[5,] 7 0 4 3
[6,] 3 0 3 0
[7,] 4 0 1 3
[8,] 3 0 2 1
[[2]]
TotalSNP HighSNP ModerateSNP PromotorSNP
[1,] 3 0 1 2
[2,] 0 0 0 0
[[3]]
TotalSNP HighSNP ModerateSNP PromotorSNP
[1,] 0 0 0 0
[2,] 0 0 0 0
これらの行列を頂点にヒートマップとして描画できるかどうかは誰にもわかりませんか?
サンプルデータ:
FinalList <- list(structure(c(1, 3, 5, 1, 7, 3, 4, 3, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, 2, 0, 4, 3, 1, 2, 1, 1, 3, 1, 3, 0, 3, 1), .Dim = c(8L,
4L), .Dimnames = list(NULL, c("TotalSNP", "HighSNP", "ModerateSNP",
"PromotorSNP"))), structure(c(3, 0, 0, 0, 1, 0, 2, 0), .Dim = c(2L,
4L), .Dimnames = list(NULL, c("TotalSNP", "HighSNP", "ModerateSNP",
"PromotorSNP"))), structure(c(0, 0, 0, 0, 0, 0, 0, 0), .Dim = c(2L,
4L), .Dimnames = list(NULL, c("TotalSNP", "HighSNP", "ModerateSNP",
"PromotorSNP"))))
行列のサイズはさまざまです。常に 4 列ですが、行数は 0 行から 10 行までさまざまです。