satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.31k stars 919 forks source link

Crop function not working #9325

Open elifozcelik opened 2 months ago

elifozcelik commented 2 months ago

Hi, I am trying to use the crop function on my data but it is giving the following error

> basal.crop <- Crop(cancer[["C16.S1"]],  y= c(175000, 180000), x= c(-50000, -60000))
Error: Cannot remove default boundary
In addition: Warning message:
The selected region does not contain any cell segmentations 

When I plot the image using ImageDimPlot I can see that these coordinates include tissues. ggplot_try.pdf

Am I missing something? Leaving related information below, thank you!

> head(coords)
          x        y        cell
1 -36765.44 130532.4 C16.S1_39_1
2 -36763.44 130530.4 C16.S1_39_1
3 -36749.44 130514.4 C16.S1_39_1
4 -36743.44 130500.4 C16.S1_39_1
5 -36743.44 130477.4 C16.S1_39_1
6 -36753.44 130467.4 C16.S1_39_1

> cancer
An object of class Seurat 
978 features across 190014 samples within 1 assay 
Active assay: Nanostring (978 features, 0 variable features)
 2 layers present: counts, data
 2 dimensional reductions calculated: pca, umap
 3 spatial fields of view present: C16.S1 C17.S2 C18.S3
alikhuseynov commented 2 months ago

try switching xy coordinates, like x = c(175000, 180000) andy = c(-50000, -60000) to see if it works see this issue:

elifozcelik commented 2 months ago

It didn't work, getting the same error again

alikhuseynov commented 2 months ago

try the coords = "plot" arg within the Crop function to specify if coordinates you provided are from the Seurat's plotting function or from tissue coords, see this -> Crop function

dcollins15 commented 1 month ago

@elifozcelik are you sure that those coordinates are correct? Obviously the output is truncated, but none of the values displayed in coords seem to be within the specified range.