Entering edit mode
4.7 years ago
Pluto
▴
10
Hey, I used I Graph to creat a bipartite graph but I have an error
Error in UseMethod("$") : no applicable method for '$' applied to an object of class "igraph.vs"
the following is simple example to my code Suggestions ? Thnx
library(igraph)
# My matrix containing PPI
m = matrix(data = sample(0:1, 16, replace = TRUE), nrow = 4, ncol = 4)
colnames(m) = c("LRRK2","LRRK2", "BAG5", "BAG5")
rownames(m) = c("BAG5", "HSPA8", "HSPA8", "GAK")
# Convert it to a bipartitie network
bg = igraph::graph.incidence(m)
# See the vertex attributes
V(bg)$type
V(bg)$name
# Plot the network
shape = ifelse(V(bg)$type, "circle", "square") # assign shape by node type
col = ifelse(V(bg)$type, "red", "yellow") # assign color by node type
plot(bg, vertex.shape = shape, vertex.color = col)
I do not understand the Error
I cannot reproduce it. I suggest you update igraph to the most recent version, restart the entire R session and try to rerun everything. Maybe something strange straying in your environment, I do not know.
Neither any error, here:
Please restart your R session for each new analysis. If that still does not work, then paste (here) the output of
sessionInfo()
I tried all of that without output then tried R cloud and it was Ok Anyway thanks a lot