Performs basic quality control on a phylogenetic list.

qc_taxa_phylo(
  data,
  finalid = "FinalID",
  phylo_names = c("Phylum", "Subphylum", "Class", "Subclass", "Order", "Suborder",
    "Family", "Subfamily", "Tribe", "Genus"),
  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")

ignore_case

Should case be ignored for checks. Default = FALSE.

Value

A list with elements for each qc check.

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).

* **phylo_unique_rank** Each name is in only one phylogenetic rank column

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

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

others checks?

case (all lower, all upper)

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.

Examples

qc_phylo_PacNW <- qc_taxa_phylo(TaxaMaster_Ben_BCG_PacNW,
                                "TaxaID",
                                 phylo_names = c("Phylum",
                                                 "SubPhylum",
                                                 "Class",
                                                 "SubClass",
                                                 "Order",
                                                 "SuperFamily",
                                                 "Family",
                                                 "Tribe",
                                                 "Genus",
                                                 "SubGenus",
                                                 "Species"))
qc_phylo_PacNW$issues
#> [1] "unique_parent"     "phylo_unique_rank" "phylo_as_finalid" 
#> [4] "finalid_as_phylo" 
qc_phylo_PacNW$unique_parent
#> # A tibble: 11 × 5
#>    child_name      child_rank parent_rank parent_n parent_names                 
#>    <chr>           <chr>      <chr>          <int> <chr>                        
#>  1 Malacostraca    Class      SubPhylum          2 Crustacea, Hexapoda          
#>  2 Eumalacostraca  SubClass   SubPhylum          2 Crustacea, Hexapoda          
#>  3 Neotaenioglossa Order      SubClass           2 Prosobranchia                
#>  4 Amphipoda       Order      SubPhylum          2 Crustacea, Hexapoda          
#>  5 Enchytraeidae   Family     Order              2 Enchytraeida, Haplotaxida    
#>  6 Hydrobiidae     Family     SubClass           2 Prosobranchia                
#>  7 Cricotopus      Genus      Tribe              2 Orthocladiini                
#>  8 californica     Species    Genus              2 Calineuria, Pteronarcys      
#>  9 sp. A           Species    Genus              2 Heleniella, Paraphaenocladius
#> 10 californica     Species    Tribe              2 Acroneuriini, Pteronarcyini  
#> 11 californica     Species    Family             2 Perlidae, Pteronarcyidae     
qc_phylo_PacNW$phylo_unique_rank
#> # A tibble: 4 × 5
#>   phylo_name  phylo_level n_phylo_name match_finalid num_phylo_col
#>   <chr>       <fct>              <int> <lgl>                 <int>
#> 1 Polychaeta  SubPhylum              2 FALSE                     2
#> 2 Polychaeta  Class                  2 FALSE                     2
#> 3 Ptilostomis Genus                  2 FALSE                     2
#> 4 Ptilostomis SubGenus               2 FALSE                     2
qc_phylo_PacNW$phylo_as_finalid
#> # A tibble: 354 × 4
#>    phylo_name      phylo_level n_phylo_name match_finalid
#>    <chr>           <fct>              <int> <lgl>        
#>  1 Annelida        Phylum                49 FALSE        
#>  2 Arthropoda      Phylum               595 FALSE        
#>  3 Cnidaria        Phylum                 1 FALSE        
#>  4 Mollusca        Phylum                32 FALSE        
#>  5 Nemertea        Phylum                 1 FALSE        
#>  6 Platyhelminthes Phylum                 3 FALSE        
#>  7 Chelicerata     SubPhylum             45 FALSE        
#>  8 Clitellata      SubPhylum             48 FALSE        
#>  9 Crustacea       SubPhylum             17 FALSE        
#> 10 Hexapoda        SubPhylum            533 FALSE        
#> # ℹ 344 more rows
qc_phylo_PacNW$finalid_as_phylo
#>                                 TaxaID match_phylo
#> 1             Heterlimnius corpulentus       FALSE
#> 2                      Ceratopogoninae       FALSE
#> 3                       Orthocladiinae       FALSE
#> 4           Baetis flavistriga complex       FALSE
#> 5           Baetis tricaudatus complex       FALSE
#> 6                 Ephemerella tibialis       FALSE
#> 7                     Timpanoga hecuba       FALSE
#> 8                  Ecdyonurus criddlei       FALSE
#> 9             Epeorus longimanus group       FALSE
#> 10              Calineuria californica       FALSE
#> 11               Hesperoperla pacifica       FALSE
#> 12                       Goera archaon       FALSE
#> 13                    Parapsyche elsis       FALSE
#> 14           Rhyacophila betteni group       FALSE
#> 15     Rhyacophila brunnea/vemna group       FALSE
#> 16         Rhyacophila hyalinata group       FALSE
#> 17                 Neophylax splendens       FALSE
#> 18                         Sphaeriidae       FALSE
#> 19                     Narpus concolor       FALSE
#> 20                      Forcipomyiinae       FALSE
#> 21                     Diphetor hageni       FALSE
#> 22                    Zapada cinctipes       FALSE
#> 23                      Arctopsychinae       FALSE
#> 24                   Parapsyche almota       FALSE
#> 25       Lepidostoma-panel case larvae       FALSE
#> 26                     Truncatelloidea       FALSE
#> 27                  Acentrella turbida       FALSE
#> 28     Ephemerella dorothea/excrucians       FALSE
#> 29              Epeorus albertae group       FALSE
#> 30                 Rhyacophila blarina       FALSE
#> 31                  Cleptelmis addenda       FALSE
#> 32                         Podonominae       FALSE
#> 33      Lepidostoma-turret case larvae       FALSE
#> 34                         Tanypodinae       FALSE
#> 35                       Prodiamesinae       FALSE
#> 36              Octogomphus specularis       FALSE
#> 37                    Drunella doddsii       FALSE
#> 38            Zapada oregonensis group       FALSE
#> 39          Rhyacophila atrata complex       FALSE
#> 40                  Rhyacophila narvae       FALSE
#> 41                    Despaxia augusta       FALSE
#> 42          Rhyacophila vetina complex       FALSE
#> 43      Orthocladius (Symposiocladius)       FALSE
#> 44        Microtendipes pedellus group       FALSE
#> 45                     Psephenus falli       FALSE
#> 46                          Diamesinae       FALSE
#> 47               Epeorus grandis group       FALSE
#> 48                 Rhyacophila malkini       FALSE
#> 49                    Ampumixis dispar       FALSE
#> 50          Drunella grandis/spinifera       FALSE
#> 51            Rhyacophila vofixa group       FALSE
#> 52                Neophylax occidentis       FALSE
#> 53                Pteronarcys princeps       FALSE
#> 54                 Ordobrevia nubifera       FALSE
#> 55  Heterotrissocladius marcidus group       FALSE
#> 56               Thienemannimyia group       FALSE
#> 57               Hydatophylax hesperus       FALSE
#> 58              Pristinicola hemphilli       FALSE
#> 59         Heteroplectron californicum       FALSE
#> 60                Dicosmoecus gilvipes       FALSE
#> 61                     Hemerodromiinae       FALSE
#> 62        Rhabdomastix fascigera group       FALSE
#> 63    Paraleptophlebia bicornuta group       FALSE
#> 64                   Radix auricularia       FALSE
#> 65                Orthocladius complex       FALSE
#> 66          Cricotopus trifascia group       FALSE
#> 67                 Calliperla luctuosa       FALSE
#> 68           Rhyacophila grandis group       FALSE
#> 69                 Attenella delantala       FALSE
#> 70                   Neophylax rickeri       FALSE
#> 71                        Chironominae       FALSE
#> 72                         Tubificinae       FALSE
#> 73             Cricotopus (Cricotopus)       FALSE
#> 74                 Rhyacophila arnaudi       FALSE
#> 75    Eukiefferiella claripennis group       FALSE
#> 76         Eukiefferiella brehmi group       FALSE
#> 77             Tvetenia bavarica group       FALSE
#> 78                 Attenella margarita       FALSE
#> 79       Eukiefferiella devonica group       FALSE
#> 80    Drunella coloradensis/flavilinea       FALSE
#> 81             Pteronarcys californica       FALSE
#> 82           Rhyacophila vagrita group       FALSE
#> 83          Cricotopus bicinctus group       FALSE
#> 84         Tvetenia discoloripes Group       FALSE
#> 85    Stempellinella/Zavrelia (Bad ID)       FALSE
#> 86             Potthastia gaedii group       FALSE
#> 87              Ptilostomis ocellifera       FALSE
#> 88          Potthastia longimana group       FALSE
#> 89             Cricotopus (Isocladius)       FALSE
#> 90            Acentrella insignificans       FALSE
#> 91          Brachycentrus occidentalis       FALSE
#> 92        Lepidostoma-sand case larvae       FALSE
#> 93         Eukiefferiella gracei group       FALSE
#> 94               Onocosmoecus unicolor       FALSE
#> 95    Eukiefferiella brevicalcar group       FALSE
#> 96            Caudatella heterocaudata       FALSE
#> 97                     Drunella pelosa       FALSE
#> 98                    Matriella teresa       FALSE
#> 99          Rhyacophila angelita group       FALSE
#> 100 Eukiefferiella pseudomontana group       FALSE
#> 101       Rhyacophila nevadensis group       FALSE
#> 102                          Oribatida       FALSE
#> 103                           Naidinae       FALSE
#> 104           Brachycentrus americanus       FALSE
#> 105                  Pedomoecus sierra       FALSE
#> 106                Claassenia sabulosa       FALSE
#> 107             Allocosmoecus partitus       FALSE
#> 108                  Visoka cataractae       FALSE
#> 109               Serratella micheneri       FALSE
#> 110     Rhyacophila coloradensis group       FALSE
#> 111           Psychoglypha subborealis       FALSE
#> 112         Rhyacophila sibirica group       FALSE
#> 113              Margaritifera falcata       FALSE
#> 114                  Zapada columbiana       FALSE
#> 115                         Limoniinae       FALSE
#> 116           Telmatodrilus vejdovskyi       FALSE
#> 117                Dicosmoecus atripes       FALSE
#> 118                   Heleniella sp. A       FALSE
#> 119        Rhabdomastix setigera group       FALSE
#> 120              Slavina appendiculata       FALSE
#> 121                         Brachycera       FALSE
#> 122    Eukiefferiella tirolensis group       FALSE
#> 123                     Zapada frigida       FALSE
#> 124         Cystobranchus salmositicus       FALSE
#> 125           Doncricotopus bicaudatus       FALSE
#> 126          Baetis bicaudatus complex       FALSE
#> 127        Bothrioneurum vejdovskyanum       FALSE
#> 128          Rhyacophila basalis group       FALSE
#> 129           Potamopyrgus antipodarum       FALSE
#> 130  Eukiefferiella coerulescens group       FALSE
#> 131            Nerophilus californicus       FALSE
#> 132          Rhyacophila rotunda group       FALSE
#> 133                 Caudatella hystrix       FALSE
#> 134            Paraphaenocladius sp. A       FALSE
#> 135        Camptocladius steracorarius       FALSE
#> 136              Orohermes crepusculus       FALSE
#> 137           Epeorus deceptivus group       FALSE
#> 138                         Nematocera       FALSE
#> 139                 Stylaria lacustris       FALSE
#> 140                      LEPTOHYPHIDAE       FALSE
#> 141      Orthocladius (Euorthocladius)       FALSE
#> 142    PHAENOPSECTRA/TRIBELOS (Bad ID)       FALSE
#> 143                     Limnephiloidea       FALSE
#> 144                 Psychoglypha bella       FALSE
#> 145                        Muscomorpha       FALSE
#> 146                          PISCICOLA       FALSE
#> 147                       Clinocerinae       FALSE
#> 148           Pseudosuccinea columella       FALSE
#> 149            Thienemanniola (Bad ID)       FALSE
#> 150                  Micrasema dimicki       FALSE
#> 151             Lepidostoma cascadense       FALSE
#> 152        Lepidostoma (Neodinarthrum)       FALSE
#> 153                      Protzia exima       FALSE
#> 154                       Baetis alius       FALSE
#> 155                       Hydroporinae       FALSE
#> 156                          Harnishia       FALSE
#> 157        Cricotopus (Nostococladius)       FALSE
#> 158                         Lumbricina       FALSE
#> 159                       Colymbetinae       FALSE
#> 160     Microtendipes rydalensis group       FALSE
#> 161            Lepidostoma hoodi group       FALSE
#> 162        Orthocladius (Orthocladius)       FALSE
#> 163              Ophidonais serpentina       FALSE
#> 164           Baetodes tritus (Bad ID)       FALSE
#> 165                Chyrandra centralis       FALSE
#> 166               Amphicosmoecus canax       FALSE
#> 167                           Neoporus       FALSE
#> 168              Kincaidiana hexatheca       FALSE
#> 169                  Tribelos jucundus       FALSE
#> 170           Palaeagapetus nearcticus       FALSE
#> 171                 Atractelmis wawona       FALSE