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 running function ICASpatial #1

Open
inaciomdrs opened this issue Nov 29, 2023 · 7 comments
Open

Error when running function ICASpatial #1

inaciomdrs opened this issue Nov 29, 2023 · 7 comments

Comments

@inaciomdrs
Copy link

Environment

R version 4.3.1 (2023-06-16)
CFS Version: 0.9.7.2

Code I am using to run CFS

library(future)
library(Seurat)
library(enrichR)
library(CFS)
library(moments)
library(dplyr)
library(purrr)

sample_path <- "path/to/sample"

data <- Load10X_Spatial(
  sample_path,
  filename = "filtered_feature_bc_matrix.h5",
  assay = "Spatial",
  slice = "slice1",
  filter.matrix = TRUE,
  to.upper = FALSE,
  image = NULL,
)

data[["percent.mt"]] <- PercentageFeatureSet(data, pattern = "^MT-")

data <- subset(data, subset = nFeature_Spatial >= 5500 & percent.mt <= 15)

data <- PrepNormData(data=data,organism="Hs",variable_features=2000)

data <- ICASpatial(data=data,ncis=100,maxit=600,method="icafast",kurtosis = 3,sd=3)

Error message

Error in validObject(.Object): invalid class “DimReduc” object: rownames must be present in 'cell.embeddings'
Traceback:

1. ICASpatial(data = data, ncis = 100, maxit = 600, method = "icafast", 
 .     kurtosis = 3, sd = 3)
2. RunICA(data, verbose = TRUE, nics = ncis, maxit = maxit, ica.function = method)
3. RunICA.Seurat(data, verbose = TRUE, nics = ncis, maxit = maxit, 
 .     ica.function = method)
4. RunICA(object = object[[assay]], assay = assay, features = features, 
 .     nics = nics, rev.ica = rev.ica, ica.function = ica.function, 
 .     verbose = verbose, ndims.print = ndims.print, nfeatures.print = nfeatures.print, 
 .     reduction.key = reduction.key, seed.use = seed.use, ...)
5. RunICA.Assay(object = object[[assay]], assay = assay, features = features, 
 .     nics = nics, rev.ica = rev.ica, ica.function = ica.function, 
 .     verbose = verbose, ndims.print = ndims.print, nfeatures.print = nfeatures.print, 
 .     reduction.key = reduction.key, seed.use = seed.use, ...)
6. RunICA(object = data.use, assay = assay, nics = nics, rev.ica = rev.ica, 
 .     ica.function = ica.function, verbose = verbose, ndims.print = ndims.print, 
 .     nfeatures.print = nfeatures.print, reduction.key = reduction.key, 
 .     seed.use = seed.use, ...)
7. RunICA.default(object = data.use, assay = assay, nics = nics, 
 .     rev.ica = rev.ica, ica.function = ica.function, verbose = verbose, 
 .     ndims.print = ndims.print, nfeatures.print = nfeatures.print, 
 .     reduction.key = reduction.key, seed.use = seed.use, ...)
8. CreateDimReducObject(embeddings = cell.embeddings, loadings = feature.loadings, 
 .     assay = assay, key = reduction.key)
9. new(Class = "DimReduc", cell.embeddings = embeddings, feature.loadings = loadings, 
 .     feature.loadings.projected = projected, assay.used = assay, 
 .     global = global, stdev = stdev, key = key, jackstraw = jackstraw, 
 .     misc = misc)
10. initialize(value, ...)
11. initialize(value, ...)
12. validObject(.Object)
13. stop(msg, ": ", errors, domain = NA)

What can I be doing wrong?

@inaciomdrs
Copy link
Author

inaciomdrs commented Nov 29, 2023

UPDATE: even when I load just Seurat and CFS, I get the same error.

@c-thuil
Copy link
Collaborator

c-thuil commented Dec 2, 2023

Hi @inaciomdrs,

Thank you for using CFS and sorry for the sligthly delayed answer. I have been trying to replicate the error on my side without success. Considering the error, I assume the problem comes from the Seurat output format. Could you tell me which version of Seurat you are using? Also, are your cell names correctly displayed in your object?

Let me know, also if you have any additional questions or problems.

@inaciomdrs
Copy link
Author

Hi @c-thuil ,

The version of Seurat I'm using is 5.0.1.
Yes, the cell names correctly displayed in the object.

@nrosewick
Copy link

Hi @c-thuil

I've the same issue. I use Seurat 5.0.0 . Any idea how to solve this ?

Thanks

@c-thuil
Copy link
Collaborator

c-thuil commented Feb 23, 2024

Hi @nrosewick

The issue should have been resolved on the development version of CFS. The main branch will be updated soon.
You can install it by replacing the "main" in the installation command with "development"

devtools::install_github("c-thuil/CFS"
                         ,ref="development")

Let me know if this works for you,

@nrosewick
Copy link

Hi @c-thuil

Thank you for the prompt answer. I tried with the development version but it still do not work. I checked Seurat's RunICA function and apparently they have issues with their new v5.0 version : satijalab/seurat#8376

I can maybe contact directly Seurat's team.

Thanks

@c-thuil
Copy link
Collaborator

c-thuil commented Feb 26, 2024

Hi @nrosewick

Yes, I believe the problem comes from the RunICA function from Seurat. In the meantime, I have already updated the development version of CFS to work without the RunICA function from Seurat. Can you see if this works for you now?

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

3 participants