# pivotbio/proven40-moa-paper-code architecture

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

- Interactive diagram: https://gitdiagram.com/pivotbio/proven40-moa-paper-code
- Repository: https://github.com/pivotbio/proven40-moa-paper-code

## Overview

##### Project type and purpose
- This is not a typical client‐server or microservice system but a reproducible data-analysis pipeline for a scientific paper. Its goal is to take raw experimental datasets (lab assays, field trials, on-farm trials) and produce figures and tables that support the study’s findings.

##### File structure
- Top-level files:
- environment.yml – conda specification for Python/R dependencies
- load_environment.R, packages_citations.txt, session_info.txt – R environment bootstrap and reporting
- README.md, LICENSE – documentation and licensing
- Three main directories, each one a self-contained analysis module:
- 1_LAB_ASSAYS
- 2_FIELD_TRIALS
- 3_ONFARM_TRIALS
- Each module contains:
- datasets/ – raw or pre-processed input data (Excel, CSV, RDS)
- *.ipynb – Jupyter notebooks with code cells, sequentially numbered
- *.html – exported notebooks for preview
- figures/ – serialized outputs (e.g., .rds objects or image files)

##### Insights from the README
- The three directories correspond to the three experimental tiers reported in the paper.
- Each analysis is intended to be run in order, within a conda environment named “moa_paper” that combines Python and R kernels.
- Notebooks produce both HTML previews and underlying figures/tables used for the manuscript.

a. Main components
- Processing environment: Conda environment (Python + R) / Jupyter Server
- Analysis notebooks: Three sequential modules of notebooks
- Outputs: Figures and tables stored in each module’s figures folder + HTML previews
- Version control: Git repo with README, environment spec, session info
b. Relationships & data flow
c. Architectural patterns & principles
- Modular separation by experiment type (each module independent)
- Reproducibility via environment specification (environment.yml)
- Sequential, linear data-to-result workflow per module
- Use of literate programming (Jupyter notebooks combining code, narrative, and results)
d. Key technologies & libraries
- Anaconda/conda
- Jupyter notebooks (.ipynb) with Python and R kernels
- R (load_environment.R, .rds outputs)
- Pandas (CSV/Excel ingestion), ggplot2 or matplotlib for plotting
- Git for version control

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Version Control & Documentation
    subgraph "Version Control & Docs"
        README["README.md"]:::docs
        LICENSE["LICENSE"]:::docs
        GITIGNORE[".gitignore"]:::docs
    end

    %% Environment Setup
    subgraph "Environment Setup"
        CondaEnv["Conda Env (environment.yml)"]:::compute
        LoadEnv["load_environment.R"]:::compute
    end

    %% Data Sources
    subgraph "Data Sources"
        LabData["Lab Assays Data"]:::data
        FieldData["Field Trials Data"]:::data
        OnFarmData["On-Farm Trials Data"]:::data
    end

    %% Lab Assays Module
    subgraph "1_LAB_ASSAYS Module"
        D1["datasets/"]:::data
        NB1_00["00_in_vitro.ipynb"]:::notebook
        NB1_01["01_in_planta.ipynb"]:::notebook
        HTML1_00["00_in_vitro.html"]:::output
        HTML1_01["01_in_planta.html"]:::output
        Figures1["figures/"]:::output
    end

    %% Field Trials Module
    subgraph "2_FIELD_TRIALS Module"
        D2["datasets/"]:::data
        NB2_00["00_uwm_d15n_enrichment_dilution.ipynb"]:::notebook
        NB2_01["01_purdue_d15n_natural_abundance.ipynb"]:::notebook
        NB2_02["02_purdue_d15n_plant_n.ipynb"]:::notebook
        NB2_03["03_purdue_yield_response_curves.ipynb"]:::notebook
        NB2_04["04_pivot_bio_qpcr.ipynb"]:::notebook
        NB2_05["05_pivot_bio_plant.ipynb"]:::notebook
        HTML2_00["00_uwm_d15n_enrichment_dilution.html"]:::output
        HTML2_01["01_purdue_d15n_natural_abundance.html"]:::output
        HTML2_02["02_purdue_d15n_plant_n.html"]:::output
        HTML2_03["03_purdue_yield_response_curves.html"]:::output
        HTML2_04["04_pivot_bio_qpcr.html"]:::output
        HTML2_05["05_pivot_bio_plant.html"]:::output
        Figures2["figures/"]:::output
    end

    %% On-Farm Trials Module
    subgraph "3_ONFARM_TRIALS Module"
        D3["datasets/"]:::data
        NB3_00["00_vegetative_plant_traits.ipynb"]:::notebook
        NB3_01["01_yields.ipynb"]:::notebook
        HTML3_00["00_vegetative_plant_traits.html"]:::output
        HTML3_01["01_yields.html"]:::output
        Figures3["figures/"]:::output
    end

    %% Logs
    subgraph "Logs"
        packages["packages_citations.txt"]:::docs
        session["session_info.txt"]:::docs
    end

    %% Connections: Data ingestion
    LabData -->|"reads data"| D1
    FieldData -->|"reads data"| D2
    OnFarmData -->|"reads data"| D3

    %% Connections: Environment to Notebooks
    CondaEnv -->|"provides runtime"| NB1_00
    CondaEnv -->|"provides runtime"| NB1_01
    CondaEnv -->|"provides runtime"| NB2_00
    CondaEnv -->|"provides runtime"| NB2_01
    CondaEnv -->|"provides runtime"| NB2_02
    CondaEnv -->|"provides runtime"| NB2_03
    CondaEnv -->|"provides runtime"| NB2_04
    CondaEnv -->|"provides runtime"| NB2_05
    CondaEnv -->|"provides runtime"| NB3_00
    CondaEnv -->|"provides runtime"| NB3_01

    LoadEnv -->|"boots environment"| NB1_00
    LoadEnv -->|"boots environment"| NB1_01
    LoadEnv -->|"boots environment"| NB2_00
    LoadEnv -->|"boots environment"| NB2_01
    LoadEnv -->|"boots environment"| NB2_02
    LoadEnv -->|"boots environment"| NB2_03
    LoadEnv -->|"boots environment"| NB2_04
    LoadEnv -->|"boots environment"| NB2_05
    LoadEnv -->|"boots environment"| NB3_00
    LoadEnv -->|"boots environment"| NB3_01

    %% Connections: Data folder to notebooks
    D1 --> NB1_00
    D1 --> NB1_01
    D2 --> NB2_00
    D2 --> NB2_01
    D2 --> NB2_02
    D2 --> NB2_03
    D2 --> NB2_04
    D2 --> NB2_05
    D3 --> NB3_00
    D3 --> NB3_01

    %% Connections: Notebooks to Outputs
    NB1_00 -->|"writes preview"| HTML1_00
    NB1_00 -->|"writes figures"| Figures1
    NB1_01 -->|"writes preview"| HTML1_01
    NB1_01 -->|"writes figures"| Figures1

    NB2_00 -->|"writes preview"| HTML2_00
    NB2_01 -->|"writes preview"| HTML2_01
    NB2_02 -->|"writes preview"| HTML2_02
    NB2_03 -->|"writes preview"| HTML2_03
    NB2_04 -->|"writes preview"| HTML2_04
    NB2_05 -->|"writes preview"| HTML2_05
    NB2_00 -->|"writes figures"| Figures2
    NB2_01 -->|"writes figures"| Figures2
    NB2_02 -->|"writes figures"| Figures2
    NB2_03 -->|"writes figures"| Figures2
    NB2_04 -->|"writes figures"| Figures2
    NB2_05 -->|"writes figures"| Figures2

    NB3_00 -->|"writes preview"| HTML3_00
    NB3_01 -->|"writes preview"| HTML3_01
    NB3_00 -->|"writes figures"| Figures3
    NB3_01 -->|"writes figures"| Figures3

    %% Connections: Notebooks to Logs
    NB1_01 -->|"records env"| packages
    NB1_01 -->|"records env"| session
    NB2_05 -->|"records env"| packages
    NB2_05 -->|"records env"| session
    NB3_01 -->|"records env"| packages
    NB3_01 -->|"records env"| session

    %% Click Events
    click CondaEnv "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/environment.yaml"
    click LoadEnv "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/load_environment.R"
    click packages "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/packages_citations.txt"
    click session "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/session_info.txt"
    click GITIGNORE "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/.gitignore"
    click README "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/README.md"
    click LICENSE "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/LICENSE"

    click LabData "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/1_LAB_ASSAYS/datasets/"
    click NB1_00 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/1_LAB_ASSAYS/00_in_vitro.ipynb"
    click NB1_01 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/1_LAB_ASSAYS/01_in_planta.ipynb"
    click HTML1_00 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/1_LAB_ASSAYS/00_in_vitro.html"
    click HTML1_01 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/1_LAB_ASSAYS/01_in_planta.html"
    click Figures1 "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/1_LAB_ASSAYS/figures/"

    click FieldData "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/2_FIELD_TRIALS/datasets/"
    click NB2_00 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/00_uwm_d15n_enrichment_dilution.ipynb"
    click NB2_01 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/01_purdue_d15n_natural_abundance.ipynb"
    click NB2_02 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/02_purdue_d15n_plant_n.ipynb"
    click NB2_03 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/03_purdue_yield_response_curves.ipynb"
    click NB2_04 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/04_pivot_bio_qpcr.ipynb"
    click NB2_05 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/05_pivot_bio_plant.ipynb"
    click HTML2_00 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/00_uwm_d15n_enrichment_dilution.html"
    click HTML2_01 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/01_purdue_d15n_natural_abundance.html"
    click HTML2_02 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/02_purdue_d15n_plant_n.html"
    click HTML2_03 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/03_purdue_yield_response_curves.html"
    click HTML2_04 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/04_pivot_bio_qpcr.html"
    click HTML2_05 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/2_FIELD_TRIALS/05_pivot_bio_plant.html"
    click Figures2 "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/2_FIELD_TRIALS/figures/"

    click OnFarmData "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/3_ONFARM_TRIALS/datasets/"
    click NB3_00 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/3_ONFARM_TRIALS/00_vegetative_plant_traits.ipynb"
    click NB3_01 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/3_ONFARM_TRIALS/01_yields.ipynb"
    click HTML3_00 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/3_ONFARM_TRIALS/00_vegetative_plant_traits.html"
    click HTML3_01 "https://github.com/pivotbio/proven40-moa-paper-code/blob/main/3_ONFARM_TRIALS/01_yields.html"
    click Figures3 "https://github.com/pivotbio/proven40-moa-paper-code/tree/main/3_ONFARM_TRIALS/figures/"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef compute fill:#90EE90,stroke:#333,stroke-width:1px
    classDef notebook fill:#FFA500,stroke:#333,stroke-width:1px
    classDef output fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef docs fill:#D3D3D3,stroke:#333,stroke-width:1px
```
