Simple network/wiring diagram for visualizing 2 families of vertices in R

Viewed 25

My goal is to create a wiring diagram figure that visualizes gene names and their annotated cell compartments using the igraph package in R. I am not trying to demonstrate any quantitative feature (i.e., weight of association) just purely whether a gene is annotated to a cell compartment. My aim is to generate a ring of 13 cell compartment vertices surrounding the 33 gene vertices. There are only edges between the various gene vertices and cell compartment vertices (no gene-gene or compartment-compartment edges). Just for context I followed this tutorial to generate the wiring diagram that I want to modify in the way I mentioned above https://www.youtube.com/watch?v=gRkCgIejXCI&ab_channel=Pierre-AlexandreBalland.

I first read in 2 .csv files. The first is for the edges list (or connections between genes and cell compartments) where the first column contains the gene name and second column contains a cell compartment that the gene is annotated to. The second file is for the nodes list which is a single column containing all gene names followed by all cell compartment names. Below is an example of how the .csv files look first .csv file 1 then .csv file 2.

dput(head(EL))
structure(list(node1 = c("RPS19", "RPS19", "RPS19", "RPS19", 
"RPS19", "RPS19"), node2 = c("nucleus", "cytoplasm", "plasma membrane and extracellular elements", 
"exosome", "cytoskeleton", "ribosome")), row.names = c(NA, 6L
), class = "data.frame")'
dput(NL[c(30:36),])
c("HUWE1", "RTEL1", "RAC1", "MED12", "nucleus", "cytoplasm", 
"plasma membrane and extracellular elements")

This is the code I used:

EL<-read.csv("network_graph_edge_list.csv")
NL<-read.csv("network_graph_node_list.csv")
g<-graph_from_data_frame(d=EL, vertices = NL, directed = FALSE)

And this is the diagram that was generated. All the connections in the diagram are correct I just want to force the cell compartment vertices into a ring surrounding the gene vertices and change the colours of the 2 vertex families (i.e., genes blue and cell compartments red).

gene and cell compartment wiring diagram:

enter image description here

0 Answers
Related