DoubletFinder
DoubletFinder copied to clipboard
Error in model.matrix.default(mt, mf, contrasts) when running summarizeSweep
Hi Chris: Below is what I did but I cannot figure out how to fix the error:
pbmc_0hr_PHX1 <- CreateSeuratObject(counts = pbmc_0hr_PHX1.data, project = "PBMC0hrPHX1", min.cells = 3, min.features = 200) pbmc_0hr_PHX1[["percent.mt"]] <- PercentageFeatureSet(pbmc_0hr_PHX1, pattern = "^MT-") pbmc_0hr_PHX1 <- subset(pbmc_0hr_PHX1, subset = nFeature_RNA > 100 & nFeature_RNA < 6000 & percent.mt < 20) pbmc_0hr_PHX1 <- NormalizeData(pbmc_0hr_PHX1) pbmc_0hr_PHX1 <- FindVariableFeatures(pbmc_0hr_PHX1, selection.method = "vst", nfeatures = 2000) pbmc_0hr_PHX1 <- ScaleData(pbmc_0hr_PHX1) pbmc_0hr_PHX1 <- RunPCA(pbmc_0hr_PHX1) pbmc_0hr_PHX1 <- RunUMAP(pbmc_0hr_PHX1, dims = 1:10)
sweep.res.list <- paramSweep_v3(pbmc_0hr_PHX1, PCs = 1:10, sct = FALSE) [1] "Creating artificial doublets for pN = 5%" [1] "Creating Seurat object..." [1] "Normalizing Seurat object..." Performing log-normalization ...... (step "paramSweep_v3" finished)
gt.calls <- [email protected][rownames(sweep.res.list[[1]]), "GT"] sweep.stats <- summarizeSweep(sweep.res.list, GT = TRUE, GT.calls = gt.calls)
Error in model.matrix.default(mt, mf, contrasts) : variable 1 has no levels
Additional info:
head([email protected]) orig.ident nCount_RNA nFeature_RNA percent.mt AAACCCACATAGTCAC-1 PBMC0hrPHX1 754 511 1.856764 AAACCCACATTGACCA-1 PBMC0hrPHX1 800 446 19.750000 AAACCCAGTAGTTCCA-1 PBMC0hrPHX1 1484 962 5.727763
head(rownames(sweep.res.list[[1]])) [1] "AAACCCACATAGTCAC-1" "AAACCCACATTGACCA-1" "AAACCCAGTAGTTCCA-1" "AAACGAATCAAGAATG-1" "AAACGAATCGATTGGT-1" "AAACGCTTCCGTAGGC-1"
Thanks so much for your help!!!
I am also facing the same issue. Can someone please answer this if they have found a solution?
Hi @himanshuballav16 and @Polly188 -- sorry for lack of response. Maybe you already figured this out, but what does head(gt.calls) and tail(gt.calls) look like? Do you have a column in [email protected] called GT? Doesn't look like it from the head([email protected])