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

'SpatialData' object has no attribute 'pp' #366

Open
lg907 opened this issue Oct 1, 2024 · 2 comments
Open

'SpatialData' object has no attribute 'pp' #366

lg907 opened this issue Oct 1, 2024 · 2 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation priority: low

Comments

@lg907
Copy link

lg907 commented Oct 1, 2024

Hello, I am attempting to follow the 10x Visium example notebook (https://spatialdata.scverse.org/en/latest/tutorials/notebooks/notebooks/examples/technology_visium.html#technology-focus-10x-genomics-visium) and are encountering issues when attempting to colour the visium spots by gene expression.

Running:

(
    visium_sdata.pp.get_elements("ST8059050")
    .pl.render_images(elements="ST8059050_hires_image")
    .pl.render_shapes(elements="ST8059050", color="mt-Co3")
    .pl.show()
)

Gives the following output:

AttributeError                            Traceback (most recent call last)

visium_sdata.pp.get_elements("ST8059050")
.pl.render_images(elements="ST8059050_hires_image")
.pl.render_shapes(elements="ST8059050", color="mt-Co3")
.pl.show()

All previous code worked and gave outputs consistent with the example notebook.

I am using spatialdata 0.2.3 with python 3.11.10 on MacOS.

@LucaMarconato
Copy link
Member

Hi, to fix please replace .pp.get_elements() with .subset(), and please ensure you pass a list to subset().

So your code becomes:

(
    visium_sdata.subset(["ST8059050"])
    .pl.render_images(elements="ST8059050_hires_image")
    .pl.render_shapes(elements="ST8059050", color="mt-Co3")
    .pl.show()
)

@LucaMarconato
Copy link
Member

LucaMarconato commented Oct 1, 2024

  • @timtreis can you please make a quick PR that reinstates .pp.get_elements() and automatically calls .subset(), saying that the .pp.get_elements() is now deprecated and will be removed in one next release? Thanks.

@timtreis timtreis transferred this issue from scverse/spatialdata Oct 1, 2024
@timtreis timtreis added priority: low bug Something isn't working documentation Improvements or additions to documentation labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation priority: low
Projects
None yet
Development

No branches or pull requests

3 participants