# cbg-innov/bip architecture

> Architecture diagram of the GitHub repository cbg-innov/bip, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cbg-innov/bip
- Repository: https://github.com/cbg-innov/bip

## Overview

BIP is a containerized DNA-barcoding pipeline: a user supplies raw FASTQ data, a parameter spreadsheet, and a reference library; the run processes reads through clustering, correction and classification to produce per-well barcode tables and reports. The README documents the ordered stages and COI-5P and Illumina-specific options. Only the homopolymer-correction script was sampled, so unsampled subsystem paths and relationships below rely on the README and file tree rather than inspected implementation.

Main entry points: [`Docker/BIP.sh`](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh) (FASTQ merging), [`Docker/bip1_otu-consensus.R`](https://github.com/cbg-innov/bip/blob/main/Docker/bip1_otu-consensus.R) (Consensus building), [`Docker/bip3_barcode_inference.R`](https://github.com/cbg-innov/bip/blob/main/Docker/bip3_barcode_inference.R) (Barcode inference), [`Docker/bip4_reporting.R`](https://github.com/cbg-innov/bip/blob/main/Docker/bip4_reporting.R) (Run reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run orchestration"]
  node_driver["Pipeline runner<br/>[BIP.sh]"]
  node_inputs["Input validation<br/>[BIP.sh]"]
end

subgraph group_reads["Read processing"]
  node_merge["FASTQ merging<br/>[BIP.sh]"]
  node_primer["Primer orientation<br/>[BIP.sh]"]
  node_size["Size filtering<br/>[BIP.sh]"]
  node_demux["Well demultiplexing<br/>[BIP.sh]"]
end

subgraph group_analysis["Sequence analysis"]
  node_otu["OTU clustering"]
  node_consensus["Consensus building"]
  node_indel["Indel correction"]
  node_chimera["Chimera removal<br/>[BIP.sh]"]
  node_reference[("Reference library")]
end

subgraph group_results["Classification and reports"]
  node_taxonomy["Tax assignment<br/>[BIP.sh]"]
  node_inference["Barcode inference"]
  node_bin["BIN matching<br/>[BIP.sh]"]
  node_report["Run reporting<br/>[bip4_reporting.R]"]
  node_outputs["Result files"]
end

node_user(("Data provider"))

node_user -->|"starts run"| node_driver
node_driver -->|"validates inputs"| node_inputs
node_inputs -->|"passes reads"| node_merge
node_merge -->|"passes reads"| node_primer
node_primer -->|"passes reads"| node_size
node_size -->|"passes reads"| node_demux
node_demux -->|"passes reads"| node_otu
node_otu -->|"builds consensus"| node_consensus
node_consensus -->|"passes sequences"| node_indel
node_indel -->|"passes sequences"| node_chimera
node_chimera -->|"passes sequences"| node_taxonomy
node_reference -->|"classifies against"| node_taxonomy
node_taxonomy -->|"informs inference"| node_inference
node_inference -.->|"passes OTUs"| node_bin
node_inference -->|"reports results"| node_report
node_bin -.->|"reports matches"| node_report
node_report -->|"writes results"| node_outputs
node_merge -.->|"skips merge"| node_primer
node_consensus -.->|"skips correction"| node_chimera

click node_driver "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_inputs "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_merge "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_primer "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_size "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_demux "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_otu "https://github.com/cbg-innov/bip/blob/main/Docker/bip1_otu-consensus.R"
click node_consensus "https://github.com/cbg-innov/bip/blob/main/Docker/bip1_otu-consensus.R"
click node_indel "https://github.com/cbg-innov/bip/blob/main/Docker/bip2_homopolymer_error_fix.py"
click node_chimera "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_taxonomy "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_inference "https://github.com/cbg-innov/bip/blob/main/Docker/bip3_barcode_inference.R"
click node_bin "https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh"
click node_report "https://github.com/cbg-innov/bip/blob/main/Docker/bip4_reporting.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_driver,node_inputs toneBlue
class node_merge,node_primer,node_size,node_demux toneAmber
class node_otu,node_consensus,node_indel,node_chimera,node_reference toneMint
class node_taxonomy,node_inference,node_bin,node_report,node_outputs toneRose
class node_user toneIndigo
```

## Components

### Run orchestration

- [Pipeline runner](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- [Input validation](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`

### Read processing

- [FASTQ merging](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- [Primer orientation](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- [Size filtering](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- [Well demultiplexing](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`

### Sequence analysis

- [OTU clustering](https://github.com/cbg-innov/bip/blob/main/Docker/bip1_otu-consensus.R): `Docker/bip1_otu-consensus.R`
- [Consensus building](https://github.com/cbg-innov/bip/blob/main/Docker/bip1_otu-consensus.R): `Docker/bip1_otu-consensus.R`
- [Indel correction](https://github.com/cbg-innov/bip/blob/main/Docker/bip2_homopolymer_error_fix.py): `Docker/bip2_homopolymer_error_fix.py`
- [Chimera removal](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- **Reference library**

### Classification and reports

- [Tax assignment](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- [Barcode inference](https://github.com/cbg-innov/bip/blob/main/Docker/bip3_barcode_inference.R): `Docker/bip3_barcode_inference.R`
- [BIN matching](https://github.com/cbg-innov/bip/blob/main/Docker/BIP.sh): `Docker/BIP.sh`
- [Run reporting](https://github.com/cbg-innov/bip/blob/main/Docker/bip4_reporting.R): `Docker/bip4_reporting.R`
- **Result files**

### Other components

- **Data provider**

## Connections

- Data provider → Pipeline runner: starts run (evidence: `README.md`)
- Pipeline runner → Input validation: validates inputs (evidence: `README.md`)
- Input validation → FASTQ merging: passes reads (evidence: `README.md`)
- FASTQ merging → Primer orientation: passes reads (evidence: `README.md`)
- Primer orientation → Size filtering: passes reads (evidence: `README.md`)
- Size filtering → Well demultiplexing: passes reads (evidence: `README.md`)
- Well demultiplexing → OTU clustering: passes reads (evidence: `README.md`)
- OTU clustering → Consensus building: builds consensus (evidence: `README.md`)
- Consensus building → Indel correction: passes sequences (evidence: `README.md`)
- Indel correction → Chimera removal: passes sequences (evidence: `README.md`)
- Chimera removal → Tax assignment: passes sequences (evidence: `README.md`)
- Reference library → Tax assignment: classifies against (evidence: `README.md`)
- Tax assignment → Barcode inference: informs inference (evidence: `README.md`)
- Barcode inference → BIN matching: passes OTUs
- Barcode inference → Run reporting: reports results (evidence: `README.md`)
- BIN matching → Run reporting: reports matches
- Run reporting → Result files: writes results (evidence: `README.md`)
- FASTQ merging → Primer orientation: skips merge
- Consensus building → Chimera removal: skips correction
