Can a gff file be converted to a fasta file?

I downloaded an annotated genome file in gff format here. I would like to use it for proteomics. Though I need it in fasta format. Is there any tool that converts gff to annotated fasta? I see the file contains the genome sequence in fasta format, but not annotated. Are those file formats convertable?

A gff is a file of annotation. It generally doesn't include sequence information, so you can not inter-convert. But the file on your page has a fasta entry at the bottom.. I'd just grab the bottom half of it, and if the sequence length looks right, that's likely what you want.

• Only to some degree. I would like to conserve the annotations. Jan 23 '19 at 22:37
• @Sören could you clarify what you mean by "conserve the annotations"? The annotations are in gff format, that's standard. Do you want to add the annotations to the fasta file for some reason? Jan 24 '19 at 11:00

You can use GFF utilities to get a fasta sequence from a GFF file using a reference genome file.

Is there any tool that converts gff to annotated fasta?

This is not an uncommon question / request, but perhaps a crash course refresher on file formats would provide some valuable context.

• FASTA files are designed to hold nucleotide or amino acid sequences. The "defline" (header) of each record may include some unique identifiers or descriptive metadata. There are no strict requirements, although there are many common conventions. The information that should be the defline of a FASTA record depends primarily on the tool(s) used to produce and analyze the data.
• GFF files are designed to hold annotations corresponding to sequences, most often genomic sequences such as chromosomes or (if it's a draft genome assembly) scaffolds or contigs. Each record in the GFF file specifies a sequence (such as chr6 or scaffold1985) and an interval (such as 19920557-19997344 or 2488-2489). The GFF file labels that interval as a gene or transposable element or transcription factor binding site or whatever genomic feature you're interested in.

So in this context, a "tool that converts gff to annotated fasta" doesn't make sense since it's an underdefined task. There are many ways to extract sequences from a Fasta file that has been annotated with a GFF file. Many, many scientists have written throwaway programs to do this type of task. It can be done in a hundred subtly different ways, and most of these programs are designed for a single narrow use case. Do you want to:

• pull out the sequence corresponding to every GFF record? Usually not helpful, since many records are children of other records.
• pull out the sequence corresponding to every gene? More common, but since you want to do proteomics you're probably not interested in promoters or introns (if either of these are annotated in your GFF file).
• pull out the coding sequence of each gene and translate it into its corresponding peptide sequence?

It looks like that last point is most likely, but unless I missed something it looks like Prokka is already doing that for you. So the question remains: precisely what information exists in your GFF file that you would like in your FASTA file? You've provided an example of what you have (the FASTA files at least), but can you provide an example of what you want? Only then can we help you to identify the right tool for the task. There's a good chance it will involve writing some code in a programming language like Python or Perl.

I extracted the sequence contained in the gff file into a separate file and added a header according to the fasta file format specifications. I named that file ERS654933.fasta and then used prokka to generate my own annotation.

>ATCC_NCTN13373
GTGTATAACTTAAAAATTTAAGAAAGATGGAGTAAATTTATGTCGGAAAAAGAAATTTGG
GAAAAAGTGCTTGAAATTGCTCAAGAAAAATTATCAGCTGTAAGTTACTCAACTTTCCTA
AAAGATACTGAGCTTTACACGATCAAAGATGGTGAAGCTATCGTATTATCGAGTATTCCT
TTTAATGCAAATTGGTTAAATCAACAATATGCTGAAATTATCCAAGCAATCTTATTTGAT
GTTGTAGGCTATGAAGTAAAACCTCACTTTATTACTACTGAAGAATTAGCAAATTATAGT


Then:

prokka ERS654933.fasta


Which generated a folder with several files. Here is the header of the generated file PROKKA_01232019.faa.

NEOBMGJD_00001 Chromosomal replication initiator protein DnaA
MSEKEIWEKVLEIAQEKLSAVSYSTFLKDTELYTIKDGEAIVLSSIPFNANWLNQQYAEI
IQAILFDVVGYEVKPHFITTEELANYSNNETATPKEATKPSTETTEDNHVLGREQFNAHN
TFDTFVIGPGNRFPHAASLAVAEAPAKAYNPLFIYGGVGLGKTHLMHAIGHHVLDNNPDA
KVIYTSSEKFTNEFIKSIRDNEGEAFRERYRNIDVLLIDDIQFIQNKVQTQEEFFYTFNE
LHQNNKQIVISSDRPPKEIAQLEDRLRSRFEWGLIVDITPPDYETRMAILQKKIEEEKLD
IPPEALNYIANQIQSNIRELEGALTRLLAYSQLLGKPITTELTAEALKDIIQAPKSKKIT
IQDIQKIVGQYYNVRIEDFSAKKRTKSIAYPRQIAMYLSRELTDFSLPKIGEEFGGRDHT
TVIHAHEKISKDLKEDPIFKQEVENLEKEIRNV
>NEOBMGJD_00002 Beta sliding clamp
MMEFTIKRDYFITQLNDTLKAISPRTTLPILTGIKIDAKEHEVILTGSDSEISIEITIPK
TVDGEDIVNISETGSVVLPGRFFVDIIKKLPGKDVKLSTNEQFQTLITSGHSEFNLSGLD
PDQYPLLPQVSRDDAIQLSVKVLKNVIAQTNFAVSTSETRPVLTGVNWLIQENELICTAT
DSHRLAVRKLQLEDVSENKNVIIPGKALAELNKIMSDNEEDIDIFFASNQVLFKVGNVNF
ISRLLEGHYPDTTRLFPENYEIKLSIDNGEFYHAIDRASLLAREGGNNVIKLSTGDDVVE
LSSTSPEIGTVKEEVDANDVEGGSLKISFNSKYMMDALKAIDNDEVEVEFFGTMKPFILK
PKGDDSVTQLILPIRTY
>NEOBMGJD_00003 hypothetical protein
MVQEVVVEGDINLGQFLKTEGIIESGGQAKWFLQDVEVLINGVRETRRGKKLEHQDRIDI
PELPEDAGSFLIIHQGEQ


So, that way I could create my own annotation, but I am loosing the annotation information in the gff file.

• You've got gene name and description, and you want more? You might have to make your own script for that. Jan 24 '19 at 17:06
• I thought, I am probably not the first one doing that. So, I was hoping someone knows how to do that. Rather then inventing the wheel again. I have done that before. Jan 24 '19 at 20:43