Open SabrinaRichter opened 8 months ago
Ok I think I understood it now. t()
without loading the Matrix package can only handle dense matrices and is apparently the one that is used here: https://github.com/livnatje/DIALOGUE/blob/9c146ccf28d7706aaa60d00947a9126b4e75fd69/R/DIALOGUE.cell.type.R#L39
while if i load DIALOGUE, it also loads Matrix and when i then define the make.cell.type method again, it get's the fancy t()
version that can handle my sparse matrix.
Any chance it could be arranged that this is incorporated here @livnatje ?
i think allowing for sparse tpm would also require changing https://github.com/livnatje/DIALOGUE/blob/9c146ccf28d7706aaa60d00947a9126b4e75fd69/R/DIALOGUE.main.R#L233 to
cvals <- corSparse(t(r@tpm),r@scores)
rownames(cvals) <- rownames(r@tpm)
colnames(cvals) <- colnames(r@scores)
R$cca.gene.cor1[[x]]<-cvals
with corSparse from the qlcMatrix library (installed from github since not on CRAN anymore :/ but maybe there is another sparse cor that i didn't see)
Dear DIALOGUE team,
i want to run make.cell.type with tpm being a sparse matrix (dgRMatrix or dgCMatrix). When running with the loaded make.cell.type method I get the following error (when making tpm dense by as.matrix(tpm) all is fine):
but if i copy over the code for average.mat.rows, get.abundant, cell.type and make.cell.type it runs fine!
Absolutely not an R expert, but could it be that something within DIALOGUE changes the transpose function to one that can't handle sparse matrices for some reason?
In case it helps, this is the code I am running: