# Fasta Sequence Identifier format?

I have been analyzing some virus DNA from the NCBI databases. The fasta sequences that I recieve from them have header lines that look like this:

>gi|61393989|gb|AY848686.1|


I think that the second number is the GenBank ID, but I have several questions:

1) What does the "gi" in the first ID stand for?

2) Is this a standard format for storing a series of IDs associated with sequences? That is, should I expect to see this format elsewhere and be prepared to parse fasta headers like this in code that I write?

3) It seems that AY848686 is also a valid GenBank ID, and I see the .1 missing/present in GenBank IDs in various places. What does the .1 mean at the end of GenBank IDs and why is it there/does it need to be there?

1. The gi is an abbreviation for "Genbank identifier".
2. This is a pretty standard convention used by data stored in NCBI databases. There used to be a pretty comprehensive description of the conventions used at NCBI (I wouldn't say it was a standard or specification, just convention) here, but this page is no longer available it seems.
3. The AY848686 label is an accession value, and the appended number is a version number.

The short answer is: these are all internal conventions. None of it needs to be there, except perhaps to ensure NCBI's internal tools work as expected.

UPDATE: I found a non-official copy of the old docs here. Look for the section starting with "FASTA Defline Format". I've copied it here to prevent further problems with bitrot in the future.

FASTA Defline Format
--------------------
The syntax of FASTA Deflines used by the NCBI BLAST server depends on
the database from which each sequence was obtained.  The table below lists
the identifiers for the databases from which the sequences were derived.

Database Name                         Identifier Syntax

GenBank                               gb|accession|locus
EMBL Data Library                     emb|accession|locus
DDBJ, DNA Database of Japan           dbj|accession|locus
NBRF PIR                              pir||entry
Protein Research Foundation           prf||name
SWISS-PROT                            sp|accession|entry name
Brookhaven Protein Data Bank          pdb|entry|chain
Patents                               pat|country|number
GenInfo Backbone Id                   bbs|number
General database identifier           gnl|database|identifier
NCBI Reference Sequence               ref|accession|locus
Local Sequence identifier             lcl|identifier

For example, an identifier might be "gb|M73307|AGMA13GT", where the "gb" tag
indicates that the identifier refers to a GenBank sequence, "M73307" is its
GenBank ACCESSION, and "AGMA13GT" is the GenBank LOCUS.

"gi" identifiers are being assigned by NCBI for all sequences contained
within NCBI's sequence databases.  The 'gi' identifier provides a uniform
and stable naming convention whereby a specific sequence is assigned
its unique gi identifier.  If a nucleotide or protein sequence changes,
however, a new gi identifier is assigned, even if the accession number
of the record remains unchanged. Thus gi identifiers provide a mechanism
for identifying the exact sequence that was used or retrieved in a
given search.

For searches of the nr protein database where the sequences are derived
from conceptual translations of sequences from the nucleotide databases
the following syntax is used:

gi|gi_identifier

An example would be:

gi|451623           (U04987) env [Simian immunodeficiency..."

where '451623' is the gi identifier and the 'U04987' is the accession
number of the nucleotide sequence from which it was derived.

Users are encouraged to use the '-I' option for Blast output which will
produce a header line with the gi identifier concatenated with the database
identifier of the database from which it was derived, for example, from a
nucleotide database:

gi|176485|gb|M73307|AGMA13GT

And similarly for protein databases:

gi|129295|sp|P01013|OVAX_CHICK

The gnl ('general') identifier allows databases not on the above list to
be identified with the same syntax.  An example here is the PID identifier:

gnl|PID|e1632

PID stands for Protein-ID; the "e" (in e1632) indicates that this ID
was issued by EMBL.  As mentioned above, use of the "-I" option
produces the NCBI gi (in addition to the PID) which users can also
retrieve on.

The bar ("|") separates different fields as listed in the above table.
In some cases a field is left empty, even though the original
specification called for including this field.  To make
these identifiers backwards-compatiable for older parsers
the empty field is denoted by an additional bar ("||").

• Thanks for the quick and accurate answer. As a follow up question- is there some reason why NCBI has accession numbers as well as an ID numbers? Jul 26 '17 at 17:31
• @JonDeaton history, mostly. The GIs are far older. Also see the "Historical Note" section in the link Daniel gave you. Jul 26 '17 at 17:33
• @JonDeaton For parsing be aware that NCBI have phased out GI numbers from fasta headers since Sept 2016. I couldnt find a new source for this info but please see this note from their blog ncbiinsights.ncbi.nlm.nih.gov/2016/07/15/… Jul 27 '17 at 7:31
1. That is a GenBank gene ID and it (apparently) stands for "GenInfo Identifier". The full GenBank ID is gi|61393989.

2. Yes, this is the standard format for sequences provided by NCBI. However, you can have all sorts of extra details appended to that. They (NCBI) generally use | as a field separator, so you could try to write code that parse that, but I really wouldn't recommend it. The FASTA headers have traditionally been free. People can put anything they like there apart from a \n, so I really wouldn't put any effort into writing code to parse these headers.

If you need a short name for the sequence, just take the first N characters or, if it matches ^..|.+?|, take the characters until the second |. Seriously though, don't bother parsing this it is very rarely helpful and is almost certain to break as soon as you use a different database.

3. The AY848686.1 is a GenBank accession. The gb indicates that it's a GenBank accession and the .1 means it is the 1st version of that accession.

As for why there are two (source):

Unlike the gi number system, in which sequence identification numbers were not necessarily consistent across the databases (e.g., GenBank and EMBL could each assign their own gi number to a sequence), the new system is designed to ensure consistency. It is also designed to show a relationship between a sequence identification number and the accession number of the record in which it is found. In contrast, GI numbers are assigned consecutively and bear no resemblance to the accession number. Finally, the new system allows the assignment of alphanumeric protein IDs to proteins translations within nucleotide sequence records. The protein IDs contain three letters followed by five digits, a period, and a version number.