Metadata-Version: 2.4
Name: ReAnnota
Version: 0.1.0
Summary: Cyanobacteria genome annotation enhancement pipeline
Project-URL: Homepage, https://https://github.com/Pazis/ReAnnota/tree/master
Project-URL: Repository, https://https://github.com/Pazis/ReAnnota/tree/master
Author-email: Aggelos Pazis <pazisangel@bio.auth.gr>, Efthymios Parisis <eparisis@bio.auth.gr>
License-File: LICENCE
Requires-Python: >=3.8
Requires-Dist: biopython>=1.82
Requires-Dist: demjson3>=3.0
Requires-Dist: matplotlib>=3.7.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: pandas>=2.1.0
Requires-Dist: python-circos>=0.3.0
Requires-Dist: requests>=2.31.0
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: mypy>=1.5.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# ReAnnota

<img align="right" width="180" height="180" src="docs/ReAnnota-logo.png">

## Introduction

**ReAnnota** is a Python pipeline initially developed for enhancing cyanobacteria genome annotations by merging results from multiple annotation tools (Bakta, EggNOG, InterPro, antiSMASH, Pseudogenefinder) into a final Gff file.

## Usage

### Setup

To run `ReAnnota` ,the required dependencies must first be downloaded. We reccomend using `uv`:

```bash
uv .venv
source .venv/bin/activate
uv pip install e.
```
### Input files

| **Tool / Input** | **File Description** |
|------------------|----------------------|
| **Bakta** | GBFF file (`.gbff`) generated by annotation tool *(required)* |
| **Output** | Output GBFF file path *(required)* |
| **EggNOG** | Annotation file in TSV format (`.tsv`) |
| **InterProScan** | Annotation file in GFF3 format (`.gff3`) |
| **antiSMASH** | regions file in JS format (`.js`) |
| **Pseudofinder** | Pseudofinder file in GFF format (`.gff`) |
| **Gecco** | csv containing all Gecco produced cluster files in GenBank format (`.gbk`) |
| **GFF comparison** | Gff file (`.gff`) produced by annotation tool |


### Running ReAnnota

Running `ReAnnota` with the `--help` option will display th help message:

```angular2html
 Genome annotation enhancement pipeline                           
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --version  -v        Print the current tool version and exit.                │
│ --help     -h        Show this message and exit.                             │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ annotate   Run the genome annotation enhancement pipeline.                   │
╰──────────────────────────────────────────────────────────────────────────────╯
```
Running the command `annotate` with the `--help` option will display th help message:

```angular2html
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --gbff-input         -gbi      FILE                  Input GBFF file      │
│                                                         generated by Bakta.  │
│                                                         [required]           │
│ *  --output             -o        FILE                  Output GBFF file     │
│                                                         path.                │
│                                                         [required]           │
│    --egg-input          -ei       FILE                  Input EggNOG         │
│                                                         annotation file      │
│                                                         (.tsv).              │
│    --ipr-input          -ii       FILE                  Input InterPro       │
│                                                         annotation file      │
│                                                         (.gff3).             │
│    --antismash-input    -ai       FILE                  Input antiSMASH      │
│                                                         annotation file      │
│                                                         (.json).             │
│    --pseudofinder-inp…  -pi       FILE                  Input Pseudofinder   │
│                                                         annotation file      │
│                                                         (.gff).              │
│    --gecco-input        -pi       FILE                  Input Gecco          │
│                                                         annotation file      │
│                                                         (.gbk).              │
│    --gff-input          -gfi      FILE                  Input GFF file for   │
│                                                         comparison.          │
│    --log-file           -l        FILE                  Optional log file    │
│                                                         path. If not         │
│                                                         provided, will be    │
│                                                         created in output    │
│                                                         directory.           │
│    --log-level                    [debug|info|warning|  Set the desired log  │
│                                   error|critical]       level.               │
│                                                         [default: INFO]      │
│    --circos                                             Generate Circos      │
│                                                         visualization.       │
│    --compare                                            Generate gff         │
│                                                         comparison file      │
│    --help               -h                              Show this message    │
│                                                         and exit.            │
╰──────────────────────────────────────────────────────────────────────────────╯
```

Now you can run the pipeline using :

```bash
reannota annotate \
    --egg-input eggnog_input \
    --ipr-input interpro_input \
    --gbff-input input_annotation.gbff \
    --gff-input input_annotation.gff \
    --output  <OUTDIR>\
    --antismash-input antismash_input \
    --pseudofinder-input pseudofinder_input \
    --gecco-input gecco_input \
    --compare \
    --circos \
```


## Outputs

The output folder structure will look as follows:

```
└─<OUTDIR>
   ├─results
   │  |─Enhanced.gff3
   |  |─Enhanced.gbff
   ├─tool_hits
   │  |─Interpro_hits.gff3
   │  |─eggNOG_hits.gff3
   ├─bgcs
   │  |─combined_gecco_clusters.gbk
   |─compare (optional)
   |  |─gff_comparison.csv
   |─visualisation (optional)
   |  |─Circos_plot_starter.png
   |  |─Circos_plot_enhanced.png
   |─pipeline.log

```

### Merged files

The two main output files for each genome are located in `<OUTDIR>/results/`:

- `enhanced.gbff`:  annotation file produced after the integration of the tool outputs
- `enhanced.gbff`:  the gff3 version of the produced .gbff file

#### Comparison

If the `--compare` option is added, `ReAnnota` will produce a .csv comparison file inside the Compare folder, which includes the following (GO_entries, InterPro_entries, PFAM_entries, KEGG_entries, Pseudogene_candidates, BGCs, Hypotheticals)


#### Visualisation

If the `--circos` option is added, `ReAnnota` will produce two circos plot in the Visualisation folder, one for the starting annotation file that is used as input and one fot the enhanced.gbff 

<img src="docs/circos_enhanced.png">

## Workflow

### Product name determination

The following logic is use in ReAnnota to fill the `product` field in the 9th column of the Gff file along with the integration of db_entries and notes:

<img src="docs/ReAnnota-gff.png">

### Integration of Pseudogenes

`ReAnnota` currently supports Peudogenefinder's .gff ouput. 
- The initial annotations file's pseudogene labels will be preserved
- Additional pseudogene entries will be integrated in one of two ways:
    1. If `product` is "hypothetical protein" the label "Pseudogene" will be added along with any attributes from Pseudogenefinder's gff file in the `Note` section
    2. If `product` is not "hypothetical protein" , only the attributes are added in the `Note` section

### Integration of antismash and GECCO BGCs

If **antiSMASH** or **GECCO** output files are provided, `ReAnnota` will also include in the end of the enhanced.gff3 file a section starting with "##Antismash.." or "##GECCO.." respectively with all BGCs in gff3 format.




