我想将蛋白质相互作用数据库聚类到子群集中 为此我在R中使用了Hierarchical Clustering但是我得到了一条我无法理解的警告信息,并且不会创建集群。我的代码和数据库如下:
数据库:
trpD trpB
serB sdaA
pabA trpA
pabB trpA
pabA pabB
serB glyA
serB trpB
trpC trpA
ilvA trpA
serB ilvA
trpB trpA
pabB trpB
trpE trpC
trpC trpB
trpE trpB
pabB trpC
sdaA trpB
pabA trpD
trpE trpD
pabA trpC
sdaA trpA
serB trpA
pabA trpE
ilvA glyA
pabB trpD
trpD trpC
ilvA trpB
glyA trpA
glyA trpB
pabA trpB
trpE trpA
glyA sdaA
trpD trpA
这里traA与trpB交互,serB与sdaA交互等等......现在我想集群它们。我的代码是:
rm(list=ls())
options(max.print = 10000000)
library(igraph) # load package igraph
library(combinat)
library(e1071)
library(maptree)
read_database <- read.table("C:/Users/Priyanka/Desktop/text_summary.txt", header=TRUE, comment.char = "")
read_database
data_frame <- data.frame (read_database$V1, read_database$V2)
data_frame
dim(data_frame)
d_euclidian <- dist(read_database, method = "euclidean")
d_euclidian
我收到了警告: 警告信息: 在dist(data_frame,method =&#34; euclidean&#34;):强制引入的NA
任何人都可以帮忙吗? 并且任何人都可以告诉我关于聚类PPI的其他技术。我可以在这里使用K表示聚类吗?如果是,如何???请帮忙..
...谢谢
答案 0 :(得分:1)
以下是使用igraph
中的聚类算法的示例:
df <- read.table(sep = ";", text = "trpD;trpB
serB;sdaA
pabA;trpA
pabB;trpA
pabA;pabB
serB;glyA
serB;trpB
trpC;trpA
ilvA;trpA
serB;ilvA
trpB;trpA
pabB;trpB
trpE;trpC
trpC;trpB
trpE;trpB
pabB;trpC
sdaA;trpB
pabA;trpD
trpE;trpD
pabA;trpC
sdaA;trpA
serB;trpA
pabA;trpE
ilvA;glyA
pabB;trpD
trpD;trpC
ilvA;trpB
glyA;trpA
glyA;trpB
pabA;trpB
trpE;trpA
glyA;sdaA
trpD;trpA")
library(igraph)
set.seed(1)
g <- graph.data.frame(df, directed = F)
groups <- membership(cluster_louvain(g))
communities <- communities(cluster_louvain(g))
plot.igraph(g, mark.groups = communities)