YMa-lab / CARD

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

Issue of CARD object creation #40

Closed YangXuuu closed 1 year ago

YangXuuu commented 1 year ago

Hi

Previously I successfully run the deconvolution on one of my four samples also the demo data works as well. However, for my other three data, I failed when creating the CARD object. The error message looks like this:

CARD_obj = createCARDObject(

  • sc_count = sparse_sc_common,
  • sc_meta = CID4465_metadata,
  • spatial_count = sparse_st_common,
  • spatial_location = CID4465_tissue_positions_keep,
  • ct.varname = "cellType",
  • ct.select = unique(CID4465_metadata$cellType),
  • sample.varname = "sampleInfo",
  • minCountGene = 100,
  • minCountSpot = 5)

    QC on scRNASeq dataset! ...

    QC on spatially-resolved dataset! ...

    错误: There are no common gene names in spatial count data and single cell RNAseq count data

Then I check the gene names of two dgcMatrix:

length(intersect(CID4465_st@Dimnames[[1]], CID4465_sc@Dimnames[[1]])) [1] 17365

There are certainly lots of common gene names between spatial count data and sc RNAseq count data. I use the same code with same data format exactly with the demo and previously succeed one. Any advice would be appreciated, much thanks!

YingMa0107 commented 1 year ago

Hi @YangXuuu,

Thank you for your interest in our package.

Sorry for the delayed response. Based on your code, it seems that the sc_count you input is sparse_sc_common, and the spatial transcriptomics count data you input is sparse_st_common, could you please check if these two have common genes? i.e.,

common = intersect( rownames(sparse_sc_common), rownames(sparse_st_common))
print(length(common[!is.na(common)]))

Thank you !

Best, Ying

krigia commented 1 year ago

@YingMa0107 I also have a problem with CARD object creation. I cannot format the RDS files as you have done in the example and I am getting multiple errors in downstream analyses. How do you generate the RDS files for "sc_count", "sc_meta", "spatial_count", "spatial_location"? Thank you.

YingMa0107 commented 1 year ago

Hi @krigia,

Thank you for your interest!

For your problem, could you please share with me more details about your error messages? This will help me to find the issue. Based on your current description, you don't need to generate the RDS file for "sc_count", "sc_meta", "spatial_count", "spatial_location", as CARD takes input of data matrices and data frames (after you read or load the RDS file). For example, in the createCARDObject function,

CARD_obj = createCARDObject( sc_count = sc_count, sc_meta = sc_meta, spatial_count = spatial_count, spatial_location = spatial_location, ct.varname = "cellType", ct.select = unique(sc_meta$cellType), sample.varname = "sampleInfo", minCountGene = 100, minCountSpot = 5) As long as sc_count is a matrix, sc_meta is a data frame, spatial_count is a matrix, spatial_location is a data frame, and all the other arguments you have given are tcorrect, this function should work. For more details about the input file, please see the tutorial https://yingma0107.github.io/CARD/documentation/04_CARD_Example.html with the section 1. Create an CARD object.

YangXuuu commented 1 year ago

Hi @YangXuuu,

Thank you for your interest in our package.

Sorry for the delayed response. Based on your code, it seems that the sc_count you input is sparse_sc_common, and the spatial transcriptomics count data you input is sparse_st_common, could you please check if these two have common genes? i.e.,

common = intersect( rownames(sparse_sc_common), rownames(sparse_st_common))
print(length(common[!is.na(common)]))

Thank you !

Best, Ying

Hi Ying

Sorry for the late follow-up. I was managed to handle this problem which was due to the wrong format of csv file input. No worries, thanks!

Kind regards Yang