Skip to content

sifrimlab/spatial_epigenetics_annotation_transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Projection of annotations onto spatial epigenomics

This repository contains all code and parameters needed to reproduce the image processing performed in Kint et al. 2025.

Requirements:

  • FIJI
  • conda environment with the requirements in ./yamls/register.yml

Order of operations:

  1. Transform annotations made in Fiji by pathologists into a labeled image by running the transform_pathology_annotations_into_labeled_image.ijm macro in Fiji with the annotated H&E open.

  2. Convert labeled image into geojson file representing the polygons of the annotations

python convert_all_points_of_labeled_image_io_geojson.py

  1. Register the H&E images onto the BSA images that come with the spatial epigenomics using the following notebooks, split by origin of samples. If you want to reproduce how the transformations were calculated, look at:

     - ./learn_registration_InHouse_HE_on_bsa.ipynb
     - ./learn_registration_AtlasXbrowser_HE_on_bsa.ipynb
    

If you just want to apply the transformations to the coordinates of the annotations, look at:

    - ./perform_registration_InHouse_HE_on_bsa.ipynb
    - ./perform_registration_AtlasXbrowser_HE_on_bsa.ipynb
  1. Rotate everything in the output directory 135 degrees using python rotate_registered_results.py. This will need to be done anyway in step 5, but extracting the transformation for the annotations is clunky, so we did it before.

  2. Place spatial epigenomics onto (potentially slightly altered) BSA image using AtlasXomics proprietary software. After downloading the software, one modification needs to be made in order for the next steps to work: The software doesn't automatically save the bounding box of the cropping it will perform. So we need to add a line that saves it for us. In the folder of the software, run the following command: (after copying the bsa_gui.patch file there)

patch -u -b ./bsa_gui.py -i ./bsa_gui.patch

This will modify in place, so feel free to make a backup beforehand.

  1. Assign classes to capture points using the registered annotations
python apply_annotation_mask_to_spatial_folder.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages