Skip to content

Filter table by coordinate system #431

Description

@sokratiag

Hello,

I am going through your tutorials and I have one question regarding the 'Use landmark annotations to align multiple omics layers' one. I want to filter the visium breast cancer data by the 'downscaled_hires' coordinate system using:

visium_sdata.filter_by_coordinate_system("downscaled_hires",filter_table=True)

What i want to achieve is to have a new spatialdata object with only the aligned barcodes (only the overlapping xenium/visium region) but instead, the above filtering function return a spatial object with equal size as the original one (4992 spots). Is it possible to filter the anndata so that I only include the spots that fall in the aligned area?

Thanks!

Activity

  1. LucaMarconato commented on Jan 16, 2024

    @LucaMarconato
    Member

    Hi, thanks for reaching out!

    Yes filtering by the common region is possible, but not with the filter_by_coordinate_system() function. You can achieve that with the polygon_query() API, passing as argument a shapely.Polygon describing the common area.

    You can either draw this polygon, or more conveniently compute it by first constructing the two rectangles encompassing the Visium and Xenium images, and then intersecting them using the shapely APIs.

    Finally, polygon_query() is merged in main but it had some bugs. In case you encounter any problem please use this new PR which addresses all of them #422 (it will make it into a release in ~2 weeks).

  2. sokratiag commented on Jan 17, 2024

    @sokratiag
    Author

    Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions