# gauravj49/scrnaseq architecture

> Architecture diagram of the GitHub repository gauravj49/scrnaseq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gauravj49/scrnaseq
- Repository: https://github.com/gauravj49/scrnaseq

## Overview

##### Main Components
- Data Ingestion and Raw Data Input: This would include all the raw input (for example, outputs from CellRanger, transcriptome files, etc.). Many scripts (with “cellLine”, “StomachBaseline”, “custom_transcriptome”, “mitGFP”, etc. in their names) indicate differing experimental protocols and raw data sources.
- Preprocessing Pipeline: Group together the preprocessing scripts (e.g. “01.x_xx_preprocessing_usage.sh” from multiple pilots) as an initial stage. This stage might include quality control and filtering.
- Normalization and Imputation: The R scripts (such as “R_norm.R” and others dealing with imputation/normalization) are dedicated to processing the raw counts.
- Clustering, Tissue and Tumor Identification: Several scripts (including “clustering_usage.sh,” “tissue_preprocessing_usage.sh” and “tumor_identification_usage.sh”) indicate stages where the data are clustered and assigned to sample groups.
- Annotation: Components for cell-type or sample annotation appear (e.g. “R_annotate_cells_using_singleR.R” and “R_interactive_singleR_annotation.R”), which call external annotation libraries (SingleR).
- Integration and Cross-Species Mapping: The presence of “R_convert_human_to_mouse_genes.R” suggests a layer of integrating data between human/mouse systems.
- Visualization and Reporting: The “simple-example-chart-apps-master” folder (with multiple Dash applications – 3d plots, bar plots, scatter plots, etc.) seems to be responsible for displaying the results interactively.

##### Representing the Data Flow
- Next, indicate the flow from preprocessing into normalization/imputation and then onward into clustering.
- From the clustering stage, have branches that go to tissue/tumor identification and cell annotation.
- Annotation and integration modules (for example, cross-species mapping) to the visualization layer.

##### Important Interactions and Technologies
- Mention integration with external tools: “cellRanger” (via usage scripts), “scanorama”, “TrVAE” (a deep learning tool for integration) and perhaps “seurat” (as implied by related CSV outputs).
- For visualization, note that the Dash apps (built on Python’s Plotly Dash) provide interactive reporting.

##### Architectural Patterns/Design Principles
- The project follows a pipeline architecture. Each stage (ingestion, preprocessing, analytics, visualization) is a discrete component with defined inputs and outputs.
- There is an emphasis on reproducibility with versioned backups and “usage_extra” directories.
- Modular design: separate directories for different tasks (R scripts vs. Python modules) and clear naming conventions that denote pipeline steps.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Data Processing Pipeline"
        Raw("Raw Data Input & Tool Invocation"):::shell
        Prep("Preprocessing Pipeline"):::shell
        Norm("Normalization & Imputation"):::R
        Clust("Clustering & Downstream Analysis"):::shell
        Annot("Annotation (SingleR)"):::R
        Integr("Integration & Cross-Species Mapping"):::R
        Viz("Visualization & Reporting (Dash Apps)"):::python

        Raw -->|"step"| Prep
        Prep -->|"step"| Norm
        Norm -->|"step"| Clust
        Clust -->|"branch"| Annot
        Clust -->|"branch"| Integr
        Annot -->|"result"| Viz
        Integr -->|"result"| Viz
    end

    Backup("Backup & Versioning"):::backup

    %% Archival connections (dashed)
    Prep -.-> Backup
    Norm -.-> Backup
    Clust -.-> Backup
    Annot -.-> Backup
    Integr -.-> Backup

    %% Click Events
    click Raw "https://github.com/gauravj49/scrnaseq/blob/master/01.2.1_ashish_manec_cellLine_10x947_usage.sh"
    click Prep "https://github.com/gauravj49/scrnaseq/blob/master/scripts/usage_extra/01.1.1_ashish_manec_pilot1_preprocessing_usage.sh"
    click Norm "https://github.com/gauravj49/scrnaseq/blob/master/scripts/R_norm.R"
    click Clust "https://github.com/gauravj49/scrnaseq/blob/master/scripts/backup/clustering_usage.sh"
    click Annot "https://github.com/gauravj49/scrnaseq/blob/master/scripts/R_annotate_cells_using_singleR.R"
    click Integr "https://github.com/gauravj49/scrnaseq/blob/master/scripts/R_convert_human_to_mouse_genes.R"
    click Viz "https://github.com/gauravj49/scrnaseq/tree/master/scripts/simple-example-chart-apps-master"
    click Backup "https://github.com/gauravj49/scrnaseq/tree/master/scripts/backup"

    %% Styles
    classDef shell fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef R fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef python fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef backup fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
