satijalab / seurat

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

Seurat v5 Levels will sort labels in plots but not the data? #7661

Closed Flope closed 1 year ago

Flope commented 1 year ago

I was trying to reorder the clusters in a dotplot reordering the levels. However, it only reordered the labels in the y-axis but not the data shown. I think a similar issue happened in Seurat v3. I tried the same code with Seurat_4.3.0.1 and It worked.

R version 4.2.2 (2022-10-31) Platform: x86_64-conda-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux 8.6 (Ootpa) Seurat_4.9.9.9058

# insert reproducible example here
levels(seurat) <- sorted_idents
longmanz commented 1 year ago

Hi, Could you elaborate on what "... it only reordered the labels in the y-axis but not the data shown." means? Are you trying to generate any plot for the object?

Flope commented 1 year ago

Hi, I wanted to show the cluster labels in a specific order on the Y-axis of a dotplot. For that, I used the levels function on the object and later plotted the Dotplot. However, with Seurat v5, it only changed the labels but not the dots. When I used the v4 with the same code, I obtained the expected plot. If I am correct that was an issue in early versions of v3. If you think I made a mistake, I can try to reproduce it again.

Flope commented 1 year ago

My apologies. My mistake. Ignore the issue. I rerun the code again with Seurat v5 (Seurat_4.9.9.9058) and it produces the expected result. I am not sure what I did wrong but I some point I had side by side the codes for both versions and only v4 produced the expected dotplot.