# Which identifier do I have to use when I want to add a ##Fasta section to a gff?

I have a gff file like this

scaffold_1  source  mRNA    2987526 2992430 .   -   .   ID=protein_id_68892;Name="foobar";locus_tag=my_organism_68892;translation=MHTGDALEGSTGNVSILV...
scaffold_1  source  exon    2987526 2987805 .   -   .   name "foobar"; transcriptId 68892;locus_tag=my_organism_68892
scaffold_1  source  CDS     2987526 2987805 .   -   1   name "foobar"; proteinId 68892; exonNumber 5;locus_tag=my_organism_68892;Parent=protein_id_68892
scaffold_1  source  exon    2988610 2988745 .   -   .   name "foobar"; transcriptId 68892;locus_tag=my_organism_68892
scaffold_1  source  CDS     2988610 2988745 .   -   2   name "foobar"; proteinId 68892; exonNumber 4;locus_tag=my_organism_68892;Parent=protein_id_68892
scaffold_1  source  exon    2989157 2989645 .   -   .   name "foobar"; transcriptId 68892;locus_tag=my_organism_68892
scaffold_1  source  CDS     2989157 2989645 .   -   2   name "foobar"; proteinId 68892; exonNumber 3;locus_tag=my_organism_68892;Parent=protein_id_68892
scaffold_1  source  exon    2990903 2991541 .   -   .   name "foobar"; transcriptId 68892;locus_tag=my_organism_68892
scaffold_1  source  CDS     2990903 2991541 .   -   2   name "foobar"; proteinId 68892; exonNumber 2;locus_tag=my_organism_68892;Parent=protein_id_68892
scaffold_1  source  exon    2991587 2992430 .   -   .   name "foobar"; transcriptId 68892;locus_tag=my_organism_68892
scaffold_1  source  CDS     2991587 2992430 .   -   0   name "foobar"; proteinId 68892; exonNumber 1;locus_tag=my_organism_68892;Parent=protein_id_68892


The mRNAentry was not present at first and I added it in. I also have the protein fast file available and would now like to add the amino acid sequences to the gff. I originally added them in column 9 to the mRNAentry which is apparently incorrect. Here it is written that the sequences should go at the end of the file in the ##Fastasection. However, I struggle to figure out which identifier I should use to link it to my mRNA entries.

Do I have to use

##Fasta
>protein_id_68892
MHTGDALEGSTGNVSILV...


or does it work with the locus_tag

##Fasta
>my_organism_68892
MHTGDALEGSTGNVSILV...


or is it something completely else? Where and how do can I add the translation information?

In the link above (and also in the comments it is suggested) the identifier in the first column is used, in my case that would be scaffold_1. However, I do have a lot of entries with scaffold_1in my file so a link between scaffold_1and an amino acid sequence would not be unique as I would have

##Fasta
>scaffold_1
MHTGDALEGSTGNVSILV...
>scaffold_1
GDAHTEGSTGNVSILV...


. In the end, I want to create a genbank file (which does not exist yet) where I can link a CDS to an amino acid sequence.

• Normally, the ##Fasta section contains the nucleotide sequences corresponding to the seqid column. Most GFF parsers can generate amino acid sequences on the fly from this information Oct 23 '17 at 10:31
• @heathobrien: Thanks for the info. But the problem would remain: Which identifier should be used there?
– Cleb
Oct 23 '17 at 10:37
• in your example, scaffold_1 Oct 23 '17 at 10:41
• @heathobrien: but in the file I see scaffold_1 for a lot of proteins. Then it would still unclear which sequence to add. Also, in the link in my question is written This notation indicates that the annotation portion of the file is at an end and that the remainder of the file contains one or more sequences (nucleotide or protein) in FASTA format. So adding proteins should be ok. Any ideas?
– Cleb
Oct 23 '17 at 10:45
• It's normal for multiple genes to be coded on the same DNA sequence. The GFF tells you which portion of the sequence codes for each gene. Ultimately, you can add whatever you want. It really depends what you're planning to do with the file. Oct 23 '17 at 10:52

Unless I'm mistaken, the only variant of GFF that explicitly permits Fasta entries is GFF3, and the data you've shown above is definitely not valid GFF3. The mRNA entry seems to correctly use the = symbol to separate keys from values in each attribute, but the remaining columns all use spaces and quotation marks (GTF style) instead. This is likely to cause all kinds of problems with software packages that take GFF data as input.

But to more directly address your question, there is no "right" way to connect feature entries to sequence entries in a GFF3 file. There are some conventions, but these are all very specific to a small set of tools and community of practice, and it is rare that these conventions are objectively enforced. Some options include:

• Placing genomic nucleotide sequences in the ##FASTA section, and then using feature coordinates to pull out mature mRNA sequences and translate them in silico to derive the corresponding peptide sequence. In this case, the Fasta entries would be genomic sequence identifiers that correspond to the first field/column in each feature entry.
• Placing mature mRNA sequences in the ##FASTA section, and then directly translating this sequence to derive the corresponding peptide sequence. In this case, you'll want the sequence IDs in the ##FASTA section to match the ID attribute of the corresponding mRNA feature.
• Placing the peptide sequences directly in the ##FASTA section. In this case, you would either want to have protein features declared in the GFF3 file (uncommon) or have some sort of protein_id attribute associated with each mRNA feature, in which case you'd want the sequence IDs in the ##FASTA section to match this protein_id attribute.

There are probably other ways of doing it, too. Which way is "right"? The GFF3 specification has nothing to say about it. It depends on the tools you are using to do the subsequent processing and analysis. If you're lucky, those tools might even document what they expect in terms of input.

Let me just say, as a post-script, that I think placing sequences and feature annotations in the same file is a horrible idea. I've never liked this about GFF3.

To answer your specific question, you should use the identifier from the first column of the GFF in the ##Fasta section. As you note, this won't work if you are trying to add multiple protein sequence for each seqid. Try using the scaffold DNA sequences in this section and add amino acid translations as an attribute of the annotations.

• Thanks for your reply. add amino acid translations as an attribute of the annotations Which annotations? Where exactly would you add the translations?
– Cleb
Oct 23 '17 at 22:06