[BioC] graph object question
Vincent Carey
stvjc at channing.harvard.edu
Fri Feb 12 23:47:01 CET 2010
as usual there are many way to proceed. i'd suggest that you do not
try to build the edge list by hand, but start your graph with your set
of nodes
library(graph)
g = new("graphNEL", nodes = nodevec)
and then use
addEdge in the graph package to build the thing up directly as a
graphNEL instance
On Fri, Feb 12, 2010 at 5:17 PM, Iain Gallagher
<iaingallagher at btopenworld.com> wrote:
> Hello list
>
> I'm trying to build graph objects showing the relationship between miRNA and genes. Is there a quick way to do this from a dataframe (see toy code below)?
> When building my graph object I can't think my way through getting the 'edges' list name into my list of edges (see below)!
>
>
>> testData
> symbol mirbase_id
> 6 2'-PDE hsa-let-7b
> 86 A2BP1 hsa-let-7b
> 331 AAK1 hsa-let-7b
> 1003 ABCB9 hsa-let-7b
> 1071 ABCC10 hsa-let-7b
> 1195 ABCC5 hsa-let-7b
> 3520 ACSL6 hsa-let-7b
> 3583 ACTA1 hsa-let-7b
> 4102 ACTR2 hsa-let-7b
> 4480 ACVR1B hsa-let-7b
>
> t2<-as.list(testData[,2],)
> names(t2)<-testData[,1]
> nodes<-testData[,1]
>
> for (i in 1:length(t2)) t2[[i]] <- c(names(t2[i]), t2[[i]])
>
>> t2
> $`2'-PDE`
> [1] "2'-PDE" "hsa-let-7b"
> ...
>
> But what I need is...
>
>> t2
> $`2'-PDE`
> $`2'-PDE`$edges
> [1] "2'-PDE" "hsa-let-7b"
> ...
>
> Thanks for any help.
>
> Iain
>
>> sessionInfo()
> R version 2.10.1 (2009-12-14)
> x86_64-pc-linux-gnu
>
> locale:
> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
> [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8
> [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] grid stats graphics grDevices utils datasets methods
> [8] base
>
> other attached packages:
> [1] RColorBrewer_1.0-2 Rgraphviz_1.24.0 graph_1.24.1
>
> loaded via a namespace (and not attached):
> [1] tools_2.10.1
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
More information about the Bioconductor
mailing list