SpiecEasi icon indicating copy to clipboard operation
SpiecEasi copied to clipboard

Error when running adj2igraph on spiec.easi output: Error in t(object) : invalid 'lazy' to R_sparse_transpose()

Open wesleysparagon opened this issue 1 year ago • 8 comments

Hello,

I am able to run spiec.easi() on a phyloseq object derived from a raw abundance matrix:

net.c <- spiec.easi(physeq.cull.tend, method='mb')

However, when I attempt to create an igraph object, I receive this error:

net.c.ig <- adj2igraph(getRefit(net.c), vertex.attr=list(name=taxa_names(physeq.cull.tend)))

Error in t(object) : invalid 'lazy' to R_sparse_transpose()

I have tried updating igraph, SpiecEasi, and phyloseq but it has not solved my issue. Any help would be greatly appreciated!

Thanks!

wesleysparagon avatar Nov 09 '23 16:11 wesleysparagon

Hello,

I am also having this issue. I am getting pretty much exactly the same output as described by @wesleysparagon when following the README:

test <- spiec.easi(ps_allwood, method='mb', lambda.min.ratio=1e-2,
                           nlambda=20, pulsar.params=list(rep.num=50))

No problems

test2 <- adj2igraph(getRefit(test))

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'current' in selecting a method for function 'all.equal': invalid 'lazy' to 'R_sparse_transpose'

I tried taking the OTU-table out of the phyloseq and running that on its own to see what would happen. Got the same error.

Any ideas?

Thank you !

millermorganOSU avatar Mar 01 '24 20:03 millermorganOSU

What version of the Matrix package are you using?

On Fri, Mar 1, 2024, 3:10 PM millermorganOSU @.***> wrote:

Hello,

I am also having this issue. I am getting pretty much exactly the same output as described by @wesleysparagon https://github.com/wesleysparagon when following the README:

test <- spiec.easi(ps_allwood, method='mb', lambda.min.ratio=1e-2, nlambda=20, pulsar.params=list(rep.num=50))

No problems

test2 <- adj2igraph(getRefit(test))

Error in h(simpleError(msg, call)) : error in evaluating the argument 'current' in selecting a method for function 'all.equal': invalid 'lazy' to 'R_sparse_transpose'

I tried taking the OTU-table out of the phyloseq and running that on its own to see what would happen. Got the same error.

Any ideas?

Thank you !

— Reply to this email directly, view it on GitHub https://github.com/zdk123/SpiecEasi/issues/249#issuecomment-1973841718, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUD2RFPMB5DCD56IUBGF73YWDOBNAVCNFSM6AAAAAA7E3SMQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZTHA2DCNZRHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

zdk123 avatar Mar 02 '24 14:03 zdk123

Thank you for your reply.

packageVersion('matrix') 1.6.4

I think it has something to do with this because I got adj2igraph() to accept the data by just converting it to a matrix:

test2 <- adj2igraph(as.matrix(getRefit(test)), vertex.attr=list(name=taxa_names(ps_allwood)))

This seems to work, although I am not familiar enough with these methods to detect if this screwed anything up.

millermorganOSU avatar Mar 07 '24 06:03 millermorganOSU

The Matrix package has been changing a lot lately. I'll work on a fix - thanks.

On Thu, Mar 7, 2024, 1:39 AM millermorganOSU @.***> wrote:

Thank you for your reply.

packageVersion('matrix') 1.6.4

I think it has something to do with this because I got adj2igraph() to accept the data by just converting it to a matrix:

test2 <- adj2igraph(as.matrix(getRefit(test)), vertex.attr=list(name=taxa_names(ps_allwood)))

This seems to work, although I am not familiar enough with these methods to detect if this screwed anything up.

— Reply to this email directly, view it on GitHub https://github.com/zdk123/SpiecEasi/issues/249#issuecomment-1982577620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUD2RHAZ4GVR2RZNIW2O63YXADTLAVCNFSM6AAAAAA7E3SMQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBSGU3TONRSGA . You are receiving this because you commented.Message ID: @.***>

zdk123 avatar Mar 09 '24 15:03 zdk123

Also encountering the same error. @millermorganOSU suggestion worked for me as well but not sure if this appropriate...

blediro avatar Apr 03 '24 22:04 blediro

This is strange - I haven't been able to replicate this error with Matrix 1.6.4 or 1.6.5. Do have a reproducible example?

zdk123 avatar Apr 06 '24 18:04 zdk123

Hello. Apologize for the long wait.

I ran the code below in a fresh environment and still encountered this error. At the end of the day, converting the getRefit output to a matrix before creating the igraph object is not a huge deal and it seems to be behaving as expected. It just gave me trouble as a new user following the README.

Certainly, I could still be missing something here. Let me know if you need more information or if you cannot access the attachment. Thank you!

dummyexample.txt

millermorganOSU avatar Jun 14 '24 21:06 millermorganOSU

Hello,

I think I found a solution to this issue from this post: https://github.com/lme4/lme4/issues/743#issuecomment-1722650546

Run this: remotes::install_github("joey711/phyloseq", force = TRUE)

For me, it asked to update a bunch of other dependencies. I said yes to everything, restarted R, and now no longer get the lazy sparse transpose issue.

Hope this helps!

millermorganOSU avatar Jul 26 '24 18:07 millermorganOSU