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

spot coord problem #18

Open
joe-jhou2 opened this issue May 27, 2022 · 1 comment
Open

spot coord problem #18

joe-jhou2 opened this issue May 27, 2022 · 1 comment

Comments

@joe-jhou2
Copy link

Hi Joe,

I’ve trying to extract the spot coordinates from Staffli object in order to integrate single-cell RNA-seq with Spatial data.
I gotta the x and y by this data.frame(GetStaffli(A1_ST)[[]][,c(1,2)]),
I run my own code; the plot looks like this:
image001

If I use ST.FeaturePlot, plot looks like this
image003

The image generated by ST.FeaturePlot is correct since it’s the same as CellRanger. But image on my codes is upside down. I want to figure out what I did is wrong, if I pick up the wrong coordinate value? Would you please advise? Thanks

@ludvigla
Copy link
Collaborator

ludvigla commented Jun 1, 2022

Hi @mimisikai,

The coordinates you are using are not the same ones used by ST.FeaturePlot. It uses either the pixel_x, pixel_y coordinates or warped_x, warped_x coordinates if the images have been processed. If you want to use these coordinates, you can just do something like:

xy <- GetStaffli(A1_ST)@meta.data[, c("pixel_x", "pixel_y")]

Regardless of what coordinates you use, the y-axis goes from top to bottom. If you're using ggplot2 for example, the y-axis goes from bottom to top, so you need to invert the y axis to get the correct orientation. This can for example be done using scale_y_reverse(). Alternatively, you can invert the y-axis values like this: y_inv <- maxy - y

/Ludvig

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

2 participants