# johnegarza/chromoseq architecture

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

- Interactive diagram: https://gitdiagram.com/johnegarza/chromoseq
- Repository: https://github.com/johnegarza/chromoseq

## Overview

#### Purpose and execution modes
ChromoSeq is a genomics analysis workflow for chromosomal structural variants/translocations and copy-number-related reporting on hg38. Its primary orchestration is WDL, with two deployment modes:
- Local MGI/LSF execution: `Chromoseq.v9.wdl`, configured by `application.new.conf`, launched from CRAM through `LaunchChromoSeqFromCram.sh`.
- Illumina BaseSpace/Cromwell execution: `Chromoseq_basespace.v9.wdl`, launched/monitored by `launch_and_monitor_chromoseq.pl`.

#### Workflow orchestration boundary
`Chromoseq.v9.wdl` is the authoritative local pipeline graph and carries runtime attributes for distributed LSF execution. `Chromoseq_basespace.v9.wdl` is a deployment variant with runtime attributes removed because BaseSpace runs the workflow on one provisioned node/container. `basespace_cromwell.config` is the Cromwell-side infrastructure configuration.

#### BaseSpace application integration
BaseSpace UI inputs and launch command construction are externally managed app metadata:
- `form`
- `callbacks.js`
- `launch_and_monitor_chromoseq.pl`

The launcher bridges MGI operations to BaseSpace CLI/API resources, including prebuilt DRAGEN reference and FASTA app-result identifiers. This is an operational boundary: these files require manual synchronization with the BaseSpace developer portal.

#### Variant and structural-event processing
The workflow’s event-processing/reporting layer is represented by:
- `ChromoSeqReporter.hg38.pl`
- `Downstream.pm`
- `Wildtype.pm`

These Perl components likely consolidate pipeline outputs into chromosome-sequencing results, apply downstream interpretation logic, and identify wild-type/supporting calls. `BlatContigs.pl` and `pslScore.pl` support contig alignment/scoring for structural-event resolution.

#### Read evidence, annotation, and QC enrichment
Post-calling enrichment is implemented through:
- `addReadCountsToVcfCRAM.py`
- `add_annotations_to_table_helper.py`
- `docm_and_coding_indel_selection.pl`

These stages attach CRAM-backed read evidence, annotate result tables, and select clinically relevant coding/DoCM indels. The boundary is between raw caller outputs and report-ready, evidence-bearing variants.

#### Copy-number analysis and reference assets
CNV/coverage analysis relies on R plus committed genomic reference data:
- `runIchorCNA.R`
- `nextera_hg38_500kb_median_normAutosome_median.rds_median.n9.rds`
- `GeneCoverageRegions.bed`

Additional hg38 resources define sequence dictionaries/FASTA indexes, blacklisted regions, gene regions, and known translocation targets: `all_sequences.dict`, `all_sequences.fa.bed.gz`, `hg38.blacklist.merged.bed`, and `ChromoSeq.translocations.fixed.v3.sorted.hg38.bedpe`.

#### Runtime packaging
`Dockerfile` defines the analysis environment expected by workflow tasks. The repository combines WDL orchestration, Perl/Python/R analysis stages, CRAM/FASTA/bed-based genomics inputs, LSF for local distributed execution, and BaseSpace/Cromwell for managed execution.

Main entry points: [`Chromoseq.v9.wdl`](https://github.com/johnegarza/chromoseq/blob/master/Chromoseq.v9.wdl) (Authoritative local workflow), [`Chromoseq_basespace.v9.wdl`](https://github.com/johnegarza/chromoseq/blob/master/Chromoseq_basespace.v9.wdl) (BaseSpace workflow), [`ChromoSeqReporter.hg38.pl`](https://github.com/johnegarza/chromoseq/blob/master/ChromoSeqReporter.hg38.pl) (Event reporting), [`LaunchChromoSeqFromCram.sh`](https://github.com/johnegarza/chromoseq/blob/master/LaunchChromoSeqFromCram.sh) (Local launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_local["Local MGI / LSF"]
  node_cram["Input CRAM<br/>genomic input"]
  node_local_launcher["Local launcher<br/>shell launcher"]
  node_local_config["LSF configuration<br/>runtime config"]
  node_local_wdl{{"Authoritative local workflow<br/>WDL workflow<br/>[Chromoseq.v9.wdl]"}}
end

subgraph group_basespace["BaseSpace / Cromwell"]
  node_basespace_metadata["BaseSpace app metadata<br/>UI and callbacks"]
  node_callbacks["BaseSpace callbacks<br/>JavaScript callbacks<br/>[callbacks.js]"]
  node_basespace_launcher["BaseSpace launcher<br/>Perl launcher"]
  node_basespace_wdl{{"BaseSpace workflow<br/>WDL workflow"}}
  node_cromwell_config["Cromwell infrastructure<br/>Cromwell config"]
end

subgraph group_analysis["Analysis stages"]
  node_event_reporting["Event reporting<br/>Perl reporting layer"]
  node_interpretation["Interpretation logic<br/>Perl modules<br/>[Downstream.pm]"]
  node_contig_resolution["Contig resolution<br/>alignment and scoring<br/>[BlatContigs.pl]"]
  node_read_evidence["CRAM read evidence<br/>Python enrichment"]
  node_annotation["Report annotation<br/>table enrichment"]
  node_clinical_indels["Clinical indel selection<br/>Perl selection"]
  node_cnv["CNV / coverage analysis<br/>R analysis<br/>[runIchorCNA.R]"]
end

subgraph group_references["hg38 reference assets"]
  node_cnv_baseline[("CNV baseline<br/>RDS reference")]
  node_coverage_regions["Gene coverage regions<br/>BED regions"]
  node_structural_targets["Translocation targets<br/>BEDPE targets"]
  node_genome_resources[("hg38 genome resources<br/>FASTA, dictionary and regions<br/>[all_sequences.dict]")]
end

node_container["Analysis environment<br/>container definition"]

node_cram -->|"starts from"| node_local_launcher
node_local_launcher -->|"uses"| node_local_config
node_local_launcher -->|"launches"| node_local_wdl
node_basespace_metadata -->|"drives"| node_callbacks
node_callbacks -->|"invokes"| node_basespace_launcher
node_basespace_launcher -->|"launches and monitors"| node_basespace_wdl
node_cromwell_config -->|"configures execution"| node_basespace_wdl
node_local_wdl -->|"runs tasks in"| node_container
node_basespace_wdl -->|"uses analysis environment"| node_container
node_local_wdl -->|"orchestrates"| node_event_reporting
node_local_wdl -->|"orchestrates"| node_read_evidence
node_local_wdl -->|"orchestrates"| node_cnv
node_basespace_wdl -.->|"deployment variant runs"| node_event_reporting
node_event_reporting -->|"applies"| node_interpretation
node_event_reporting -->|"resolves events with"| node_contig_resolution
node_read_evidence -->|"enriches before"| node_annotation
node_annotation -->|"selects reportable indels"| node_clinical_indels
node_clinical_indels -->|"supplies report-ready calls"| node_event_reporting
node_cnv_baseline -->|"normalization reference"| node_cnv
node_coverage_regions -->|"coverage targets"| node_cnv
node_structural_targets -->|"known targets"| node_contig_resolution
node_genome_resources -->|"genome inputs"| node_local_wdl
node_genome_resources -->|"genome inputs"| node_basespace_wdl

click node_local_launcher "https://github.com/johnegarza/chromoseq/blob/master/LaunchChromoSeqFromCram.sh"
click node_local_config "https://github.com/johnegarza/chromoseq/blob/master/application.new.conf"
click node_local_wdl "https://github.com/johnegarza/chromoseq/blob/master/Chromoseq.v9.wdl"
click node_basespace_metadata "https://github.com/johnegarza/chromoseq/blob/master/form"
click node_callbacks "https://github.com/johnegarza/chromoseq/blob/master/callbacks.js"
click node_basespace_launcher "https://github.com/johnegarza/chromoseq/blob/master/launch_and_monitor_chromoseq.pl"
click node_basespace_wdl "https://github.com/johnegarza/chromoseq/blob/master/Chromoseq_basespace.v9.wdl"
click node_cromwell_config "https://github.com/johnegarza/chromoseq/blob/master/basespace_cromwell.config"
click node_container "https://github.com/johnegarza/chromoseq/blob/master/Dockerfile"
click node_event_reporting "https://github.com/johnegarza/chromoseq/blob/master/ChromoSeqReporter.hg38.pl"
click node_interpretation "https://github.com/johnegarza/chromoseq/blob/master/Downstream.pm"
click node_contig_resolution "https://github.com/johnegarza/chromoseq/blob/master/BlatContigs.pl"
click node_read_evidence "https://github.com/johnegarza/chromoseq/blob/master/addReadCountsToVcfCRAM.py"
click node_annotation "https://github.com/johnegarza/chromoseq/blob/master/add_annotations_to_table_helper.py"
click node_clinical_indels "https://github.com/johnegarza/chromoseq/blob/master/docm_and_coding_indel_selection.pl"
click node_cnv "https://github.com/johnegarza/chromoseq/blob/master/runIchorCNA.R"
click node_cnv_baseline "https://github.com/johnegarza/chromoseq/blob/master/nextera_hg38_500kb_median_normAutosome_median.rds_median.n9.rds"
click node_coverage_regions "https://github.com/johnegarza/chromoseq/blob/master/GeneCoverageRegions.bed"
click node_structural_targets "https://github.com/johnegarza/chromoseq/blob/master/ChromoSeq.translocations.fixed.v3.sorted.hg38.bedpe"
click node_genome_resources "https://github.com/johnegarza/chromoseq/blob/master/all_sequences.dict"

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_cram,node_local_launcher,node_local_config,node_local_wdl toneBlue
class node_basespace_metadata,node_callbacks,node_basespace_launcher,node_basespace_wdl,node_cromwell_config toneAmber
class node_event_reporting,node_interpretation,node_contig_resolution,node_read_evidence,node_annotation,node_clinical_indels,node_cnv toneMint
class node_cnv_baseline,node_coverage_regions,node_structural_targets,node_genome_resources toneRose
class node_container toneNeutral
```

## Components

### Local MGI / LSF

- **Input CRAM**: genomic input
- [Local launcher](https://github.com/johnegarza/chromoseq/blob/master/LaunchChromoSeqFromCram.sh): shell launcher · `LaunchChromoSeqFromCram.sh`
- [LSF configuration](https://github.com/johnegarza/chromoseq/blob/master/application.new.conf): runtime config · `application.new.conf`
- [Authoritative local workflow](https://github.com/johnegarza/chromoseq/blob/master/Chromoseq.v9.wdl): WDL workflow · Distributed LSF pipeline graph and task runtime attributes. · `Chromoseq.v9.wdl`

### BaseSpace / Cromwell

- [BaseSpace app metadata](https://github.com/johnegarza/chromoseq/blob/master/form): UI and callbacks · Must stay synchronized with the BaseSpace developer portal. · `form`
- [BaseSpace callbacks](https://github.com/johnegarza/chromoseq/blob/master/callbacks.js): JavaScript callbacks · `callbacks.js`
- [BaseSpace launcher](https://github.com/johnegarza/chromoseq/blob/master/launch_and_monitor_chromoseq.pl): Perl launcher · Bridges MGI operations to BaseSpace CLI/API resources. · `launch_and_monitor_chromoseq.pl`
- [BaseSpace workflow](https://github.com/johnegarza/chromoseq/blob/master/Chromoseq_basespace.v9.wdl): WDL workflow · Single-node deployment variant without task runtime attributes. · `Chromoseq_basespace.v9.wdl`
- [Cromwell infrastructure](https://github.com/johnegarza/chromoseq/blob/master/basespace_cromwell.config): Cromwell config · `basespace_cromwell.config`

### Analysis stages

- [Event reporting](https://github.com/johnegarza/chromoseq/blob/master/ChromoSeqReporter.hg38.pl): Perl reporting layer · Consolidates structural-event outputs into chromosome-sequencing results. · `ChromoSeqReporter.hg38.pl`
- [Interpretation logic](https://github.com/johnegarza/chromoseq/blob/master/Downstream.pm): Perl modules · Applies downstream and wild-type/supporting-call logic. · `Downstream.pm`
- [Contig resolution](https://github.com/johnegarza/chromoseq/blob/master/BlatContigs.pl): alignment and scoring · `BlatContigs.pl`
- [CRAM read evidence](https://github.com/johnegarza/chromoseq/blob/master/addReadCountsToVcfCRAM.py): Python enrichment · `addReadCountsToVcfCRAM.py`
- [Report annotation](https://github.com/johnegarza/chromoseq/blob/master/add_annotations_to_table_helper.py): table enrichment · `add_annotations_to_table_helper.py`
- [Clinical indel selection](https://github.com/johnegarza/chromoseq/blob/master/docm_and_coding_indel_selection.pl): Perl selection · `docm_and_coding_indel_selection.pl`
- [CNV / coverage analysis](https://github.com/johnegarza/chromoseq/blob/master/runIchorCNA.R): R analysis · `runIchorCNA.R`

### hg38 reference assets

- [CNV baseline](https://github.com/johnegarza/chromoseq/blob/master/nextera_hg38_500kb_median_normAutosome_median.rds_median.n9.rds): RDS reference · `nextera_hg38_500kb_median_normAutosome_median.rds_median.n9.rds`
- [Gene coverage regions](https://github.com/johnegarza/chromoseq/blob/master/GeneCoverageRegions.bed): BED regions · `GeneCoverageRegions.bed`
- [Translocation targets](https://github.com/johnegarza/chromoseq/blob/master/ChromoSeq.translocations.fixed.v3.sorted.hg38.bedpe): BEDPE targets · `ChromoSeq.translocations.fixed.v3.sorted.hg38.bedpe`
- [hg38 genome resources](https://github.com/johnegarza/chromoseq/blob/master/all_sequences.dict): FASTA, dictionary and regions · Sequence indexes, blacklist, and genomic region assets. · `all_sequences.dict`

### Other components

- [Analysis environment](https://github.com/johnegarza/chromoseq/blob/master/Dockerfile): container definition · `Dockerfile`

## Connections

- Input CRAM → Local launcher: starts from
- Local launcher → LSF configuration: uses
- Local launcher → Authoritative local workflow: launches
- BaseSpace app metadata → BaseSpace callbacks: drives
- BaseSpace callbacks → BaseSpace launcher: invokes
- BaseSpace launcher → BaseSpace workflow: launches and monitors
- Cromwell infrastructure → BaseSpace workflow: configures execution
- Authoritative local workflow → Analysis environment: runs tasks in
- BaseSpace workflow → Analysis environment: uses analysis environment
- Authoritative local workflow → Event reporting: orchestrates
- Authoritative local workflow → CRAM read evidence: orchestrates
- Authoritative local workflow → CNV / coverage analysis: orchestrates
- BaseSpace workflow → Event reporting: deployment variant runs
- Event reporting → Interpretation logic: applies
- Event reporting → Contig resolution: resolves events with
- CRAM read evidence → Report annotation: enriches before
- Report annotation → Clinical indel selection: selects reportable indels
- Clinical indel selection → Event reporting: supplies report-ready calls
- CNV baseline → CNV / coverage analysis: normalization reference
- Gene coverage regions → CNV / coverage analysis: coverage targets
- Translocation targets → Contig resolution: known targets
- hg38 genome resources → Authoritative local workflow: genome inputs
- hg38 genome resources → BaseSpace workflow: genome inputs
