Quick Start

A pangenome models the full set of genomic elements in a given species or clade. It can efficiently be encoded in the form of a variation graph, a type of sequence graph that embeds the linear sequences as paths in the graphs themselves.

To exchange pangenomes, the community frequently uses a strict subset of the Graphical Fragment Assembly GFA format version 1 (GFAv1). To navigate such files efficiently, odgi operates on a dynamic succinct variation graph representation, the odgi format.

Build graph from GFA

To construct an odgi file from a GFA file, execute:

wget https://raw.githubusercontent.com/pangenome/odgi/master/test/DRB1-3123.gfa
odgi build -g DRB1-3123.gfa -o DRB1-3123.og

The command creates a file called DRB1-3123.og, which contains the input graph in odgi format.


If you know in advance that your graph is not optimized, and you want to run at least one of the following subcommands:

Then please execute odgi build with -O, --optimize in order to ensure that you don't run into any problems later. odgi sort can optimize already built graphs.

In an optimized graph the minimum node identifier is one and the maximum node identifier is equal to the number of nodes in the graph.

Display graph stats

To have basic information on the graph, execute:

odgi stats -i DRB1-3123.og -S | column -t
#length nodes   edges   paths
21997   4955    6777    12

This graph file has the following properties:

  • the total number of nucleotides of all nodes is 21997;

  • it has 4955 nodes, 6777 edges, and 12 paths.

Display path names and extract paths

The path's names are:

odgi paths -i DRB1-3123.og -L

We can obtain their sequences in FASTA format:

odgi paths -i DRB1-3123.og -f > paths.fasta
head paths.fasta -n 2

Generate a 1D visualization

To visualize the graph, execute:

odgi viz -i DRB1-3123.og -o DRB1-3123.png -x 500

to obtain the following PNG image:


In this 1-Dimensional visualization:

  • The graph nodes are arranged from left to right, forming the pangenome sequence.

  • The colored bars represent the the paths versus the pangenome sequences in a binary matrix.

  • The path names are visualized on the left.

  • The black lines under the paths are the links, which represent the graph topology.

See the odgi viz documentation for more information.