YMa-lab / CARD

GNU General Public License v3.0
94 stars 21 forks source link

Error in running CARD_deconvolution() #31

Closed CChen0217 closed 1 year ago

CChen0217 commented 1 year ago

Hi, I have created CARD_obj through "creatCARDObject()", then I used this code:

CARD_obj = CARD_deconvolution(CARD_object = CARD_obj)

I will get this error:

create reference matrix from scRNASeq...

Select Informative Genes! ...

Error in Basis[, ict] : subscript out of bounds

This first time, this run, but when I run it again, this error appeared. Could you help me?

YingMa0107 commented 1 year ago

Hi @CChen0217,

Thank you for your interest in our package.

I'm wondering

  1. Did you try it on the tutorial dataset or your own dataset?
  2. When you ran it the second time, did you run it from the beginning (createCARDObject) or you just ran CARD_deconvolution() function again? If you ran it from the beginning, will the error show up?
  3. Could you please run the following to check if the cell type names are all in the scRNA-seq dataset, after you create a CARD object?
ct.select = CARD_object@info_parameters$ct.select
ct.varname = CARD_object@info_parameters$ct.varname
sample.varname = CARD_object@info_parameters$sample.varname
cat(paste0("## create reference matrix from scRNASeq...\n"))
sc_eset = CARD_object@sc_eset
Basis_ref = createscRef(sc_eset, ct.select, ct.varname, sample.varname)
Basis = Basis_ref$basis
Basis = Basis[,colnames(Basis) %in% ct.select]
library(SingleCellExperiment)
###### check if the cell types in the scRNA-seq reference is consistent with that in the reference basis matrix
print(ct.select)
print(unique(colData(sc_eset)[,ct.varname]))
intersectCT = intersect(ct.select,unique(colData(sc_eset)[,ct.varname]))
print(sum(intersectCT %in% ct.select) == length(ct.select))
##### it should print out TRUE
[1] TRUE

Thanks!

yiqisu commented 1 year ago

Follow up the issue with CARD_deconvolution(). I am able to create an CARD object by function createCARDObject(). However, I failed at CARD_deconvolution(CARD_object = CARD_obj). I guess this is due to MuSiC. I tried to install using BiocManager::install("MuSiC") but failed. Could you please provide any guidance on this? Thanks in advance!

YingMa0107 commented 1 year ago

Hi @yiqisu,

Sorry for the late reply as I somehow missed your follow-up question. Have you tried to install MuSiC by devtools? For example,

devtools::install_github('xuranw/MuSiC')

Also, could you please tell me what is your error output of CARD_deconvolution(CARD_object = CARD_obj)? Thanks!

Best, Ying

yiqisu commented 1 year ago

Thank you, Ying! The installation of MuSiC solved the problem!