EGAPx (Eukaryotic Genome Annotation Pipeline)

repository·main·Indexed 41 days ago

https://github.com/ncbi/egapx

A publicly accessible NCBI pipeline for annotating eukaryotic genomes. It integrates genome assemblies, taxonomy information, and short/long RNA-seq data to predict gene models and functional annotations. The pipeline supports various executors including AWS Batch, SLURM, Docker, and Singularity, and requires Nextflow v.23.10.1 and Python v.3.11+.

Tokens
8.4K
Snippets
19
Records
32
Agent score
51%

What's inside EGAPx

  1. Assess annotation quality with BUSCO

    main

    The quality of EGAPx annotations is assessed using BUSCO scoring. BUSCO evaluates genome completeness by comparing the annotated gene set against conserved orthologous groups.

    • High BUSCO score: Indicates a well-annotated genome with minimal missing or fragmented genes.
    • Low BUSCO score: Suggests potential gaps or inaccuracies, or that the organism is highly divergent from the BUSCO models used.
  2. Understand EGAPx annotation limitations and organelle handling

    main

    EGAPx does not support organelle annotation. Because the pipeline is not aware of which sequences belong to organelles, it may produce inaccurate annotations for these sequences in the final GFF3 output.

    Important:

    • Do not use organelle annotations produced by EGAPx.
    • The prepare_submission program will automatically delete organelle annotations when preparing files for GenBank submission.
  3. Provide long RNA-seq reads to EGAPx

    main

    Long RNA-seq reads can be provided alone or combined with short reads. They must be in FASTA or FASTQ format (not BAM). Use the long_reads: key in your YAML.

    SRA Accessions or Entrez Query

    long_reads: txid43150[Organism] AND (oxford_nanopore[Platform] OR pacbio_smrt[Platform]) AND biomol_rna[Properties]

    Local Non-SRA Reads

    Use a text file with unique set names and filepaths:

    longset1 path/to/run1/long_reads.fq
    longset2 path/to/run2/long_reads.fq

    Full Configuration Example

    genome: path/to/genome.fasta
    taxid: 1234
    short_reads: path/to/short_reads.txt
    long_reads: path/to/long_reads.txt
    genome: path/to/genome.fasta
    taxid: 1234
    short_reads: RNA-seq short reads data
    long_reads: RNA-seq long reads data
  4. Run EGAPx in Online or Offline mode

    main

    EGAPx can be run in two modes depending on your network environment:

    1. Online Mode: Support files are automatically staged from the internet during pipeline execution. This is the default behavior.
    2. Offline Mode: Used for restricted internet access or reproducible runs. You must manually pull the Singularity image, download support files (via egapx.py), and provide a local cache directory using the -lc flag.

    To test the pipeline, use the provided example: ./examples/input_D_farinae_small.yaml.

    # Online mode run
    python3 ui/egapx.py ./examples/input_D_farinae_small.yaml -e <executor> -w <workdir> -o <output>
    
    # Offline mode run (requires -lc flag)
    python3 ui/egapx.py edit_D_farinae_small.yaml -e biowulf_cluster -w <workdir> -o <output> -lc local_cache
  5. Review submission output and validation results

    main

    After running prepare_submission, review the following files in your --out-dir before uploading to the NCBI Genome Submission Portal:

    1. Submission ASN.1: Located at out_dir/annotated_genome.seq-submit.sqn.
    2. Validation Output: out_dir/annotated_genome.seq-submit.val. Check for ERROR, REJECT, or FATAL issues. If you encounter unexpected issues with these labels, please open a GitHub issue.
    3. Discrepancy Report: out_dir/annotated_genome.seq-submit.dr.
      • You can safely ignore FATAL errors named BACTERIAL_*.
      • The error Error: valid [SEQ_DESCR.BadStrucCommInvalidFieldName] Diploid is not a valid field is a false positive and can be ignored.
  6. Prepare EGAPx annotation for submission to NCBI (New Assembly)

    main

    Use the prepare_submission command to prepare annotation files for a new assembly. This requires the EGAPx output in ASN1 format, a submission template, and BioProject/BioSample identifiers.

    Required Inputs:

    • --egapx-annotated-genome-asn: The out/annotated_genome.asn file.
    • --submission-template-file: Metadata prepared from the NCBI submission template.
    • --bioproject-id: The PRJNA# identifier.
    • --locus-tag-prefix: The assigned prefix.
    • --src-file: A tab-delimited source modifiers table.
    • --assembly-data-structured-comment-file: A structured comment file prepared from NCBI.
    • --out-dir: Output directory.

    Note: Ensure all input files are in your current working directory ($PWD) or provide additional --volume= (Docker) or --bind (Singularity) arguments to mount them.

    # Using Docker:
    alias prepare_submission='docker run --rm -i --volume="$PWD:$PWD" --workdir="$PWD" ncbi/egapx:1.0 prepare_submission'
    
    # Using Singularity or Apptainer:
    alias prepare_submission='singularity exec --cleanenv --bind "$PWD:$PWD" --pwd "$PWD" docker://ncbi/egapx:1.0 prepare_submission'
    
    # Invoke the app:
    prepare_submission \
      --egapx-annotated-genome-asn annotated_genome.asn \
      --submission-template-file template.sbt \
      --bioproject-id PRJNA# \
      --src-file source-table.txt \
      --assembly-data-structured-comment-file genome.asm \
      --linkage-evidence paired-ends \
      --out-dir out
  7. Install and setup EGAPx

    main

    To install EGAPx, clone the repository, create a Python virtual environment, and install the required dependencies using pip.

    Prerequisites

    Before installation, ensure you have the following installed:

    • Docker or Singularity
    • AWS Batch, SLURM/UGE cluster, or an r6a.4xlarge machine (32 CPUs, 256GB RAM)
    • Nextflow v.23.10.1
    • Python v.3.11+
    git clone https://github.com/ncbi/egapx.git
    cd egapx
    
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  8. Set up EGAPx for Offline Mode

    main

    To run EGAPx offline, follow these steps to prepare your local environment:

    1. Pull Singularity image:
      singularity pull docker://ncbi/egapx:1.0
    2. Download support files and SRA data: Use the -dl flag to download everything, or -dn to download only support files and BUSCO lineage files.
      python3 ui/egapx.py ./examples/input_D_farinae_small.yaml -dl -lc local_cache
    3. Prepare SRA data: If using full SRA datasets, you can use prefetch and fasterq-dump from SRA tools, or let egapx.py handle it. Ensure your input YAML points to the local paths in your local_cache.
    4. Configure Executor: If using a cluster like Biowulf, generate the config and point to your .sif file:
      python3 ui/egapx.py edit_D_farinae_small.yaml -e biowulf_cluster -w <workdir> -o <output> -lc local_cache
      echo "process.container = '/path/to/egapx_1.0.sif'" >> egapx_config/biowulf_cluster.config
  9. Interpret EGAPx MultiQC reports

    main

    EGAPx uses MultiQC to generate a single HTML report summarizing the pipeline's performance and results. This report provides a centralized view of:

    • Feature counts and length statistics: Summary of annotated features.
    • BUSCO scores: Assessment of genome completeness.
    • Genome masking statistics: Details on masked regions.
    • Alignment statistics: Performance of RNA-seq and protein alignments.

    Note: Current versions may lack data for protein alignments and local RNA-seq alignments. Check the Release Notes for status.

  10. Prepare EGAPx annotation for submission to NCBI (Existing GenBank Assembly)

    main

    If you are submitting an annotation for an existing GenBank assembly, use the --gc-assembly-id parameter (e.g., GCA_#). This allows you to bypass some requirements like the manual locus-tag-prefix if they can be resolved automatically.

    Required Inputs:

    • --egapx-annotated-genome-asn: The out/annotated_genome.asn file.
    • --submission-template-file: Metadata prepared from the NCBI submission template.
    • --bioproject-id: The PRJNA# identifier (optional if --gc-assembly-id is specified).
    • --gc-assembly-id: The GenBank assembly identifier GCA_#.
    • --out-dir: Output directory.

    Optional Inputs:

    • --biosample-id: The SAMN# identifier.
    • --seq-id-mapping-file: A two-column TSV (submitter-seq-id, gca-acc.ver) required if the annotation is on submitter local seq-ids.
    prepare_submission \
      --egapx-annotated-genome-asn annotated_genome.asn \
      --submission-template-file template.sbt \
      --bioproject-id PRJNA# \
      --gc-assembly-id GCA_# \
      --out-dir out
  11. Configure EGAPx executors and generate config templates

    main

    Before running the pipeline, you should run the command once to generate template configuration files in a ./egapx_config directory. This allows you to customize the environment settings.

    Available Executors (-e flag):

    • aws: AWS Batch using Docker image. Requires editing process.queue in ./egapx_config/aws.config.
    • docker: Using Docker image (defaults to single node).
    • singularity: Using Singularity image (defaults to single node).
    • biowulf_cluster: Using Singularity image on Biowulf cluster. Requires editing ./egapx_config/slurm.config.
    • slurm: Using SLURM in your HPC. Requires editing ./egapx_config/slurm.config.

    Note: For local machine execution, no adjustments are needed.

    # Generate config templates
    python3 ui/egapx.py ./examples/input_D_farinae_small.yaml -e <executor> -w <workdir> -o <output>
    
    # View help menu
    python3 ui/egapx.py -h
  12. Identify and handle assembly contamination

    main

    EGAPx checks for prokaryotic or viral contamination by searching gene models against the SwissProt database using diamond blastp. If $\ge 5%$ of models have best hits to prokaryotes or viruses, the pipeline fails with: Error: (CException::eUnknown) Too many protein hits to proks.

    Using the Contamination Report

    If the pipeline does not fail automatically, review GNOMON/contam_rpt.tsv to identify potential contamination. The file columns are:

    1: #seq_id                      genomic sequence identifier
    2: gb_syn_seq_id                GenBank synonym seq-id, 'na' for EGAPx runs
    3: length                       total sequence length
    4: num_genes                    total number of gene models present on the sequence
    5: num_single_exon_genes        total number of single-exon gene models present on the sequence
    6: num_prok_genes               number of gene models with best hits to prokaryotes/virus
    7: num_prok_single_exon_genes   number of single-exon models with best hits to prokaryotes/virus

    Strategy for cleaning contaminated assemblies:

    1. Filter for sequences with $\ge 10$ models (column 4) where $\ge 50%$ are prokaryotic/viral (column 6).
    2. Identify candidate contaminating genomes using megablast/blastx.
    3. Re-search the assembly using the candidate genomes as queries via dc-megablast.