Question: taking intersection between two networks
gravatar for F
3.0 years ago by
F3.4k wrote:


I have two networks, i took intersection between them but i cant getting edge list from data.frame

who know the reason of the error please?


clr <- read.table("clr.txt", header = T, sep = "\t")


AT1G01060 AT1G01170 AT1G01260 AT1G01380

AT1G01060 0.0000000 0.6397474 0.0000000 2.6052533

AT1G01170 0.6397474 0.0000000 0.2676777 0.0000000

AT1G01260 0.0000000 0.2676777 0.0000000 0.5220432

AT1G01380 2.6052533 0.0000000 0.5220432 0.0000000

AT1G01490 2.5364855 2.5912206 1.6262291 0.6899495

AT1G01500 0.6131010 0.0000000 0.0000000 1.7374863


[1] 2857 2857

clr <- as.matrix(clr)

GENEI3 <- read.table("GENEI3.txt", header = T, sep = "\t")


AT1G01060 AT1G01170 AT1G01260 AT1G01380

AT1G01060 0.000000e+00 3.397888e-04 5.573000e-04 8.577027e-05

AT1G01170 2.161158e-03 0.000000e+00 3.510125e-04 3.373863e-06

AT1G01260 4.630123e-07 1.294916e-05 0.000000e+00 9.821657e-05

AT1G01380 2.172965e-05 1.112968e-04 2.950147e-04 0.000000e+00

AT1G01490 1.987599e-03 7.534076e-06 1.634816e-06 3.346604e-05

AT1G01500 8.453009e-05 4.127081e-05 1.531739e-05 7.116557e-05


[1] 2857 2857

adj_1<- as.matrix(clr)

adj_2 <- as.matrix(GENIE3)

g_1 <- graph.adjacency(adj_1, mode="undirected", weighted=NULL, diag=TRUE)

g_2 <- graph.adjacency(adj_2, mode="undirected", weighted=NULL, diag=TRUE)

g_sim <- graph.intersection(g_1, g_2, byname = "auto", keep.all.vertices = FALSE)

adj_sim <- get.adjacency(g_sim, type="both")

g<- graph.adjacency(adj_sim,mode = "undirected",weighted = T)

edge_ara <-,what = "edges")

edge_ara<- edge_ara[order(abs(edge_ara$weight),decreasing = T),]

Error in abs(edge_ara$weight) : non-numeric argument to mathematical function

thank you

R software error • 946 views
ADD COMMENTlink written 3.0 years ago by F3.4k

HI, I would suggest you to print out the edge_ara$weight to text file and check whether you find any suspicious non-numeric argument. if there is any, just remove them and run the script.

ADD REPLYlink written 3.0 years ago by EVR530

thank you I inspect edge_ara <-,what = "edges") but file was empty then edge_ara<- edge_ara[order(abs(edge_ara$weight),decreasing = T),] gives me error but i don't know why file was empty

ADD REPLYlink written 3.0 years ago by F3.4k

Just go step by step and check whether the data is there in a variable before you go for subsequent analysis

ADD REPLYlink written 3.0 years ago by EVR530

You need to check values of g_1, g_2 and g_sim and first see what is the overlap !

ADD REPLYlink written 3.0 years ago by raunakms1.1k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 678 users visited in the last hour