ZikunY / CARMA

GWAS genetics Fine-mapping method
GNU General Public License v3.0
20 stars 7 forks source link

matrix error #4

Closed cmlakhan closed 1 year ago

cmlakhan commented 1 year ago

I am using R version 4.2.2 and am getting an error trying to run CARMA

this is what I ran

z.list<-list()
ld.list<-list()
lambda.list<-list()
z.list[[1]]<-joined$Z
ld.list[[1]] <- as.matrix(LD_matrix)
lambda.list[[1]]<-1
CARMA.results<-CARMA_fixed_sigma(z.list,ld.list,lambda.list=lambda.list,
outlier.switch=F)

and this is the error I am getting

Error: as(<matrix>, "dgTMatrix") is deprecated since Matrix 1.5-0; do as(as(as(., "dMatrix"), "generalMatrix"), "TsparseMatrix") instead

It seems CARMA does not like how the ld matrix is being cast as a Matrix, has anyone else had this issue?

ZikunY commented 1 year ago

Hi Chirag,

Thanks for pointing it out. For the input LD matrix, it is ok to use as.matrix function. The error message is about the usage of Matrix inside the CARMA main function, where CARMA defines model space using dgTMatrix format. The error message is only about the function as() with the arguments as(. "dgTMatrix") when CARMA defines the model space.

I have switched it from as(, "dgTMatrix") to as(as(as(., "dMatrix"), "generalMatrix"), "TsparseMatrix") and there is no more error message on my side.

cmlakhan commented 1 year ago

Thanks Zikun! So I should just install the updated version of the package and it should work?

ZikunY commented 1 year ago

Yes, it is just the warning messages of using dgTMatrix and dgCMatrix of the Matrix package. I updated the input according to the instruction from the package. I tested it on my side, there is no warning message anymore.

BTW, the original warning message should not prevent CARMA from executing, so if CARMA was stopped, maybe there is something else went wrong.

cmlakhan commented 1 year ago

I am getting an error message

Error: as(<matrix>, "dgTMatrix") is deprecated since Matrix 1.5-0; do as(as(as(., "dMatrix"), "generalMatrix"), "TsparseMatrix") instead

So I'm not sure if I should do something different. I upgraded to the newest version of your repo as well so I'm not sure.

cmlakhan commented 1 year ago

I will experiment with your test files and see if I am doing something differently, will let you know what I find out.

ZikunY commented 1 year ago

Wait a sec... I found that I updated the developing version of CARMA, so the main function actually has been updated yet, that is why you still received warning message. Give me a minute, I will update the main function of CARMA, see if there is still warning message. I will let you know once I am done.

ZikunY commented 1 year ago

I just updated the CARMA main function "CARMA". There should not be any warning message now, but please let me know if there is still any... Thanks.

cmlakhan commented 1 year ago

Seems to be working now, thanks a bunch!

ZikunY commented 1 year ago

Great!