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 runing CreatePRECASTObject() #4

Closed yunbokai closed 1 year ago

yunbokai commented 1 year ago

Hello author, I encountered an error "Error in FUN(newX[, i], ...) : Cannot have both 0 and 1 p-values!" while running CreatePRECASTObject(). This seems like an error that occurs while running sparkX. However, all of my data have previously been successfully processed with sparkX seperately, so I'm not sure why this error is occurring here. The bc2 mentioned here is actually my data, but it has been processed in the same format as bc2 in the tutorial. image Thanks!

yunbokai commented 1 year ago

I changed the "spark-X" to "HVGs" and the error disappeared. But I still wondered why it happened.

yunbokai commented 1 year ago

Besides, Is there a best choice about the K number? How to make a decesion? Could you please give me some advice?

feiyoung commented 1 year ago

Hi, yunbokai, I guess that there may be some format problem in your data. I don't encounter this error in my data. Do you have simulated data that can reproduce this error? If so, I can check the function using your simulated data.

As for the K, you can use MIBC to choose it. For example, given a group of candidated K vector from 10 to 16, then run

PRECASTObj <- AddParSetting(PRECASTObj, coreNum =5, Sigma_equal = FALSE, verbose = TRUE, int.model = NULL) # use coreNum=5 for parallel computation for each K PRECASTObj <- PRECAST(PRECASTObj, K = 10:16) # run for each K from 10 to 16 PRECASTObj <- selectModel(PRECASTObj) # use modified BIC to select the best K and re-organize the results.

Best regards