Closed dst53 closed 12 months ago
Hello dst53,
thanks for using SPATA2. Unfortunately I can not reproduce the error. Weird, indeed, that it seems to work for one spata2 object and not for the other. Does the error occur when you try to add ias_layer_bins_new
to surface plots plotted with plotSurface()
instead of plotSurfaceComparison()
? If not this might work as a work around for you untill we have solved the problem:
# example variables
var_names <- c("EPCAM")
#
purrr::map(
.x = var_names,
.f = ~ plotSurface(spata2_object, color_by = .x) + ias_layer_new_bins
) %>%
patchwork::wrap_plots()
Furthermore, does the same problem occur with other spata2 objects as well? And does the error appear if you set inc_outline = FALSE
? Can you show me a surface plot with the outline of the image annotation img_ann_1 alone using ggpLayerImgAnnOutline()
. And lastly, can you give me the output of getPixelScaleFactor(spata2_object, unit = "mm")
?
Best regards
Jan
Hi Jan,
Thank you for your help. I believe I have found the source of the error. I had been converting my Seurat objects to SPATA2 objects using SPATA2::asSPATA2()
.
If instead I load my 10x matrix using initiateSpataObject_10X()
the error no longer occurs and I can plot ias_layer_bins on top of the marker expression.
Therefore this seems to be an issue only with Seurat objects that have been converted to SPATA2 objects?
A little more about the error:
The error occurs regardless of whether plotSurface()
or plotSurfaceComparison()
is used and with other spata2 objects that have been converted from Seurat objects.
I'm not sure what function uses the inc_outline
argument? But if I try to create a tissue outline like so on the converted seurat spata2 objects I get the following error:
tissue_outline <- ggpLayerTissueOutline(object = spata2_object, line_color = "grey")
11:04:18 Using center to center distance to compute pixel scale factor. 11:04:18 Computing barcode spot distances. 11:04:22 Done. Error in getTissueOutlineDf(object) : tissueOutlineIdentified(object) is not TRUE
getPixelScaleFactor(spata2_object, unit = "mm")
[1] 0.01475554 attr(,"unit") [1] "mm/px"
Thank you
Hello dst53, sorry for the late reply. I am facing a unusual busy week. Can you try to run object <- identifyTissueSections(object)
followed by object <- identifyTissueOutline(object)
? Does it work afterwards? inc_outline
is an argument of the function ggpLayerEncirclingIAS()
. It requires, however, an identified tissue outline. It seems as if this processing step is missing in the asSPATA2() method for Seurat objects. Therefore, if inc_outline = FALSE
the tissue outline is not included and thus not needed. I assume that the function works if you set it to FALSE.
Hi Jan,
No worries, thank you! That fixed the problem.
Cheers
Hello,
Thank you for the great work. I have followed your tutorial on Image Annotation Screening with no issues. However, I run into an issue when using my own SPATA object and annotation, specifically when attempting to visualize gene expression in the same plot with the image annotation screening circle bins overlaid. Every other plotting functionality works as expected.
plotSurfaceComparison() works as expected, but when I try to add the ias_layer_bins I get the following error:
ias_layer_bins_new <- ggpLayerEncirclingIAS( object = spata2_object, distance = "2.25mm", n_bins_circle = 10, id = "img_ann_1", line_size = 1, verbose = TRUE )
ias_layer_bins_new
plotSurfaceComparison( object = spata2_object, color_by = 'EPCAM', nrow = 1) + ias_layer_bins_new
ias_layer_bins <- ggpLayerEncirclingIAS( object = object_t313, distance = "2.25mm", n_bins_circle = 10, id = "necrotic_center", line_size = 1 )
plotSurfaceComparison( object = spata2_object, color_by = 'EPCAM', nrow = 1) + ias_layer_bins
sessionInfo()