joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
586 stars 186 forks source link

Clashing transpose method with Matrix #1764

Open BertvanderVeen opened 4 months ago

BertvanderVeen commented 4 months ago

phyloseq's export of the base R transpose method seems to do something weird that clashes with the transpose method of the Matrix package. In essence, if you load phyloseq, and try to transpose a sparse matrix with the transpose function from the Matrix package, it crashes R. As a consequence, Example:

library(phyloseq)
t(matrix(0)) # fine
Matrix::t(as(matrix(0),"TsparseMatrix")) # also crashes

My feeling is that this has to do with the way that phyloseq exports its transpose functionality; at present this is non-specific, whereas it would be great if it could -only- export it for phyloseq objects instead (i.e., define transpose.phyloseq instead). It would be great if this could be fixed, because presently it greatly frustrates any workflows that incorporate both phyloseq and sparse matrices of some kind..

I'm can submit a PR if that is appreciated.