Function Repository Resource:

TaxonomyTree (1.0.0) current version: 1.0.2 »

Source Notebook

Visualize a taxonomy tree of either a single TaxonomicSpecies entity, or a list of multiple entities

Contributed by: Dave Middleton

ResourceFunction["TaxonomyTree"][species]

gives a taxonomic tree of species, a single "TaxonomicSpecies" entity or a list of entities.

Details and Options

Organisms are classified into a nested hierarchy of taxa, from the broad kingdom and phylum levels down to the specific species level. Each step in the taxonomic sequence represents taxa that belong to the level above and contain subgroups representing the level below.
ResourceFunction["TaxonomyTree"] visualizes the taxonomy of a single or multiple biological organism's entities as a tree.
ResourceFunction["TaxonomyTree"] species arguments are constrained to "TaxonomicSpecies" entities.
Tree element labels are displayed by their CommonNames. This can be overridden with Tree Graphics options.
ResourceFunction["TaxonomyTree"] will automatically correct errors in the taxonomic sequence i.e. if multiple edges connect to a single tree element. TaxonomyTree will replace them by one edge, connected to its element's parent taxon.
A taxonomy tree of a single entity can be used to study the taxonomy of the species entity in detail. ResourceFunction["TaxonomyTree"] will visualize all nested hierarchies emerging subsequently out of a higher ranking root taxon down to the species and sub-species taxon level.
The number of taxonomic levels between the root- and the species taxon-level can be set with the option "Depth":
By default, the "Depth" option is set to 3.
The "Depth" option can be set by the user as "Depth" n, where n is an Integer. For example: "Depth" 4 for the "Species Sapiens" is the Order Primates in the taxonomic sequence: Domain Eukaryotes -> Kingdom Animals -> Phylum Chordates -> Class Mammals -> Order Primates -> Family Hominidae -> Genus Homo -> Species Sapiens.
A taxonomy tree of a list of multiple entities can be used to study the taxonomic relationship between entities. ResourceFunction["TaxonomyTree"] will visualize all levels in the taxonomic sequence of each entity in the list, but without their nested hierarchies. Therefore the option "Depth" will be ignored by ResourceFunction["TaxonomyTree"] if a list of entities is used an argument.

Examples

Basic Examples (2) 

Visualize a taxonomy tree of the lion species:

In[1]:=
ResourceFunction["TaxonomyTree"][
 Entity["TaxonomicSpecies", "PantheraLeo::d7933"]]
Out[1]=

Visualize a taxonomy tree of a list of animal and a plant species:

In[2]:=
ResourceFunction["TaxonomyTree", ResourceVersion->"1.0.0"][{Entity["TaxonomicSpecies", "CarcharodonCarcharias::k6mys"], Entity["TaxonomicSpecies", "Quercus::k2384"]}]
Out[2]=

Scope (1) 

TaxonomyTree can visualize a taxonomic tree of entities of different taxonomic ranks. For example the single-entity taxonomy of the corona virus family:

In[3]:=
ResourceFunction["TaxonomyTree"][
 Entity["TaxonomicSpecies", "Coronaviridae::s2mb5"], "Depth" -> 2]
Out[3]=

Options (2) 

The "Depth" option determines the number of taxonomic levels between the root- and the argument species taxon. For example, at a "Depth" of 1, TaxonomyTree will show the sub-species of a lion:

In[4]:=
ResourceFunction["TaxonomyTree"][
 Entity["TaxonomicSpecies", "PantheraLeo::d7933"], "Depth" -> 1]
Out[4]=

TaxonomyTree accepts the visualization options of a Tree. Higher tree-depths can benefit from a left-oriented TreeLayout and a larger AspectRatio:

In[5]:=
ResourceFunction["TaxonomyTree"][
 Entity["TaxonomicSpecies", "CarcharodonCarcharias::k6mys"], TreeLayout -> Left, AspectRatio -> 2]
Out[5]=

Applications (2) 

The complete human-to-apes lineage can be visualized by TaxonomyTree with a "Depth" setting of 5, starting with the species "homo sapiens":

In[6]:=
ResourceFunction["TaxonomyTree"][
 Entity["TaxonomicSpecies", "HomoSapiens::4pydj"], "Depth" -> 5, TreeLayout -> Left, AspectRatio -> 2]
Out[6]=

The taxonomy tree of a list of 18 different berry species reveals the 6 different plant orders from which they originate:

In[7]:=
berries = {
Entity["TaxonomicSpecies", "RubusHispidus::np7nv"], 
Entity["TaxonomicSpecies", "Vaccinium::5fb97"], 
Entity["TaxonomicSpecies", "RubusChamaemorus::cww57"], 
Entity["TaxonomicSpecies", "VacciniumMacrocarpon::544q3"], 
Entity["TaxonomicSpecies", "Ribes::5m496"], 
Entity["TaxonomicSpecies", "Sambucus::rqm95"], 
Entity["TaxonomicSpecies", "Gaylussacia::7rj7r"], 
Entity["TaxonomicSpecies", "RubusLoganobaccus::5gqdr"], 
Entity["TaxonomicSpecies", "Moraceae::82v75"], 
Entity["TaxonomicSpecies", "RubusIdaeus::n46t9"], 
Entity["TaxonomicSpecies", "RubusChamaemorus::cww57"], 
Entity["TaxonomicSpecies", "FragariaXAnanassa::xk578"], 
Entity["TaxonomicSpecies", "IlexMucronata::224c7"], 
Entity["TaxonomicSpecies", "VacciniumVitisIdaea::hjfn2"], 
Entity["TaxonomicSpecies", "VacciniumMyrtillus::846w6"], 
Entity["TaxonomicSpecies", "PhysalisPeruviana::h2fnb"], 
Entity["TaxonomicSpecies", "RubusCaesius::83c58"], 
Entity["TaxonomicSpecies", "RubusHybridCultivar::tqwk4"]};
In[8]:=
ResourceFunction["TaxonomyTree"][berries, AspectRatio -> 1/2]

TaxonomyTree corrected the two edges connecting the "rosids" subclass to "flowering species" and "Streptophytina" subphylum, by one edge to the "flowering species" class. The error originated in the loganberry taxonomic sequence. These errors will break the taxonomy tree when left uncorrected.

Possible Issues (4) 

If TaxonomyTree cannot find any child-taxa for a single-entity tree at the prevailing "Depth" setting, it will show an error message:

In[9]:=
ResourceFunction["TaxonomyTree"][
 Entity["TaxonomicSpecies", "NorwalkVirus::23h5h"], "Depth" -> 1]

TaxonomyTree only supports TaxonomicSpecies entities:

In[10]:=
ResourceFunction["TaxonomyTree"][Entity["FoodType", "Strawberry"]]
In[11]:=
ResourceFunction["TaxonomyTree", ResourceVersion->"1.0.0"][{Entity["FoodType", "Strawberry"], Entity["TaxonomicSpecies", "Vaccinium::5fb97"], Entity["FoodType", "Grape"]}]

A list of entities of length one is not valid:

In[12]:=
ResourceFunction["TaxonomyTree", ResourceVersion->"1.0.0"][{Entity["TaxonomicSpecies", "PantheraLeo::d7933"]}]

The "Depth" option will be ignored by TaxonomyTree when its argument is a list of entities:

In[13]:=
ResourceFunction["TaxonomyTree", ResourceVersion->"1.0.0"][{Entity["TaxonomicSpecies", "CarcharodonCarcharias::k6mys"], Entity["TaxonomicSpecies", "Quercus::k2384"]}, "Depth" -> 6]
Out[13]=

Neat Examples (3) 

Exploration of a species' taxonomy may start with a single entity. For example, the entire shark species taxonomy can be visualized by TaxonomyTree with a Depth setting of 7, commencing with the "great white shark" entity:

In[14]:=
sharks = ResourceFunction["TaxonomyTree"][
   Entity["TaxonomicSpecies", "CarcharodonCarcharias::k6mys"], "Depth" -> 7, TreeLayout -> Left];

TaxonomyTree preserves the entities in the tree, which allows one to select a subtree using a common name:

In[15]:=
TreeSelect[sharks, CommonName@TreeData@# == "Alopiidae" &]
Out[15]=

From the subtree, the entity objects can be copied to access their properties:

In[16]:=
TreeData /@ TreeLeaves@First@%
Out[16]=
In[17]:=
Entity["TaxonomicSpecies", "CetorhinusMaximus::93h8n"][
  "Dataset"] // DeleteMissing
Out[17]=

Publisher

Dave Middleton

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.2 – 21 February 2024
  • 1.0.1 – 12 February 2024
  • 1.0.0 – 07 February 2024

Related Resources

Author Notes

For a number of species, no child-taxa are available in the lower taxonomic levels within the entity framework. In these cases, any attempt to retrieve the child-taxa by TaxonomyTree will result in a performance penalty and a $Failed or Missing outcome. Therefore, an error message will be shown to invite the user to try a larger Depth value instead. A multiple-entity taxonomy tree can result in disjoint trees because there is no root taxon connecting each super-kingdom available in the entity framework. TaxonomyTree introduced EntityClass["TaxonomicSpecies”, All] as a root element, connecting all five super-kingdoms i.e. archaea, bacteria, eukaryotes and viruses as a solution to preserve the tree structure of the taxonomy.

License Information