biosurf / cyCombine

Robust Integration of Single-Cell Cytometry Datasets
Other
21 stars 5 forks source link

Error in batch correction #49

Open thigh0829 opened 2 weeks ago

thigh0829 commented 2 weeks ago

Hi, thanks to your wonderful code. It really helps us to speed up the gating process of many batches. But recently I met a problem, the error code is listed at below. This dataset is acquired from spectral flowcytometry, it includes 72 samples in 27 batches, cell number of each sample varies from 7090 to 67000. And we are choosing 23 markers to reduce the batch effect.

Correcting Label group 31 Found 22 genes with uniform expression within a single batch (all zeros); these will not be adjusted for batch. Using the 'mean only' version of ComBat Found26batches Note: one batch has only one sample, setting mean.only=TRUE Adjusting for0covariate(s) or covariate level(s) Standardizing Data across genes Error in solve.default(crossprod(design), tcrossprod(t(design), as.matrix(dat))) :
no right-hand side in 'b' In addition: There were 31 warnings (use warnings() to see them)

shdam commented 1 week ago

Hi there,

Thanks for using cyCombine! I am glad to hear it has been helpful to you :)

It sounds like a few cells in a batch are causing some issues in cluster 31. I recommend either removing cells with very little information (only a few markers expressed) or investigating the cells in the particular cluster. You can add the label information to your data with:

df$label <- df %>%
      cyCombine::normalize(markers = markers,
                           norm_method = norm_method) %>%
      cyCombine::create_som(markers = markers,
                            seed = seed,
                            xdim = xdim,
                            ydim = ydim)

You can then double-check the faulty cluster number by running batch_correct with label = "label" and investigate the cluster that causes an error using the label column.

I hope this was helpful - let me know if you have any questions :)

Best regards, Søren

thigh0829 commented 1 week ago

Thanks for your help.

shdam commented 1 week ago

Let me know if it got worked out :)