Hi,
I am using the hypergraph package specifically because I want to try hypergraph partitioning on some pairwise data I have.
I've populated my hypergraph by creating hyperedges for each of my sample names that meet a pairwise threshold criteria with other sample names. For example: is sampleA shares a pairwise value of between 0.4 and 0.6 with sampleB and sample_C, then all three are described by a hyperedge.
But when I use the kCoresHypergraph() function to partition my hypergraph into cores, I get this error:
> kCoresHypergraph(STX_hypergraph)
**Error in im[r_chosen, c_chosen] : subscript out of bounds.**
After digging a bit deeper this appears to be a bug.
> options(error=recover)
> STX_cores <- kCoresHypergraph(STX_hypergraph)
**Error in im[r_chosen, c_chosen] : subscript out of bounds**
>Enter a frame number, or 0 to exit
>1: kCoresHypergraph(STX_hypergraph)
>2: matrix(im[r_chosen, c_chosen], nrow = length(r_chosen), ncol = length(c_cho
>Selection: 2
>Called from: top level
>Browse[1]> ls()
[1] "byrow" "data" "dimnames" "ncol" "nrow"
>Browse[1]> data
**Error during wrapup: promise already under evaluation: recursive default argument reference or earlier problems?**
> Browse[1]> dim(im)
[1] 170 21
> Browse[1]> r_chosen
91633 185314
84 167
> Browse[1]> c_chosen
[1] 35 36
It is also worth mentioning that my constructed hypergraph does not throw an error with the vCoverHypergraph() function. Therefore, there must be something awry with the kCoresHypergraph() function.
If somebody could help me with this I would greatly appreciate it.
As the FAQ asks, please provide a self-contained example that shows the problem. Unless other people can reproduce and try to diagnose, all we know is you did something and it didn't work.
Thanks, yes, OK,
Some data:
A loop to make the hyper edges. Here, a hyper edge encompasses a sample id node and all other sample id that share a positive pairwise value with it.
make the hypergraph
Cause Error when trying to find the hyper graph cores
Also, will you either highlight your code and click the box with 101010 (or hit Ctrl-K or bracket with triple back-ticks) so the code is readable? I have fixed both of your posts, but it's pretty tedious to have to do that.
Also, your example isn't self-contained (where by 'self contained' we normally mean 'I don't have to, like, type in a bunch of data to recreate your test
data.frame
). Normally people usedput
to make that easier on people who might want to help, although I do hear that the tidyverse has a package called reprex that is supposed to be useful for that sort of thing.Thanks for that. I appreciate it.
Note that
Allows one to do a simple copy'n'paste
Which is easier than copying and pasting five lines of code that have > prepended.