Skip to contents

Reads each tip's lineage from the GTDB clade names on its ancestors (see gtdb_node_labels()), and from the clade names that pruning moved onto the tip itself (the tree's tip.taxa; see gtdb_tree_prune()). This gives the GTDB taxonomy of a tree's genomes, down to genus, without the taxonomy files, which is useful for labelling model estimates that carry only accessions. Species are not named in the GTDB trees (each tip is a species), so species is NA unless data supplies it.

Usage

gtdb_tip_taxonomy(tree)

Arguments

tree

A GTDB tree from gtdb_tree_read() or gtdb_tree_prune().

Value

A tibble with one row per tip: accession, domain, phylum, class, order, family, genus, species and gtdb_lineage (the clade names joined with "; ").

Details

Ranks named on no ancestor are NA: genera with a single species in all of GTDB have no node of their own, and trees pruned with other tools lose the names of removed nodes. For the full taxonomy, join the GTDB taxonomy files instead, as sylph2lab::sylph_aggregate() does.

Examples

tree <- gtdb_tree_read(gtdb_example("tree"))
gtdb_tip_taxonomy(tree)
#> # A tibble: 560 × 9
#>    accession       domain   phylum class order family genus species gtdb_lineage
#>    <chr>           <chr>    <chr>  <chr> <chr> <chr>  <chr> <chr>   <chr>       
#>  1 GCF_037023725.1 Bacteria Pseud… Gamm… Pseu… Pseud… Aqui… NA      d__Bacteria…
#>  2 GCF_900105835.1 Bacteria Pseud… Gamm… Pseu… Pseud… Aqui… NA      d__Bacteria…
#>  3 GCF_001042985.1 Bacteria Pseud… Gamm… Pseu… Pseud… Aqui… NA      d__Bacteria…
#>  4 GCF_001457615.1 Bacteria Pseud… Gamm… Pseu… Pseud… Pseu… NA      d__Bacteria…
#>  5 GCF_001598695.1 Bacteria Pseud… Gamm… Ente… Enter… Kleb… NA      d__Bacteria…
#>  6 GCF_002925905.1 Bacteria Pseud… Gamm… Ente… Enter… Kleb… NA      d__Bacteria…
#>  7 GCF_020525925.1 Bacteria Pseud… Gamm… Ente… Enter… Kleb… NA      d__Bacteria…
#>  8 GCF_000742135.1 Bacteria Pseud… Gamm… Ente… Enter… Kleb… NA      d__Bacteria…
#>  9 GCF_000828055.2 Bacteria Pseud… Gamm… Ente… Enter… Kleb… NA      d__Bacteria…
#> 10 GCF_000215745.1 Bacteria Pseud… Gamm… Ente… Enter… Kleb… NA      d__Bacteria…
#> # ℹ 550 more rows