- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要从相关矩阵绘制网络。
我的数据的一小部分:
Taxon CD1 CD2
Actinomycetaceae;g__Actinomyces 0.072998825 0.031399459
Coriobacteriaceae;g__Atopobium 0.040946468 0.002703265
Corynebacteriaceae;g__Corynebacterium 0.002517201 0.006446247
Micrococcaceae;g__Rothia 0.001174694 0.002703265
Porphyromonadaceae;g__Porphyromonas 0.023326061 0.114368892
Prevotellaceae;g__Prevotella 0.252894781 0.102308172
Flavobacteriaceae;g__Capnocytophaga 0.001174694 0.029320025
Aerococcaceae;g__Abiotrophia 0.002013761 0.003327095
Carnobacteriaceae;g__Granulicatella 0.042960228 0.049490539
Gemellaceae;g__Gemella 0.027857023 0.067165731
Streptococcaceae;g__Streptococcus 0.220506796 0.182782283
ClostridialesFamilyXI.IncertaeSedis;g__ 0.000000000 0.000623830
ClostridialesFamilyXIII.IncertaeSedis;g__Mogibacterium 0.006880349 0.002495321
Lachnospiraceae;Other 0.000335627 0.000831774
Clostridia 0.004363148 0.002079434
Lachnospiraceae;g__Oribacterium 0.003524081 0.002079434
Peptostreptococcaceae;g__Peptostreptococcus 0.000167813 0.005198586
Veillonellaceae;Other 0.001342507 0.001455604
Veillonellaceae;g__Veillonella 0.047323376 0.082553545
Fusobacteriaceae;g__Fusobacterium 0.009229737 0.010813059
Fusobacteriaceae;g__Leptotrichia 0.092465179 0.076523186
Neisseriaceae;g__Neisseria 0.013592885 0.027656477
Pasteurellaceae;g__Haemophilus 0.014431952 0.092534831
SR1;c__;f__;g__ 0.000000000 0.002079434
TM7;c__TM7-3;f__;g__ 0.065782849 0.018299023
Erysipelotrichaceae;g__Bulleidia 0.007551603 0.004366812
Bacteroidia 0.000000000 0.000415887
Porphyromonadaceae;g__Tannerella 0.000671254 0.002079434
Flavobacteriaceae 0.002013761 0.001247661
Bacilli 0.002181574 0.002911208
Clostridia;f__;g__ 0.000671254 0.002703265
ClostridialesFamilyXIII.IncertaeSedis;g__Eubacterium 0.003020641 0.002079434
Lachnospiraceae;g__Moryella 0.003188454 0.000623830
Veillonellaceae;g__Selenomonas 0.004866588 0.021834061
Fusobacteriaceae 0.000335627 0.001871491
Campylobacteraceae;g__Campylobacter 0.001510321 0.001247661
Pasteurellaceae;g__Actinobacillus 0.002852828 0.000207943
Burkholderiaceae;g__Lautropia 0.000000000 0.002495321
Lactobacillaceae;g__Lactobacillus 0.000000000 0.000000000
Staphylococcaceae;g__Staphylococcus 0.000000000 0.000000000
library(vegan)
library(psych)
mydata <- read.csv(file="L5_filt.txt", header=T, row.names=1, sep="\t")
mydata_t <- t(as.matrix(mydata))
graph.f<-graph.adjacency(cor.matrix$r, weighted=TRUE, mode="upper")
t.names <- colnames(cor.matrix)[as.numeric(V(t.graph)$name)]
graph.f = simplify(graph.f)
E(graph.f)[weight < 0.6 & weight > -0.6]$width<-0
E(graph.f)[weight > 0.6]$width<-2.5
E(graph.f)[weight < -0.6]$width<-2.5
E(graph.f)[weight > 0.6]$color<-"red"
E(graph.f)[weight < -0.6]$color<-"green"
par(mai=c(1,1,0.1,0.15), mar=c(1, 0, 1, 1), mgp=c(2,1,0), mfrow=c(1,2), cex=0.7, lwd=0.5)
plot (graph.f, vertex.size=5, vertex.shape="circle", vertex.label.color="red",
vertex.label=t.names, vertex.label.cex=0.9, layout=layout.fruchterman.reingold)
最佳答案
如果我正确理解您的问题...
首先删除与您的条件匹配的所有边。
然后删除所有具有零邻居的顶点。
具有随机数据的可重现示例,我不想绘制小于 0.1 的相关性:
set.seed(999);mydata=matrix(runif(24),ncol=2)
rownames(mydata)=LETTERS[1:12]
g=graph.adjacency(cov(t(mydata)),weighted=TRUE)
plot(g)
g=delete.edges(g, which(E(g)$weight <=.1)) # here's my condition.
plot(g)
g=delete.vertices(g,which(degree(g)<1))
plot(g)
关于r - 从 igraph 中的网络中删除弱相关(顶点和边),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20803230/
我有一个 N x 2 的整数表,称为 games[ , ]。节点/边表转换为图形: net edges g ecount(g) 7 > degree(g, 103, mode="out") 4
我开始评估 igraph 库及其功能。 我需要计算 igraph_de_bruijn() 函数生成的图的哈密顿路径。 igraph 库中是否有任何现成的功能?我不想从头开始实现它。 C中的一个例子将是
我正在尝试像这样深度复制我的 igraph 对象: copy.deepcopy(graph) 其中 graph 是 igraph 对象,一个只有几个顶点的完整图。但是我得到这个错误: Fi
我有一个需要过滤的大图。过滤(子图)后,我最终得到一个子图列表。我需要再次将所有这些子图组合成一个图。我不知道如何组合大列表(近百万个子图) > require(igraph) > graph V(
我有一个简单的问题,函数 community.to.membership 在 igraph 1.0 中是否被弃用了?我可以找到 membership 函数,但它不包括选项 merges、steps 等
我正在使用 R 中的 igraph。我知道我们可以用选定的顶点创建一个子图,但如果这些节点没有直接连接,那么新子图中将不会有边。如果有其他节点(不是顶点列表的一部分)间接连接这两个节点,有没有办法制作
我正在使用 R 中的 igraph。我知道我们可以用选定的顶点创建一个子图,但如果这些节点没有直接连接,那么新子图中将不会有边。如果有其他节点(不是顶点列表的一部分)间接连接这两个节点,有没有办法制作
是否有与此 igraph 等效的 R function在 Python igraph 中? graph_from_data_frame(d, directed = TRUE, vertices = N
a=g.vs(Name_eq="A") b=g.vs(Name_eq="B") 我想在 a 和 b 之间添加一条边,我该怎么做? 最佳答案 好的,我们这里好像有两个问题。一个在问题标题中:“如果我们有
我有一个大型无向加权图,其中包含约 375,000 个节点和约 3,400,000 个边,表示为邻接表(字典的字典)。 例如 A --> (B,2), (C,4) B --> (A,2) C -->
igraph here 中对可用的社区检测算法进行了很好的比较。 .但是,在可以应用于加权边的算法中使用权重存在一些歧义。 通常,边缘权重将被定向,以便更高的权重表明将节点保持在一起(例如友谊的强度)
我在 igraph 中使用了 fastgreedy 算法在加权无向图中进行社区检测。后来我想看看模块化性,不同的方法我得到了不同的值,我想知道为什么。我提供了一个简短的示例,它演示了我的问题: lib
我正在使用 igraph g <- graph_from_adjacency_matrix(adj2, mode = "directed") plot.igraph(g, vertex.size =
我想知道如果 igraph-R 包中没有实现基于模块化聚类的算法,由 Newman 于 2004 年发布:“Fast algorithm for detection community structu
我有一个类似的问题:Reading adjacency lists with isolated nodes using igraph 我想绘制一些没有关系的节点。但是由于某种原因,上面线程中提到的解决
我有一个交互网络,我使用以下代码制作邻接矩阵,随后计算网络节点之间的相异性,然后将它们聚类以形成模块: ADJ1=abs(adjacent-mat)^6 dissADJ1% as.dist %
我想使用 igraph 来探索一些网络数据。我的数据具有以下结构: a <- c(13, 32, NA, NA) b <- c(32, NA, NA, NA) c <- c(34, 13, 32, N
我使用 igraph graph_from_data_frame 函数从数据框构建了一个图。我的前两列代表边缘列表,我还有另一列名为“权重”。还有其他几个属性列。 然后我尝试使用 cluster_fa
我的问题如下: 考虑一个具有 10000 个节点和 4800 条边的无向图。 给定这个图和这个图的一个节点(例如,节点 1),我需要 igraph (R) 中的一个命令来获取这个节点 1 和图中最远节
我已指导 igraph 并想获取所有周期。 girth 函数有效,但只返回最小的周期。 R 中有没有办法在长度大于 3 的图中获取所有循环(没有顶点指向自身和循环) 最佳答案 它不是 igraph 中
我是一名优秀的程序员,十分优秀!