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

How to adjust the plotting parameters? #180

Open
bmlett opened this issue Apr 30, 2024 · 7 comments
Open

How to adjust the plotting parameters? #180

bmlett opened this issue Apr 30, 2024 · 7 comments

Comments

@bmlett
Copy link

bmlett commented Apr 30, 2024

Hi! I am trying to adjust and make the images clearer from the plot_bleeding_correction portion of the workflow. I have tried in both the command line and in a python notebook and the result is this:
image

The command line method looks better than the notebook, but both are hard to see. Any insights on what I am missing would be greatly appreciated!

Packages was installed using the pip method last week. Thanks.

@jeffquinn-msk
Copy link
Contributor

jeffquinn-msk commented Apr 30, 2024

That plot should look something like this:

Screenshot 2024-04-30 at 1 26 12 PM

We generate this plot as a PDF in our workflow, I would recommend maybe doing this same (i know you cannot display PDF inline in IPython notebooks though sorry).

I would also recommend running BayesTME in its docker container, I cannot support installing it directly with pip, its too complex to consider all the factors in your host environment that might cause matplotlib to behave differently. You can install jupyter inside the BayesTME container if you want to use it that way.

@bmlett
Copy link
Author

bmlett commented Apr 30, 2024

Thanks. The screenshot above is from the pdf format but I'll look into see about getting Docker to run with our server and see if that fixes the issue.

@bmlett
Copy link
Author

bmlett commented May 17, 2024

Hi - So I finally got docker to run and install. I used the command line for bleed_correction and plotting and still got these style images as pdfs:
image

@jeffquinn-msk
Copy link
Contributor

jeffquinn-msk commented May 17, 2024

Oh ok sorry about that, I just updated this plot the other day actually, might want to pull the latest container and try that, but I'm wondering if maybe this is a data issue.. what kind of Visium are you using? Is it 6.5mm Visium, 11mm Visium, or VisiumHD ? We have only really tested this with 6.5mm Visium so far maybe the other kinds break some plot layouts

@bmlett
Copy link
Author

bmlett commented May 17, 2024

Hi

Yeah I think its a data issue. I had a few preprocessing steps I did using scanpy. I used their adata.obsm['spatial'] for positions in the data.SpatialExpressionDataset.from_arrays. I think because scanpy sets that to the physical positions but bayesTME expected array its causing the error. I've updated the script to use array_col and array_pos. Not sure how many other differences there are between the anndata objects between bayesTME and scnapy

@bmlett
Copy link
Author

bmlett commented May 18, 2024

Updating the position file settings and the latest version of the docker seems to have corrected the plotting issues! Thanks!! I'd recommend maybe in some future iteration adding in a import/export for scanpy.

image

@jeffquinn-msk
Copy link
Contributor

jeffquinn-msk commented May 19, 2024

Ah yes that would do it. Glad you got it working. As you point out when scanpy reads in the data it uses the physical spot coordinates in the spatial attribute (X,Y points in slide micrometer offset), while the plotting code I wrote expects the logical spot coordinates in the spatial attribute (integer indices into hexagonal grid). A little confusing I agree, we should persist both into the anndata and use them appropriately.

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