From 4e59e2d02b5a4711f5b39769119799842a2e4e72 Mon Sep 17 00:00:00 2001 From: nickhir Date: Wed, 12 Apr 2023 17:51:31 +0200 Subject: [PATCH] fixed bug where CompCCAT would fail if exp.m is of class dgeMatrix --- R/CompCCAT.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/CompCCAT.R b/R/CompCCAT.R index d371864..545febd 100644 --- a/R/CompCCAT.R +++ b/R/CompCCAT.R @@ -69,8 +69,10 @@ CompCCAT <- function(exp.m, ppiA.m){ if(classMATRIX=="matrix"){ ## ordinary matrix ccat.v <- as.vector(cor(exp.m[match(commonEID.v,rownames(exp.m)),],k.v)); - } - else if (classMATRIX=="dgCMatrix"){ + } else if (classMATRIX=="dgeMatrix"){ # ordinary dense matrix in S4 Matrix representation. + exp.m <- as.matrix(exp.m) # dense S4 matrix representation to base matrix presentation + ccat.v <- as.vector(cor(exp.m[match(commonEID.v,rownames(exp.m)),],k.v)) + } else if (classMATRIX=="dgCMatrix"){ ccat.v <- as.vector(corSparse(exp.m[match(commonEID.v,rownames(exp.m)),],Matrix(matrix(k.v,ncol=1)))); }