|
From: | anupam sinha |
Subject: | Re: [igraph] Adjacency list to edgelist |
Date: | Tue, 9 Mar 2010 22:15:06 +0530 |
Dear Anupam,
you don't really need igraph for this:
lines <- readLines("adjlist.txt")
lines <- gsub("[ ]+$", "", gsub("[ ]+", " ", lines)) # remove
trailing and multiple spaces
adjlist <- strsplit(lines, " ")
col1 <- unlist(lapply(adjlist, function(x) rep(x[1], length(x)-1)))
col2 <- unlist(lapply(adjlist, "[", -1))
edgelist <- cbind(col1, col2)
Best,
Gabor
> _______________________________________________
On Tue, Mar 9, 2010 at 1:39 PM, anupam sinha <address@hidden> wrote:
> Dear all,
>
> I have a number of graphs in this format (adjacency list)
> :
>
> PABPC4 PABPC4 EEF1A1 SETDB1 XRN1 RIF1
> AHCY AHCY
> PSCDBP PSCDBP PSCD1
> ITSN2 ITSN2 WAS RAD9A LSM8 SYNJ2
> TICAM2 TICAM2 IL1R1 IRAK1 TRAF6 IRF3 TLR4 IL1RAP
> IRAK3 IRF7 TIRAP
> ADCY3 CAMK2G ADCY3
> ADCY6 ADCY6 CHRNA7 GNAS RAF1
> FHL3 FHL3 ACTB CDC25B MAPK1 LASP1 KLF8 CTBP2
> FHL2 ZNF42 SRF CDC42EP1 PHC2 PCQAP
> TM9SF2 TM9SF2 RAB9A
>
> where the alphanumeric id represents the node name (gene name). The first
> column contains the source node and the other columns have the destination
> nodes. How do I convert this into an edgelist format using R implementation
> of igraph ? Thanks in advance for any suggestions.
>
>
> Regards,
>
>
> Anupam
>
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
--
Gabor Csardi <address@hidden> UNIL DGM
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |