Hi there,
I encountered an error while attempting to run SCTransform() in the Seurat package. The error message suggests a problem with the second non-regularized linear regression step. The error only occurs, when I add the parameter "batch" to vars.to.regress. Here are the details:
Running this code:
Running SCTransform on layer: counts.C1
vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
Variance stabilizing transformation of count matrix of size 14474 by 4786
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 2000 genes, 4786 cells
Found 42 outliers - those will be ignored in fitting/regularization step
Second step: Get residuals using fitted parameters for 14474 genes
Computing corrected count matrix for 14474 genes
Calculating gene attributes
Wall clock passed: Time difference of 39.14677 secs
Determine variable features
Regressing out percent.mt, nFeature_RNA, nCount_RNA, batch
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
Contrasts can be applied only to factors with 2 or more levels
Every sample has been assigned to a batch using this code beforehand:
Hi there, I encountered an error while attempting to run SCTransform() in the Seurat package. The error message suggests a problem with the second non-regularized linear regression step. The error only occurs, when I add the parameter "batch" to vars.to.regress. Here are the details: Running this code:
Produces this error:
Every sample has been assigned to a batch using this code beforehand:
I am using the Seurat Package Version 5.0.2
Does anybody have an idea how to solve this? I appreciate any help! Cheers!