# javiersdr/co-expression_analysis architecture

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

- Interactive diagram: https://gitdiagram.com/javiersdr/co-expression_analysis
- Repository: https://github.com/javiersdr/co-expression_analysis

## Overview

##### Project type and purpose
- This is a bioinformatics data-analysis pipeline (not a web app or service).
- Its goal is to perform gene co-expression analysis using two methods: WGCNA and Mfuzz, orchestrated via R Markdown notebooks.

##### File structure
- Top-level R Markdown workflows:
- Co-expression.Rmd – likely the master pipeline combining both methods
- WGCNA.Rmd – dedicated to WGCNA network analysis
- Mfuzz.Rmd – dedicated to fuzzy clustering with Mfuzz
- configure_WGCNA.R – configuration script where users set paths and parameters for WGCNA
- example/ – contains test input data files:
- CTFnormalisedCPMs-*.tsv – expression matrix
- trait_data.tsv – sample traits for network‐trait correlation
- README.md – high-level overview and instructions to adapt the workflow

##### README for additional insights
- It confirms this is “a workflow for gene co-expression analysis with WGCNA and Mfuzz.”
- It instructs users to adjust configure_WGCNA.R before running the example.

a. Main components
- Input Data (example TSVs, user-provided expression and trait data)
- Configuration Layer (configure_WGCNA.R)
- Processing Engines (R with these key packages: WGCNA, Mfuzz, tidyverse)
- R Markdown Workflows (Co-expression.Rmd, WGCNA.Rmd, Mfuzz.Rmd)
- Outputs (network modules, cluster assignments, plots, tables)
b. Relationships & interactions
1. User edits configure_WGCNA.R → defines file paths & parameters
2. R Markdown files source configure_WGCNA.R → ingest Input Data
3. WGCNA.Rmd module:
– Pre-processing → adjacency calculation → module detection → module-trait correlations
4. Mfuzz.Rmd module:
– Data standardization → fuzzy c-means clustering → cluster profiles
5. Co-expression.Rmd:
– Calls WGCNA.Rmd and Mfuzz.Rmd in sequence (or integrates their outputs)
6. Final outputs: reports, plots, tables
c. Architectural patterns & principles
- Pipeline pattern: sequential data transformation steps
- Modularization: separate notebooks for each analysis phase
- Configuration abstraction: one script for all environment/parameter settings
d. Key technologies/frameworks
- R / RStudio environment
- R packages: WGCNA, Mfuzz, knitr/rmarkdown, tidyverse

##### Putting it all together
- Merge outputs from WGCNA.Rmd and Mfuzz.Rmd into Co-expression.Rmd if it integrates them

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::external
    User --> Script["configure_WGCNA.R"]:::script

    subgraph "Input Data"
        direction TB
        Input1["CTFnormalisedCPMs-2024-11-26_09.36.30.tsv"]:::dataStore
        Input2["trait_data.tsv"]:::dataStore
    end

    Script --> WGCNA["WGCNA Module\n(WGCNA.Rmd)"]:::workflow
    Script --> Mfuzz["Mfuzz Module\n(Mfuzz.Rmd)"]:::workflow

    Input1 --> WGCNA
    Input2 --> WGCNA
    Input1 --> Mfuzz
    Input2 --> Mfuzz

    WGCNA -->|"modules & correlations"| Coexpr["Co-expression Pipeline\n(Co-expression.Rmd)"]:::workflow
    Mfuzz -->|"clusters & profiles"| Coexpr

    Coexpr --> Outputs["Outputs\n(plots, tables, reports)"]:::output

    Doc["README.md"]:::doc

    click Input1 "https://github.com/javiersdr/co-expression_analysis/blob/main/example/CTFnormalisedCPMs-2024-11-26_09.36.30.tsv"
    click Input2 "https://github.com/javiersdr/co-expression_analysis/blob/main/example/trait_data.tsv"
    click Script "https://github.com/javiersdr/co-expression_analysis/blob/main/configure_WGCNA.R"
    click WGCNA "https://github.com/javiersdr/co-expression_analysis/blob/main/WGCNA.Rmd"
    click Mfuzz "https://github.com/javiersdr/co-expression_analysis/blob/main/Mfuzz.Rmd"
    click Coexpr "https://github.com/javiersdr/co-expression_analysis/blob/main/Co-expression.Rmd"
    click Doc "https://github.com/javiersdr/co-expression_analysis/blob/main/README.md"

    classDef dataStore fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef script fill:#90EE90,stroke:#333,stroke-width:1px
    classDef workflow fill:#90EE90,stroke:#333,stroke-width:1px
    classDef process fill:#FFA500,stroke:#333,stroke-width:1px
    classDef output fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef doc fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#333,stroke-width:1px
```
