Reference databases for metabarcoding encode taxonomic information in sequence headers using different conventions. Understanding these formats is essential when downloading databases, running taxonomic classifiers, and summarizing results with dbpq.
dbpq recognizes five taxonomy formats, grouped into two categories:
prefix-based formats (where each rank has a short
prefix like k__) and positional formats
(where ranks are identified by their position in a semicolon-delimited
string).
k__/p__ prefixes)Used by: UNITE (general FASTA releases)
Each rank is identified by a two-letter prefix followed by double underscores, separated by semicolons:
>AB123456;k__Fungi;p__Ascomycota;c__Sordariomycetes;o__Hypocreales;f__Nectriaceae;g__Fusarium;s__oxysporum
ATCGATCG...
| Prefix | Rank |
|---|---|
k__ |
Kingdom |
p__ |
Phylum |
c__ |
Class |
o__ |
Order |
f__ |
Family |
g__ |
Genus |
s__ |
Species |
Used by: UNITE (SINTAX release), PR2 (UTAX format), MIDORI2 (SINTAX format), Eukaryome (SINTAX format)
Taxonomy is encoded with a tax= prefix, single-letter
rank codes followed by colons, separated by commas:
>AB123456;tax=d:Eukaryota,k:Fungi,p:Ascomycota,c:Sordariomycetes,o:Hypocreales,f:Nectriaceae,g:Fusarium,s:Fusarium_oxysporum
ATCGATCG...
This format is used by vsearch --sintax and the original
USEARCH UTAX algorithm. Note that SINTAX and UTAX use the same header
format despite being different classification algorithms.
| Prefix | Rank |
|---|---|
d: |
Domain |
k: |
Kingdom |
p: |
Phylum |
c: |
Class |
o: |
Order |
f: |
Family |
g: |
Genus |
s: |
Species |
d__/p__ prefixes)Used by: Greengenes2
Similar to the UNITE format but starts with d__ (domain)
instead of k__ (kingdom):
>abc123 d__Bacteria;p__Pseudomonadota;c__Gammaproteobacteria;o__Enterobacterales;f__Enterobacteriaceae;g__Escherichia;s__Escherichia coli
ATCGATCG...
| Prefix | Rank |
|---|---|
d__ |
Domain |
p__ |
Phylum |
c__ |
Class |
o__ |
Order |
f__ |
Family |
g__ |
Genus |
s__ |
Species |
Some databases use semicolon-separated taxonomy without any prefix. The meaning of each rank is determined by its position in the string. The number of levels varies by database.
For these formats, use rank_position in
list_ranks_db() to extract a specific rank by position.
Used by: SILVA (dada2-formatted), RDP (dada2-formatted)
>Bacteria;Proteobacteria;Gammaproteobacteria;Enterobacterales;Enterobacteriaceae;Escherichia;
ATCGATCG...
The number of levels depends on the specific training set. The
dada2::assignTaxonomy() classifier accepts any number of
semicolon-separated levels — with or without prefixes — via the
taxLevels argument.
Used by: PR2 (dada2 format)
PR2 uses 9 taxonomic levels specific to protist taxonomy:
>EU293891.1.1750_U Eukaryota;Archaeplastida;Chlorophyta;Chlorophyta_X;Mamiellophyceae;Mamiellales;Bathycoccaceae;Ostreococcus;Ostreococcus_tauri
ATCGATCG...
| Position | Rank |
|---|---|
| 1 | Domain |
| 2 | Supergroup |
| 3 | Division |
| 4 | Subdivision |
| 5 | Class |
| 6 | Order |
| 7 | Family |
| 8 | Genus |
| 9 | Species |
Beyond taxonomy encoding, formats differ in where the sequence name
(accession number, e.g. AB123456) appears in the FASTA
header:
| Format | Sequence name location | Separator | Example header |
|---|---|---|---|
UNITE (k__) |
Between > and first ; |
; |
>AB123456;k__Fungi;p__Ascomycota;... |
| SINTAX / UTAX | Between > and ;tax= |
;tax= |
>AB123456;tax=d:Eukaryota,k:Fungi,... |
| Greengenes2 | Between > and first space |
space | >abc123 d__Bacteria;p__Pseudomonadota;... |
| PR2 (positional) | Between > and first space |
space | >EU293891.1.1750_U Eukaryota;Archaeplastida;... |
| dada2 (positional) | Last taxonomic level (often species) | ; |
>Bacteria;Proteobacteria;...;Escherichia |
In prefix-based formats (UNITE, SINTAX, Greengenes2), the sequence name is clearly separated from the taxonomy string. In the dada2 positional format used by SILVA and RDP training sets, there is typically no separate accession number — the header contains only taxonomy, and the deepest level often serves as a sequence identifier.
This distinction matters when converting between formats: conversion
functions like format2sintax() and
format2dada2() must correctly extract or relocate the
sequence name.
tax_prefixes() returns rank prefixes (character vector)
for prefix-based formats and rank positions (integer vector) for
positional formats:
library(dbpq)
# Prefix-based formats
tax_prefixes("unite")
#> k p c o f g s
#> "k__" "p__" "c__" "o__" "f__" "g__" "s__"
tax_prefixes("sintax")
#> d k p c o f g s
#> "d:" "k:" "p:" "c:" "o:" "f:" "g:" "s:"
tax_prefixes("greengenes2")
#> d p c o f g s
#> "d__" "p__" "c__" "o__" "f__" "g__" "s__"
# Positional format (PR2)
tax_prefixes("pr2")
#> Domain Supergroup Division Subdivision Class Order
#> 1 2 3 4 5 6
#> Family Genus Species
#> 7 8 9# UNITE format
summarize_db("unite_database.fasta", tax_format = "unite")
# SINTAX format (UNITE SINTAX, MIDORI2 SINTAX)
summarize_db("midori2_sintax.fasta", tax_format = "sintax")
# Greengenes2 format
summarize_db("greengenes2.fasta", tax_format = "greengenes2")
# PR2 positional format
summarize_db("pr2_database.fasta", tax_format = "pr2")
# Auto-detect format
summarize_db("some_database.fasta", tax_format = "auto")# Prefix-based: list phyla in a UNITE-format database
list_ranks_db("database.fasta", rank_prefix = "p__")
# Prefix-based: list phyla in a SINTAX-format database
list_ranks_db("database.fasta", rank_prefix = "p:")
# Using tax_format for convenience (extracts first rank)
list_ranks_db("database.fasta", tax_format = "unite")
# Positional: list genera in a PR2 database (position 8)
list_ranks_db("database.fasta", tax_format = "pr2", rank_position = 8)
# Positional: list phyla in any unprefixed database (position 2)
list_ranks_db("database.fasta", rank_position = 2)# UNITE (k__) → SINTAX
format_fasta_db(
taxnames = "AB123;k__Fungi;p__Ascomycota;c__Sordariomycetes",
output_format = "sintax"
)
#> [1] "AB123;tax=k:Fungi,p:Ascomycota,c:Sordariomycetes"
# SINTAX → UNITE (k__)
format_fasta_db(
taxnames = "AB123;tax=k:Fungi,p:Ascomycota,c:Sordariomycetes",
output_format = "unite"
)
#> [1] "AB123;k__Fungi;p__Ascomycota;c__Sordariomycetes"
# Greengenes2 → dada2
format_fasta_db(
taxnames = "abc123 d__Bacteria;p__Pseudomonadota;g__Escherichia",
output_format = "dada2"
)
#> [1] "Bacteria;Pseudomonadota;Escherichia;"Several databases offer SINTAX-formatted downloads alongside their default format:
Different taxonomic classifiers expect different input formats. The
table below shows which formats work with which classifiers, including
those available via MiscMetabar::add_new_taxonomy_pq():
| Classifier | Expected format | dbpq download | add_new_taxonomy_pq() method |
|---|---|---|---|
dada2::assignTaxonomy() |
Any ;-separated taxonomy |
format = "dada2" |
method = "dada2" |
dada2::addSpecies() |
ID Genus species |
format = "dada2_species" |
method = "dada2_2steps" |
vsearch --sintax |
SINTAX (tax=) |
taxonomic_format = "sintax" |
method = "sintax" |
VSEARCH LCA (--usearch_global) |
Any FASTA | Any | method = "lca" |
| IDTAXA | Custom training set | Convert with format2dada2() |
method = "idtaxa" |
| BLASTn | Any FASTA | Any | method = "blastn" |
For ITS (fungi):
download_unite_db()For 16S (bacteria/archaea):
download_silva_db()download_rdp_db()download_greengenes2_db()For 18S (protists/eukaryotes):
download_pr2_db()download_eukaryome_db()For COI (metazoa):
download_midori2_db()download_bold_db()For rbcL (diatoms):
download_diatbarcode_db() or use
diatbarcode R packageFor 18S AMF (arbuscular mycorrhizal fungi):
download_marjaam_db()download_eukaryome_db()