# parklab/xtea architecture

> Architecture diagram of the GitHub repository parklab/xtea, 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/parklab/xtea
- Repository: https://github.com/parklab/xtea

## Overview

xTea analyzes aligned sequencing reads to identify and characterize transposable-element insertions. Its principal workflow takes sample and alignment lists plus reference and repeat annotations, locates candidate sites, filters and characterizes them, and produces call outputs. The graph also preserves documented data modes and downstream capabilities such as genotyping, transduction analysis, somatic/mosaic calling, joint calling, and visualization. Edges reflect README statements or relationships in the supplied SOURCE INDEX; unsampled details are not inferred.

Main entry points: [`xtea/x_TEA_main.py`](https://github.com/parklab/xtea/blob/master/xtea/x_TEA_main.py) (Analysis driver), [`xtea/gnrt_pipeline_local.py`](https://github.com/parklab/xtea/blob/master/xtea/gnrt_pipeline_local.py) (Pipeline setup), [`xtea/x_TEI_locator.py`](https://github.com/parklab/xtea/blob/master/xtea/x_TEI_locator.py) (Candidate locator), [`xtea/x_clip_disc_filter.py`](https://github.com/parklab/xtea/blob/master/xtea/x_clip_disc_filter.py) (Clip-disc filtering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and setup"]
  node_sequencing["Sequencing alignments"]
  node_reference["Reference genome"]
  node_repeatlib["Repeat annotations"]
  node_geneann["Gene annotation"]
  node_pipeline["Pipeline setup"]
end

subgraph group_detection["Insertion detection"]
  node_driver["Analysis driver<br/>[x_TEA_main.py]"]
  node_locator["Candidate locator<br/>[x_TEI_locator.py]"]
  node_sitecluster["Site clustering"]
  node_readalign["Read alignment access<br/>[x_alignments.py]"]
end

subgraph group_analysis["Characterization"]
  node_clipfilter["Clip-disc filtering"]
  node_assembly["Local assembly"]
  node_transduction["Transduction analysis<br/>[x_transduction.py]"]
  node_orphan["Orphan transduction"]
  node_genotype["Genotype features"]
  node_annotation["Repeat annotation<br/>[x_annotation.py]"]
  node_referenceops["Reference operations<br/>[x_reference.py]"]
end

subgraph group_outputs["Calling and outputs"]
  node_postfilter["Post-filtering<br/>[x_post_filter.py]"]
  node_somatic["Somatic calling"]
  node_mosaic["Mosaic calling"]
  node_joint["Joint calling<br/>[x_joint_calling.py]"]
  node_vcf["VCF generation<br/>[x_gvcf.py]"]
  node_visualization["IGV support<br/>[x_igv.py]"]
  node_results["Insertion call results"]
end

node_researcher(("Analyst"))

node_researcher -->|"configures run"| node_pipeline
node_sequencing -->|"provides alignments"| node_pipeline
node_reference -->|"provides genome"| node_pipeline
node_repeatlib -->|"provides repeats"| node_pipeline
node_geneann -->|"provides genes"| node_pipeline
node_pipeline -->|"generates run for"| node_driver
node_driver -->|"runs detection"| node_locator
node_locator -->|"reads alignments"| node_readalign
node_locator -->|"uses site clustering"| node_sitecluster
node_driver -->|"filters candidates"| node_clipfilter
node_driver -->|"runs assembly"| node_assembly
node_driver -->|"uses reference operations"| node_referenceops
node_driver -->|"collects genotypes"| node_genotype
node_clipfilter -->|"uses repeat annotation"| node_annotation
node_clipfilter -->|"checks transduction"| node_transduction
node_transduction -->|"generates flank regions"| node_referenceops
node_orphan -->|"extends analysis"| node_transduction
node_driver -->|"runs somatic calling"| node_somatic
node_driver -->|"runs mosaic calling"| node_mosaic
node_driver -->|"runs joint calling"| node_joint
node_driver -->|"filters calls"| node_postfilter
node_driver -.->|"supports gVCF output"| node_vcf
node_driver -->|"supports visualization"| node_visualization
node_postfilter -.->|"writes filtered calls"| node_results

click node_pipeline "https://github.com/parklab/xtea/blob/master/xtea/gnrt_pipeline_local.py"
click node_driver "https://github.com/parklab/xtea/blob/master/xtea/x_TEA_main.py"
click node_locator "https://github.com/parklab/xtea/blob/master/xtea/x_TEI_locator.py"
click node_sitecluster "https://github.com/parklab/xtea/blob/master/xtea/x_intermediate_sites.py"
click node_readalign "https://github.com/parklab/xtea/blob/master/xtea/x_alignments.py"
click node_clipfilter "https://github.com/parklab/xtea/blob/master/xtea/x_clip_disc_filter.py"
click node_assembly "https://github.com/parklab/xtea/blob/master/xtea/x_local_assembly.py"
click node_transduction "https://github.com/parklab/xtea/blob/master/xtea/x_transduction.py"
click node_orphan "https://github.com/parklab/xtea/blob/master/xtea/x_orphan_transduction.py"
click node_genotype "https://github.com/parklab/xtea/blob/master/xtea/x_genotype_feature.py"
click node_annotation "https://github.com/parklab/xtea/blob/master/xtea/x_annotation.py"
click node_referenceops "https://github.com/parklab/xtea/blob/master/xtea/x_reference.py"
click node_postfilter "https://github.com/parklab/xtea/blob/master/xtea/x_post_filter.py"
click node_somatic "https://github.com/parklab/xtea/blob/master/xtea/x_somatic_calling.py"
click node_mosaic "https://github.com/parklab/xtea/blob/master/xtea/x_mosaic_calling.py"
click node_joint "https://github.com/parklab/xtea/blob/master/xtea/x_joint_calling.py"
click node_vcf "https://github.com/parklab/xtea/blob/master/xtea/x_gvcf.py"
click node_visualization "https://github.com/parklab/xtea/blob/master/xtea/x_igv.py"

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_sequencing,node_reference,node_repeatlib,node_geneann,node_pipeline toneBlue
class node_driver,node_locator,node_sitecluster,node_readalign toneAmber
class node_clipfilter,node_assembly,node_transduction,node_orphan,node_genotype,node_annotation,node_referenceops toneMint
class node_postfilter,node_somatic,node_mosaic,node_joint,node_vcf,node_visualization,node_results toneRose
class node_researcher toneIndigo
```

## Components

### Inputs and setup

- **Sequencing alignments**
- **Reference genome**
- **Repeat annotations**
- **Gene annotation**
- [Pipeline setup](https://github.com/parklab/xtea/blob/master/xtea/gnrt_pipeline_local.py): `xtea/gnrt_pipeline_local.py`

### Insertion detection

- [Analysis driver](https://github.com/parklab/xtea/blob/master/xtea/x_TEA_main.py): `xtea/x_TEA_main.py`
- [Candidate locator](https://github.com/parklab/xtea/blob/master/xtea/x_TEI_locator.py): `xtea/x_TEI_locator.py`
- [Site clustering](https://github.com/parklab/xtea/blob/master/xtea/x_intermediate_sites.py): `xtea/x_intermediate_sites.py`
- [Read alignment access](https://github.com/parklab/xtea/blob/master/xtea/x_alignments.py): `xtea/x_alignments.py`

### Characterization

- [Clip-disc filtering](https://github.com/parklab/xtea/blob/master/xtea/x_clip_disc_filter.py): `xtea/x_clip_disc_filter.py`
- [Local assembly](https://github.com/parklab/xtea/blob/master/xtea/x_local_assembly.py): `xtea/x_local_assembly.py`
- [Transduction analysis](https://github.com/parklab/xtea/blob/master/xtea/x_transduction.py): `xtea/x_transduction.py`
- [Orphan transduction](https://github.com/parklab/xtea/blob/master/xtea/x_orphan_transduction.py): `xtea/x_orphan_transduction.py`
- [Genotype features](https://github.com/parklab/xtea/blob/master/xtea/x_genotype_feature.py): `xtea/x_genotype_feature.py`
- [Repeat annotation](https://github.com/parklab/xtea/blob/master/xtea/x_annotation.py): `xtea/x_annotation.py`
- [Reference operations](https://github.com/parklab/xtea/blob/master/xtea/x_reference.py): `xtea/x_reference.py`

### Calling and outputs

- [Post-filtering](https://github.com/parklab/xtea/blob/master/xtea/x_post_filter.py): `xtea/x_post_filter.py`
- [Somatic calling](https://github.com/parklab/xtea/blob/master/xtea/x_somatic_calling.py): `xtea/x_somatic_calling.py`
- [Mosaic calling](https://github.com/parklab/xtea/blob/master/xtea/x_mosaic_calling.py): `xtea/x_mosaic_calling.py`
- [Joint calling](https://github.com/parklab/xtea/blob/master/xtea/x_joint_calling.py): `xtea/x_joint_calling.py`
- [VCF generation](https://github.com/parklab/xtea/blob/master/xtea/x_gvcf.py): `xtea/x_gvcf.py`
- [IGV support](https://github.com/parklab/xtea/blob/master/xtea/x_igv.py): `xtea/x_igv.py`
- **Insertion call results**

### Other components

- **Analyst**

## Connections

- Analyst → Pipeline setup: configures run
- Sequencing alignments → Pipeline setup: provides alignments
- Reference genome → Pipeline setup: provides genome
- Repeat annotations → Pipeline setup: provides repeats
- Gene annotation → Pipeline setup: provides genes
- Pipeline setup → Analysis driver: generates run for
- Analysis driver → Candidate locator: runs detection (evidence: `xtea/x_TEA_main.py`)
- Candidate locator → Read alignment access: reads alignments (evidence: `xtea/x_TEI_locator.py`)
- Candidate locator → Site clustering: uses site clustering (evidence: `xtea/x_TEI_locator.py`)
- Analysis driver → Clip-disc filtering: filters candidates (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → Local assembly: runs assembly (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → Reference operations: uses reference operations (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → Genotype features: collects genotypes (evidence: `xtea/x_TEA_main.py`)
- Clip-disc filtering → Repeat annotation: uses repeat annotation (evidence: `xtea/x_clip_disc_filter.py`)
- Clip-disc filtering → Transduction analysis: checks transduction (evidence: `xtea/x_clip_disc_filter.py`)
- Transduction analysis → Reference operations: generates flank regions (evidence: `xtea/x_transduction.py`)
- Orphan transduction → Transduction analysis: extends analysis (evidence: `xtea/x_orphan_transduction.py`)
- Analysis driver → Somatic calling: runs somatic calling (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → Mosaic calling: runs mosaic calling (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → Joint calling: runs joint calling (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → Post-filtering: filters calls (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → VCF generation: supports gVCF output (evidence: `xtea/x_TEA_main.py`)
- Analysis driver → IGV support: supports visualization (evidence: `xtea/x_TEA_main.py`)
- Post-filtering → Insertion call results: writes filtered calls
