Skip to content

Error when using annotateCellTypesGSEA #52

Open
@d-henness

Description

@d-henness

I'm trying to annotate cell types of visium 10x data using the annotateCellTypesGSEA function. This is a minimal script to reproduce the error

library(STdeconvolve)
library(SpatialExperiment)



se <- SpatialExperiment::read10xVisium(samples = "./116_run",
           type = "sparse",
           data = "filtered")
se

# this is the genes x barcode sparse count matrix
cd <- se@assays@data@listData$counts
pos <- SpatialExperiment::spatialCoords(se)

# change column names to x and y
# for this dataset, we will visualize barcodes using "pxl_col_in_fullres" = "y" coordinates, and "pxl_row_in_fullres" = "x" coordinates
colnames(pos) <- c("y", "x")

counts <- cleanCounts(cd, min.lib.size = 100, min.reads = 10)
corpus <- restrictCorpus(counts, removeAbove=1.0, removeBelow = 0.05, nTopOD = 1000)

#ldas <- fitLDA(t(as.matrix(corpus)), Ks = seq(2, 15, by = 1),
ldas <- fitLDA(t(as.matrix(corpus)), Ks = 10,
               perc.rare.thresh = 0.05,
               plot=TRUE,
               verbose=TRUE)

optLDA <- optimalModel(models = ldas, opt = "min")

results <- getBetaTheta(optLDA, perc.filt = 0.05, betaScale = 1000)
deconProp <- results$theta
deconGexp <- results$beta



gset <- list(
  test_type1 = c("FLG", "FLG2"),
  test_type2 = c("KTR25", "KTR71")
)

celltype_annotations <- annotateCellTypesGSEA(beta = results$beta, gset = gset, qval = 0.05)

The error itself is

initial: [1e+02 - Error in stats::ecdf(as.numeric(rvl$p/s.pm)) :
  'x' must have 1 or more non-missing values
Calls: annotateCellTypesGSEA -> <Anonymous> -> bulk.gsea -> <Anonymous>
Execution halted

I can provide the dataset by email if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions