Crear un subgrafo usando igraph en R
Necesito obtener un subgrafo de los nodos semilla (la lista de entrada de nodos; file.txt) y sus primeros interactores (vecinos) de un gráfico (g) usando igraph. Desafortunadamente, estoy terminando con un solo nodo en el subgrafo, y no todo el resto de los nodos y bordes (vértices) que los entrelazan.
g<-read.graph("DATABASE.ncol",format="ncol",directed=FALSE) #load the data
g2<-simplify(g, remove.multiple=TRUE, remove.loops=TRUE) # Remove the self-loops in the data
DAT1 <- readLines("file.txt") #It provides a character vector right away
list_nodes_1 = neighbors(g2, DAT1) #list of nodes to be fetched in subnetwork
list_nodes_1 # 16
g3 <- induced.subgraph(graph=g2,vids=DAT1) #subnetwork construction
g3 # GRAPH UN-- 1 0 --; indicating only one node
plot (g3)
¿Alguna sugerencia para obtener toda la subred (incluidos nodos y vértices)? ¿O hay alguna otra función disponible para crear sub-gráficos?
BASE DE DATOS.ncol:
MAP2K4 FLNC
MYPN ACTN2
ACVR1 FNTA
GATA2 PML
RPA2 STAT3
ARF1 GGA3
ARF3 ARFIP2
ARF3 ARFIP1
XRN1 ALDOA
APP APPBP2
APLP1 DAB1
CITED2 TFAP2A
EP300 TFAP2A
APOB MTTP
ARRB2 RALGDS
CSF1R GRB2
PRRC2A GRB2
LSM1 NARS
SLC4A1 SLC4A1AP
BCL3 BARD1
Es un archivo de texto simple con un borde por línea. Una arista se define por dos nombres de vértices simbólicos delimitados por tabulación:
file.txt
ALDOA
APLP1
GRB2
RPA2
FLNC
BCL3
APP
RALGDS
PRRC2A
NARS
LSM1
GGA3
FNTA