feiyoung / PRECAST

an efficient data integration method for multiple spatial transcriptomics data with non- cluster-relevant effects such as the complex batch effects.
GNU General Public License v3.0
9 stars 3 forks source link

error when running IntegrateSpaData with specific HK genes #5

Closed yiranzhimo closed 1 year ago

yiranzhimo commented 1 year ago

Hello, Thank you for your hard work which helped me a lot. But I have met a problem.

When running the IntegrateSpaData step without specific HK genes, it works well.

If I set the specific HK genes, an error occurs which means:

seuInt <- IntegrateSpaData(PRECASTObj,custom_housekeep=HK_filtered)
seuInt

error: Using bouth housekeeping gene and PRECAST results to obtain the batch corrected gene expressions.

Error in x[, houseKeep]: 下标出界 Traceback:

  1. IntegrateSpaData(PRECASTObj, custom_housekeep = HK_filtered)
  2. get_correct_exp(XList, PRECASTObj@resList$Rf, houseKeep = houseKeep, . q_unwanted = min(10, length(houseKeep)), covariateList = covariateList)
  3. pbapply::pblapply(XList, function(x) x[, houseKeep])
  4. lapply(X, FUN, ...)
  5. FUN(X[[i]], ...)

I's definitely sure all the genes in HK_filtered also in the Mouse_HK_genes$Gene

unique(HK_filtered == intersect(HK_filtered,Mouse_HK_genes$Gene))

截屏2023-04-07 16 20 20

Thank you for your help!

feiyoung commented 1 year ago

Are the HK_filtered genes in the gene list of PRECASTObj@seulist (the selected variable genes, the row.names of seulist[[1]])? In the current version of PRECAST, it use the housekeeping genes in the selected vairable genes to correct batch effects in expression.

Check whether the gene names in your PRECASTObj is symbol names? It must be symbol name so that the intersection of selected variable genes and Mouse_HK_genes$Gene is a nonempty set.