Closed ghoshal closed 4 months ago
Hi,
The code here looks correct up until FindSpatiallyVariableFeatures
and runs on several datasets I tested with. Are you able to share data to make a reproducible example? You can post a link here or email to abutler@nygenome.org.
The second error though is caused by using anchors returned from FindTransferAnchors
in a call to IntegrateData
. Here you would need to run PrepSCTIntegration
and FindIntegrationAnchors
prior to IntegrateData
.
Hi Andrew,
I hope you are doing well. Thanks for your response. The data is really large and I won't be able to share the data. Just is to let you know that this is a merged dataset on which I am running the FindSpatiallyVariableFeatures command on. If I run on individual samples it is running well. Once I combine 4 samples together it fails to run.
I'll run the PrepSCTIntegration and FindIntegrationAnchors to see if the other problem is resolved.
Hi Andrew,
here is another error that I am getting.
kidney_list <- list(kidney_cc_v3, kidney_spatial) kidney.features <- SelectIntegrationFeatures(object.list = kidney_list, nfeatures = 10000) kidney_list <- PrepSCTIntegration(object.list = kidney_list, anchor.features = kidney.features) kidney.anchors <- FindIntegrationAnchors(object.list = kidney_list, normalization.method = "SCT", anchor.features = kidney.features, reference = kidney_cc_v3)
Error in h(simpleError(msg, call)) : error in evaluating the argument 'i' in selecting a method for function '[': Incorrect number of logical values provided to subset features In addition: Warning message: In is.na(x) : Error in h(simpleError(msg, call)) : error in evaluating the argument 'i' in selecting a method for function '[': Incorrect number of logical values provided to subset features
Any update on the error when running FindSpatiallyVariableFeatures on a merged seurat object (merging seurat objects that has been each SCTransformed)? I am getting the error below independently of the used method Error in (function (cond) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': subscript out of bounds.
On merging seurat objects then SCTransform the merged seurat object, I get the error that Ghoshal got Error in FindSpatiallyVariableFeatures.default(object = data, spatial.location = spatial.location, : Please provide the same number of observations as spatial locations.
Thanks.
Thanks for using Seurat!
It appears that this issue has gone stale. In an effort to keep our Issues board from getting more unruly than it already is, we’re going to begin closing out issues that haven’t had any activity since the release of v4.4.0.
If this issue is still relevant we strongly encourage you to reopen or repost it, especially if you didn’t initially receive a response from us.
still relevant to me..
Also have the same issue with my 10x Visium data - FindSpatiallyVariableFeatures() works on unmerged samples, but once they are merged (following the code under 'Working with multiple slices in Seurat' in the spatial vignette https://satijalab.org/seurat/articles/spatial_vignette) I also get the same error message which is...
Error in FindSpatiallyVariableFeatures.default(object = data, spatial.location = spatial.location, : Please provide the same number of observations as spatial locations.
Have updated to the most recent version of Seurat as this does have a number of changes/updates to spatial functions but the issue still persists.
Has anyone found a workaround for this issue?
I am also facing the same issue
Hi,
I am getting the following error while running FindSpatiallyVariableFeatures and IntegrateData.
Here is the whole code I ran.
kidney_cc_v3 <- SCTransform(kidney_cc_v3, verbose = FALSE) kidney_cc_v3 <- RunPCA(kidney_cc_v3, assay = "SCT", features = rownames(kidney_cc_v3), verbose = FALSE) kidney_spatial <- SCTransform(kidney_spatial, verbose = FALSE, assay = "Spatial") kidney_spatial <- RunPCA(kidney_spatial, assay = "SCT", features = rownames(kidney_spatial), verbose = FALSE)
kidney_anchors <- FindTransferAnchors(reference = kidney_cc_v3, query = kidney_spatial, normalization.method = "SCT") kidney_predictions.assay <- TransferData(anchorset = kidney_anchors, refdata = kidney_cc_v3$subclass, prediction.assay = TRUE, weight.reduction = kidney_spatial[["pca"]]) kidney_spatial[["kidney_predictions"]] <- kidney_predictions.assay DefaultAssay(kidney_spatial) <- "kidney_predictions"
kidney_spatial <- FindSpatiallyVariableFeatures(kidney_spatial, assay = "kidney_predictions", selection.method = "markvariogram", features = rownames(kidney_spatial), r.metric = 5, slot = "data")
Error in FindSpatiallyVariableFeatures.default(object = data, spatial.location = spatial.location, : Please provide the same number of observations as spatial locations.
kidney_spatial.integrated <- IntegrateData(anchorset = kidney_anchors, normalization.method = "SCT")
Error in UseMethod(generic = "RenameCells", object = object) : no applicable method for 'RenameCells' applied to an object of class "NULL" In addition: Warning message: In CheckDuplicateCellNames(object.list = objects) :
Error in UseMethod(generic = "RenameCells", object = object) : no applicable method for 'RenameCells' applied to an object of class "NULL"
Also, my reference scRNAseq data has 25k cells and the query spatial dataset has 6k cells. Still, I am getting only ~2700 anchors. How can I improve the efficiency of anchor detection.
Any help would be amazing.