Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using annotateCellTypesGSEA #52

Open
d-henness opened this issue Feb 27, 2024 · 3 comments
Open

Error when using annotateCellTypesGSEA #52

d-henness opened this issue Feb 27, 2024 · 3 comments

Comments

@d-henness
Copy link

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

@ChristineHOconnor
Copy link

I am running STdeconvolve 1.3.1 and I get the same error when trying to run annotateCellTypesGSEA. The example commands with the test data in the Annotating Deconvolved Cell Types tutorial work for me, and other STdeconvolve functions work with my dataset.

@Umaarasu
Copy link

@ChristineHOconnor and @d-henness ...did you guys fix this issue?

@bmill3r
Copy link
Collaborator

bmill3r commented Jun 7, 2024

Hi @d-henness,

So sorry for the delayed response. My guess is that the number of genes in each of your example test cell types is too small or not well represented in your dataset. I would be happy to take a closer look if you are able to provide your dataset and cell type markers that are causing this error. I admit though that I am in a new position and my time is limited so my response will likely take some time.

Hope this helps and sorry again,
Brendan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants