API Reference

Public

Taxonomy.LineageType
Lineage{T<:AbstractTaxon} <: AbstractVector{T}

A type that stores lineage information in Vector-like format. T represents element types, Taxon or UnclassifiedTaxon.

  • getindex is overloaded to get Taxon values. Symbols such as :superkingdom, :family, :genus, :species in CanonicalRanks can be used. Also, Between, From, Until, Cols and All selectors can be used in more complex rank selection scenarios.
  • Once reformatted, it cannot be reformatted again. The status can be checked using isreformatted(lineage).
source
Taxonomy.RankType
Rank(sym::Symbol)

Return CanonicalRank(sym) if sym is in CanonicalRanks. Return UnCanonicalRank(sym) if not. CanonicalRank(sym) can be used for isless comparison.

source
Taxonomy.RankMethod
Rank(taxon::Taxon)

Return CanonicalRank made from rank(taxon) if rank(taxon) is in CanonicalRanks. Return UnCanonicalRank(rank) if not. CanonicalRank(taxon) can be used for isless comparison.

source
Taxonomy.TaxonType
Taxon(taxid::Int, db::Taxonomy.DB)
Taxon(taxid::Int)

Construct a Taxon from its taxid. Omitting db automatically calls current_db(), which is usually the database that was last created.

source
AbstractTrees.childrenMethod
children(taxon::Taxon)

Return the vector of Taxon objects that are children of the given Taxon object.

source
AbstractTrees.parentMethod
AbstractTrees.parent(taxon::Taxon)

Return the Taxon object that is the parent of the given Taxon object.

source
Base.getMethod
get(db::Taxonomy.DB, idx::Union{Int,Symbol}, default)

Return the Taxon object stored for the given taxid or rank (i.e. :phylum), or the given default value if no mapping for the taxid is present.

source
Base.getMethod
get(db::Taxonomy.DB, taxid::Int, default)

Return the Taxon object stored for the given taxid, or the given default value if no mapping for the taxid is present.

source
Base.getMethod
get(db::Taxonomy.DB, name::String, default)

Return the Taxon object stored for the given name, or the given default value if no mapping for the name is present.

source
Taxonomy.isancestorMethod
isancestor(ancestor::Taxon, descendant::Taxon)

Return true if the former taxon is an ancestor of the latter taxon.

source
Taxonomy.lcaMethod
lca(taxa::Vector{Taxon})
lca(taxa::Taxon...)

Return the Taxon object that is the lowest common ancestor of the given set of Taxons.

source
Taxonomy.nameMethod
name(taxon::AbstractTaxon)

Return the name of the given Taxon object. It also works for an UnclassifiedTaxon object.

source
Taxonomy.name2taxidsMethod
name2taxids(name::AbstractString, db::Taxonomy.DB)
name2taxids(name::AbstractString)

Return a Vector of taxid from its name. name must match to the scientific name exactly. If multiple hits are found, return a multi-element Vector. If not, 1- or 0-element Vector. Omitting db automatically calls current_db(), which is usually the database that was last created.

source
Taxonomy.namedtupleMethod
namedtuple(lineage::Lineage; kwargs...)

Return a NamedTuple whose filednames is ranks (in the CanonicalRanks) of the lineage. This function is useful for converting Lineage to DataFrame, for example.

Arguments

  • fill_by_missing::Bool = false - If true, fills missing instead of UnclassifiedTaxon.
source
Taxonomy.print_lineageMethod
print_lineage(lineage::Lineage; kwargs...)
print_lineage(io::IO, lineage::Lineage; kwargs...)

Print a formatted representation of the lineage to the given IO object.

Arguments

  • delim::AbstractString = ";" - The delimiter between taxon fields.
  • fill::Bool = false - If true, prints UnclassifiedTaxon. only availavle when skip is false.
  • skip::Bool = false - If true, skip printing UnclassifiedTaxon and delimiter.
source
Taxonomy.rankMethod
rank(taxon::AbstractTaxon)

Return the rank of the given Taxon object. It also works for an UnclassifiedTaxon object.

source
Taxonomy.reformatMethod
reformat(l::Lineage, ranks::Vector{Symbol})

Return the Lineage object reformatted according to the given ranks. If there is no corresponding taxon in the lineage to the rank, UnclassifiedTaxon will be stored. Once a Lineage is reformatted, it cannot be reformatted again.

source
Taxonomy.similarnamesMethod
similarnames(query::AbstractString, db::Taxonomy.DB; distance::StringDistances.StringDistance=StringDistances.Levenshtein(), threshold::Float64=0.8)
similarnames(query::AbstractString; distance::StringDistances.StringDistance=StringDistances.Levenshtein(), threshold::Float64=0.8)

Find names similar to the query and return a Vector of NamedTuples with taxid, name, and similarity. The similarities are calculated by the Lavenshtein distance by default. It can also be changed to other distances defined in StringDistaces package by specifying it in the distance argument. Omitting db automatically calls current_db(), which is usually the database that was last created.

source

Internal

Taxonomy.DBType
Taxonomy.DB

Constructors

DB(nodes_dmp::String, names_dmp::String)

Create DB(taxonomy database) object from nodes.dmp and names.dmp files.

source
Base.islessMethod
isless(taxon::AbstractTaxon, rank::CanonicalRank)

Example

julia> Taxon(9606 , db) < Rank(:genus)
true

Return true if the rank of the former Taxon is less than the later rank.

source