[BioC] a bug in hypergraph?

Li Long Li.Long at isb-sib.ch
Mon Mar 10 14:28:56 CET 2008


Hi, Tony,

I suspect "nodes" as parameter name is in conflict w/ function "nodes"...

I tried and tested some new codes... and checked in methods-Hypergraph.R

Let me know what you think.

Li

> According to the man pages for Hypergraph-class, the following example of
> a
> very trivial hypergraph should still work though it does not:
>
> #######Code Starts#########
> library(hypergraph)
> namedList = vector("list")
> namedList$n = "a"
> id = names(namedList)
> he <- mapply(function(x,y) Hyperedge(x,y), namedList, id)
>
>> he
> $n
> A Hyperedge containing 1 nodes.
>
>> hg = new("Hypergraph", nodes = unique(unlist(namedList)), he)
> Error in get(as.character(FUN), mode = "function", envir = envir) :
>   variable "a" of mode "function" was not found
> In addition: Warning message:
> In all(goodHyperedges) : coercing argument of type 'list' to logical
> ########Code Ends#########
>
>
> If the hypergraph has more than 1 node, however, it seems to work:
>
> #######Code Starts#########
> namedList1 = vector("list")
> namedList1$n = letters[1:2]
> id1 = names(namedList1)
> he1 <- mapply(function(x,y) Hyperedge(x,y), namedList1, id1)
>
>> he1
> $n
> A Hyperedge containing 2 nodes.
>
>> hg1 = new("Hypergraph", nodes = unique(unlist(namedList1)), he1)
> Warning message:
> In all(goodHyperedges) : coercing argument of type 'list' to logical
>
>> hg1
> An object of class "Hypergraph"
> Slot "nodes":
> [1] "a" "b"
>
> Slot "hyperedges":
> $n
> A Hyperedge containing 2 nodes.
> ########Code Ends##########
>
> It would appear that this boundary case breaks something in the code;
> using
> traceback(), I find that:
>
>> traceback()
> 9: get(as.character(FUN), mode = "function", envir = envir)
> 8: match.fun(FUN)
> 7: lapply(hyperedges, nodes)
> 6: unlist(lapply(hyperedges, nodes))
> 5: hypergraph:::checkValidHyperedges(hyperedges, nodes)
> 4: .local(.Object, ...)
> 3: initialize(value, ...)
> 2: initialize(value, ...)
> 1: new("Hypergraph", nodes = unique(unlist(namedList)), he)
>
> The checkValidHyperedges() method does not like to call the nodes()
> methods
> on the hyperedge list. I am at a loss as to how to patch this problem.
>
> Tony
>
>> sessionInfo()
> R version 2.7.0 Under development (unstable) (2008-02-10 r44415)
> i386-apple-darwin8.11.1
>
> locale:
> C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] hypergraph_1.11.0 graph_1.17.14
>
> loaded via a namespace (and not attached):
> [1] cluster_1.11.9 tools_2.7.0
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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