This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract EXON fasta from a GFF3 annotation and reference genome

Hi, after a hard search on the net I found this awesome script (https://git.io/JfIjg). It works nice. However, I need to extract all exon sequence from a genome based on GFF3 and FASTA. Please, found here https://is.gd/gGMtUo a GFF3 sample file. From that file I need to extract sequences like these:

>Eucgr.A00001.1.v2.0.exon.1
ACTGTGACA......
>Eucgr.A00001.1.v2.0.exon.2
ACTGTGACA......
>Eucgr.A00001.1.v2.0.exon.3
ACTGTGACA......
(...)
>Eucgr.A00001.1.v2.0.exon.12
ACTGTGACA......
(...)

Could you help me? Thank you so much!

genome fasta exon gff2fasta gff

1 answer

Here a solution

conda create -n agat
conda activate agat
conda --install -c bioconda agat
agat_sp_extract_sequences.pl --gff file.gff -f file.fa -t exon --split

Thank you so much! It worked out off the box! I have a little trouble to install it on my Debian box. So, I leave here the step by step I do to install AGAT on my Debian testing. This steps worked for me on Linux 5.5.0-2-amd64 #1 SMP Debian 5.5.17-1 (2020-04-15) x86_64 GNU/Linux:

Install all dependencies by APT

apt update && apt upgrade
apt install libbio-perl-perl libclone-perl libgraph-perl liblwp-useragent-determined-perl libstatistics-r-perl libjson-perl libcarp-clan-perl libsort-naturally-perl libfile-share-perl libfile-sharedir libfile-sharedir-install-perl`

Clone AGAT

git clone https://github.com/NBISweden/AGAT.git # Clone AGAT
cd AGAT                                         # move into AGAT folder
perl Makefile.PL                                # Check all the dependencies*. If it complains for lack of any dependencies, install it using apt. All perl dependencies are in the Debian repositories
make                                            # Compile
make test                                       # Test
sudo make install                               # Install

Run the agat_sp_extract_sequences.pl. For extract exon, for example, you could run:

agat_sp_extract_sequences.pl -f reference_sequence.fa -gff annotation_fasta.gff3 -t exon --split -o output.exons.fa

Thank you!

Log in to answer this question.