We can't reproduce your code because we don't have your data. You also
don't show any error messages you receive, or how the output/result is
different than what you expect to see.

On Wed, Feb 4, 2015 at 5:30 PM, Benika H <[email protected]> wrote:

> Hi Tamas, Could you help me with my question.
>
> I have an edgelist (1st file) which I created the graph object. I want to
> use walktrap community detection on that network. After getting the
> communities, I need to plot only the communities with at most 8 vertices
> and at least 2 vertices (no isolates). Using those communities, I want to
> join the edgelist from the 2nd file to the matching vertices in a column.
> Here, I think I can use graph.union. However, I can't seem to get the
> communities with a sizes 2-8..
>
>
>
> My data are in files:
> hgnc_mapped looks like
>
> ABCB7 MARS 0.054839
> ABCB7 MAX 0.0638109
> ABCB7 MRPS34 0.112394
> ABCB7 NDUFA8 0.123633
> ABCB7 NUP133 0.0810968
>
> combined looks like
>
> hsa-mir-1180 MAPK7
> hsa-mir-1228 NACA
> hsa-mir-1248 IRF9
> hsa-mir-1248 PSME2
> hsa-mir-1254 KIAA1279
> hsa-mir-125b-1PCDHGB3
>
> My code so far is:
>
> edgeList <- read.table("hgnc_mapped.txt", header=TRUE, sep="\t")
> eQTLList <- read.table("combined.txt", header=TRUE, sep="\t")
> t <- as.data.frame(edgeList)
> u <- as.data.frame(eQTLList)
>
> y <- graph.data.frame(t, directed=FALSE, vertices=NULL)
> V(y)
> z <- graph.data.frame(u, directed=TRUE)
> # new_g <- delete.vertices(y,which(degree(y) < 1) - 1)
> # V(new_g)
> ```
>
> ```{r cache=TRUE, dependson='network-data'}
> #Run the community detection algorithm
> wc <- walktrap.community(y, weights = edgeList$Weight, steps=6, merges
> =TRUE, modularity = TRUE, membership = TRUE)
> ```
>
> c1 <- clusters(y)
> c1$membership
> # small.clusters <- which(c1$size > 7)
> # vertices.to.delete <- which((c1$membership)==small.clusters)-1
> # g <- delete.vertices(y, vertices.to.delete)
> layout <- layout.fruchterman.reingold(y)
> x <- (which(c1$csize) < 8 & (c1$csize) > 1)
> vertices <- which(c1$membership==x)
> g1 <- induced.subgraph(y, vertices)
> plot(g1,layout=layout[vertices,])
>
> Thanks in advance.....
>
>
>>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to