我有一个稀疏的200x200矩阵,只有8个边(非零权重)。图表" rng"有以下信息:
> rng
IGRAPH UNW- 200 8 --
+ attr: name (v/c), weight (e/n)
+ edges (vertex names):
[1] CDH1 --DLC1 CDH1 --KRTAP2.3 DLC1 --KRTAP2.3 DLC1 --NRG1
[5] DLC1 --PODXL DUSP5 --KRTAP2.3 ITGA6 --KRTAP2.3 KRTAP2.3--PODXL
您可以看到如上所示的8条边。但是,当绘图(rng)时,所有200个顶点都显示在图上。不知道为什么。 R脚本如下:
library("igraph");
pc<-read.table("my.network.txt", header = T, sep=" ", row.names="GENE_ID");
rng <- graph_from_adjacency_matrix(as.matrix(pc), weighted = TRUE, mode = "undirected");
plot(rng);
文件&#34; my.network.txt&#34;如下:
GENE_ID ADAM10 ADAMTS12 ADRB2 ALDH1A3 ALDH1B1 ALDH3B1 ALPP ANKRD29 ANO2 ANXA8L2 ARHGDIB ARHGEF2 ARL4C ARRDC3 ASNS ATF3 ATP7B B4GALT5 BAMBI BCAN BCL11A C1orf21 CAPN6 CASP3 CAV1 CAV2 CCDC64 CCND1 CCNJL CDH1 CDK14 CDK18 CDKN2B CLIC4 CLPTM1L CLSTN2 COL4A4 COL5A1 COL5A3 COL7A1 CPE CTGF CTSL2 CXCR7 CYBRD1 DAPK1 DCLK1 DHRS3 DIO2 DKK1 DLC1 DNAH5 DNM3 DOCK10 DOCK4 DSC2 DSC3 DUSP5 DUSP6 DUSP7 DUSP8 EFR3B EHD2 EPAS1 ERAP2 ETV4 ETV5 F3 FAM84A FAM84B FBN1 FBXL2 FHL1 FRMD3 FSTL1 FTSJ1 FYN FZD4 GLRB GPR3 GPRC5A GPRC5B GREB1L HBEGF HMGA1 HPS5 HSF2BP HTR7 IFI6 IGFBP7 IGFBPL1 IL32IRF9 ITGA6 JAK1 KCNB1 KCNIP1 KIAA1462 KIAA1549L KRT17 KRTAP2-3 LBH LDLR LOC100287314 LOC100506895 LOC400680 LOC440028 LOC645638 LOC728752 LOXL4 MAMDC2 MFAP5 MME MMP19 MX1 MYL9 MYLK NDRG1 NMT2 NNMT NRG1 NT5E NTN4 OLFM1 OLFM2 OLFML2A OXTR PAPL PCDH20 PDLIM1 PER2PIK3R3 PLA2R1 PLAC8 PLAU PLCB4 PLD1 PLEKHG4B PLEKHH2 PLSCR4 PLXNA2 PLXNC1 PNPLA3 PODXL PRICKLE1 PRKCH PROS1 PRPS1 PRR16 PRSS23 PSAT1 PSG1 PSG4PSG7 PTGES RAB11FIP1 RASA3 RBM24 S100A2 SCARA3 SDC4 SDHAP3 SEMA5A SHISA2 SIPA1L2 SLC7A2 SNCAIP SORL1 SOX9 STX11 STX3 SYN2 SYPL2 TAGLN TGFB2 TGM2THBD THBS1 TIAM2 TM4SF1 TMEM178B TMEM2 TMSB4X TNNC1 TNNT2 TNS3 TP53I11 TP53INP1 TTC9 TUBA1A UGCG UPP1 WDFY2 ZFP82 ZNF114 ZNF185 ZNF430 ZNF431 ZNF562 ZNF566
ADAM10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
ADAMTS12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
.
.
.
这很奇怪。
答案 0 :(得分:4)
图中没有边的顶点仍然是图中的顶点...您可能想要删除度数小于1的所有顶点:
> g2 = delete.vertices(g,degree(g)<1)
> plot(g2)