qc_taxa_phylo: QC Taxa Phylo

View source: R/qc_taxa_phylo.R

qc_taxa_phyloR Documentation

QC Taxa Phylo

Description

Performs basic quality control on a phylogenetic list.

Usage

qc_taxa_phylo(
  data,
  finalid = "FinalID",
  phylo_names = c("Phylum", "Subphylum", "Class", "Subclass", "Order", "Suborder",
    "Family", "Subfamily", "Tribe", "Genus"),
  min_len = 2,
  ignore_case = FALSE
)

Arguments

data

A data frame

finalid

Column name for FinalID. Default = "FinalID"

phylo_names

Vector of phylogenetic names in order from coarse to fine. Default = c("Phylum", "Subphylum", "Class", "Subclass", "Order", "Suborder", "Family", "Subfamily", "Tribe", "Genus")

min_len

Minimum length of each field. Default = 2.

ignore_case

Should case be ignored for checks. Default = FALSE.

Details

Returns a list of with elements corresponding the various checks on a phylogenetic (standard or master) taxa list.

The phylogenetic list is multiple columns that the user will provide in rank order from coarse to fine along with a FinalID column.

The checks are listed below and only report the entries that fail.

Some checks will detect those with potential issues but others that are valid.

* **unique_parent** Each taxonomic rank (child) has a unique parent (coarser rank). Parents include all coarser ranks (as defined by user). Recommended to not include species and finer phylogenetic names as many false positives are generated.

* **phylo_unique_rank** Each name is in only one phylogenetic rank column. Species and finer taxonomic ranks should be ignored as possible to generate false positives.

* **phylo_as_finalid** Each phylogenetic name is also in FinalID.

* **finalid_as_phylo** Each final id is a phylogenetic name.

* **min_length** FinalID and each phylogenetic name is checked for number of characters. Default = 2.

others checks?

case (all lower, all upper)

spaces, ending, starting, double, regular and non-breaking spaces

?

non A-Z (any case), e.g., slash, dash, underscore, parentheses, etc.

If ignore_case is TRUE then all columns (finalid and phylo_names) will be converted to upper case before checks are performed.

Value

A list with elements for each qc check.

Examples

qc_phylo <- qc_taxa_phylo(TaxaMaster_Ben_BCG_PacNW,
                          "TaxaID",
                          phylo_names = c("Phylum",
                                          "SubPhylum",
                                          "Class",
                                          "SubClass",
                                          "Order",
                                          "SuperFamily",
                                          "Family",
                                          "Tribe",
                                          "Genus",
                                          "SubGenus",
                                          "Species"),
                          min_len = 2)

# issues
qc_phylo$issues         # names
sapply(qc_phylo, nrow)  # names and number of records
#
qc_phylo$unique_parent
qc_phylo$phylo_unique_rank
qc_phylo$phylo_as_finalid
qc_phylo$finalid_as_phylo


BioMonTools documentation built on Aug. 5, 2026, 1:08 a.m.