#!/bin/bash
#SBATCH -p queue_name
#SBATCH -J assembly-TSEBRA
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 120:00:00

module load python/3 
module load gcc/7.2.0

# TSEBRA Execs
bin=/path/to/TSEBRA/bin
# BRAKER protein
protein=/path/to/braker_protein
# BRAKER transcript
transc=/path/to/braker_transc

# Fix GTF ids for both
${bin}/fix_gtf_ids.py --gtf ${protein}/braker.gtf --out ${protein}/brakerP_fixed.gtf
${bin}/fix_gtf_ids.py --gtf ${transc}/braker.gtf --out ${transc}/brakerR_fixed.gtf

# Main TSEBRA command
${bin}/tsebra.py \
    -g ${protein}/brakerP_fixed.gtf,${transc}/brakerR_fixed.gtf \
    -c default.cfg \
    -e ${protein}/hintsfile.gff,${transc}/hintsfile.gff \
    -o brakerP+R.gtf

# Extract proteins and CDS from the new merged annotation
/path/to/augustus-3.4.0/scripts/getAnnoFastaFromJoingenes.py \
    -g /path/to/assembly.fasta \
    -f brakerP+R.gtf \
    -o brakerP+R
