Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .codeboarding/Cell_Type_Annotation_Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
```mermaid

graph LR

Cell_Type_Annotation_Module["Cell Type Annotation Module"]

enact_pipeline_ENACT_run_cell_type_annotation["enact.pipeline.ENACT:run_cell_type_annotation"]

enact_cellassign["enact.cellassign"]

enact_celltypist["enact.celltypist"]

ENACT_Pipeline_Core["ENACT Pipeline Core"]

External_CellAssign_tool["External CellAssign tool"]

External_CellTypist_tool["External CellTypist tool"]

enact_pipeline_ENACT_run_cell_type_annotation -- "orchestrates" --> enact_cellassign

enact_pipeline_ENACT_run_cell_type_annotation -- "orchestrates" --> enact_celltypist

ENACT_Pipeline_Core -- "provides data to" --> enact_pipeline_ENACT_run_cell_type_annotation

enact_cellassign -- "interacts with" --> External_CellAssign_tool

enact_celltypist -- "interacts with" --> External_CellTypist_tool

ENACT_Pipeline_Core -- "orchestrates" --> Cell_Type_Annotation_Module

Cell_Type_Annotation_Module -- "utilizes" --> External_CellAssign_tool

Cell_Type_Annotation_Module -- "utilizes" --> External_CellTypist_tool

click Cell_Type_Annotation_Module href "https://github.com/Sanofi-Public/enact-pipeline/blob/main/.codeboarding//Cell_Type_Annotation_Module.md" "Details"

```

[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org)



## Component Details



The Cell Type Annotation Module is fundamental because it directly addresses a core biological question in spatial transcriptomics: identifying the types of cells present in a sample. By integrating external, specialized tools like CellAssign and CellTypist, it leverages established methods for accurate cell type identification, which is crucial for downstream biological interpretation. The module acts as the bridge between the ENACT pipeline's processed gene expression data and these external annotation tools, ensuring data compatibility and efficient workflow. This structure allows the ENACT pipeline to remain flexible, supporting different cell type annotation methodologies without tightly coupling the core pipeline logic to the specifics of each external tool. The Cell Type Annotation Module encapsulates this complexity, providing a clean interface for the main pipeline.



### Cell Type Annotation Module

This module is responsible for assigning biological cell type labels to the aggregated cell-by-gene expression data. It acts as an interface and dispatcher to external, specialized cell type annotation pipelines, specifically supporting CellAssign and CellTypist. This module prepares the input data in the format required by these external tools and processes their outputs to enrich the cell data with crucial biological annotations.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/cellassign.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.cellassign` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/celltypist.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.celltypist` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:run_cell_type_annotation` (0:0)</a>





### enact.pipeline.ENACT:run_cell_type_annotation

This method within the `ENACT` pipeline class orchestrates the cell type annotation process. It acts as the entry point for initiating cell type annotation, determining which external tool (CellAssign or CellTypist) to use based on configuration, and managing the overall flow.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:run_cell_type_annotation` (0:0)</a>





### enact.cellassign

This module specifically handles the integration with the CellAssign tool. Its responsibilities include preparing the input data in the format required by CellAssign, executing the CellAssign pipeline, and processing its output to extract cell type annotations.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/cellassign.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.cellassign` (0:0)</a>





### enact.celltypist

Similar to `enact.cellassign`, this module manages the integration with the CellTypist tool. It prepares input data for CellTypist, executes the CellTypist annotation process, and parses its output to obtain cell type labels.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/celltypist.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.celltypist` (0:0)</a>





### ENACT Pipeline Core

The core component of the ENACT pipeline that provides aggregated cell-by-gene expression data.





**Related Classes/Methods**: _None_



### External CellAssign tool

An external tool used for cell type annotation via CellAssign.





**Related Classes/Methods**: _None_



### External CellTypist tool

An external tool used for cell type annotation via CellTypist.





**Related Classes/Methods**: _None_







### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
159 changes: 159 additions & 0 deletions .codeboarding/Data_Ingestion_Preprocessing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
```mermaid

graph LR

ENACT_Pipeline_Core["ENACT Pipeline Core"]

Image_Loader["Image Loader"]

Cell_Segmenter["Cell Segmenter"]

Visium_HD_Data_Loader["Visium HD Data Loader"]

Bin_Polygon_Generator["Bin Polygon Generator"]

ENACT_Pipeline_Core -- "orchestrates" --> Image_Loader

ENACT_Pipeline_Core -- "orchestrates" --> Cell_Segmenter

ENACT_Pipeline_Core -- "orchestrates" --> Visium_HD_Data_Loader

ENACT_Pipeline_Core -- "orchestrates" --> Bin_Polygon_Generator

Image_Loader -- "provides data to" --> ENACT_Pipeline_Core

ENACT_Pipeline_Core -- "provides data to" --> Cell_Segmenter

Cell_Segmenter -- "provides data to" --> ENACT_Pipeline_Core

Visium_HD_Data_Loader -- "provides data to" --> ENACT_Pipeline_Core

ENACT_Pipeline_Core -- "provides data to" --> Bin_Polygon_Generator

```

[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org)



## Component Details



The ENACT Pipeline Core acts as the central orchestrator and data mediator, performing intermediate processing steps between the main functional components.



### ENACT Pipeline Core

The central orchestrator of the ENACT pipeline, responsible for coordinating the execution of all major processing steps. It manages data flow between components, performs crucial intermediate data transformations (e.g., image normalization, data structuring, chunking), and ensures that outputs from one stage are correctly prepared as inputs for the next. This component embodies the core logic and control flow of the entire analysis.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:run_enact` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:normalize_image` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:convert_stardist_output_to_gdf` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:expand_nuclei_with_voronoi` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:split_df_to_chunks` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:generate_bins_gdf` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:assign_bins_to_cells` (0:0)</a>





### Image Loader

Manages the loading of Whole Slide Images (WSI) and initial cropping based on tissue position data, adapting to different image types (H&E, IF). It provides the raw, cropped image and the determined crop boundaries to the ENACT Pipeline Core for further processing.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:load_image` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:get_image_crop_bounds` (0:0)</a>





### Cell Segmenter

Executes cell nucleus segmentation using the configured StarDist model, generating precise labels and polygons for individual cells from a pre-processed (normalized) image. It provides these raw segmentation results (labels and polygons) to the ENACT Pipeline Core for conversion and spatial analysis.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:segment_cells` (0:0)</a>





### Visium HD Data Loader

Responsible for ingesting raw Visium HD spatial transcriptomics data (H5 gene expression and tissue position files). It aligns spatial coordinates with the cropped image frame, performs optional destriping, and selects highly variable genes, preparing the data as an AnnData object and providing it, along with the calculated bin size, to the ENACT Pipeline Core.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:load_visiumhd_dataset` (0:0)</a>

- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:destripe` (0:0)</a>





### Bin Polygon Generator

Transforms spatial bin coordinates and bin size into geometric representations (Shapely polygons or points) based on the configured representation type. This component is utilized by the ENACT Pipeline Core (specifically by the generate_bins_gdf method) to create the spatial context for the transcriptomic data, enabling accurate mapping and analysis of gene expression patterns.





**Related Classes/Methods**:



- <a href="https://github.com/Sanofi-Public/enact-pipeline/blob/master/src/enact/pipeline.py#L0-L0" target="_blank" rel="noopener noreferrer">`enact.pipeline.ENACT:generate_bin_polys` (0:0)</a>









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
Loading