Author: Brian Maitner
Date: 2024-05-12

# Taxonomic Names Resolution Service

#### Brian Maitner

#### 2024-05-12

## About the Taxonomic Name Resolution Service

The Taxonomic Name Resolution Service (TNRS) is a tool for automated standardization of plant scientific names.

The TNRS corrects spelling errors and alternative spellings to a standard list of names, and converts out of date names (synonyms) to the current accepted name. The TNRS can process many names at once, saving hours of tedious and error-prone manual name correction. For names that cannot be resolved automatically, the TNRS present a list of possibilities and provides tools for researching and selecting the preferred name.

# Using the TNRS

The TNRS takes as input either a vector of scientific names, or a data.frame containing two columns: row number and scientific name.

    library(TNRS)

    # First, we'll grab an example dataset containing two columns: row number and scientific name.
    fulldata <- tnrs_testfile

    head(fulldata, n = 20)

    ##    ID
    ## 1   1
    ## 2   2
    ## 3   3
    ## 4   4
    ## 5   5
    ## 6   6
    ## 7   7
    ## 8   8
    ## 9   9
    ## 10 10
    ## 11 11
    ## 12 12
    ## 13 13
    ## 14 14
    ## 15 15
    ## 16 16
    ## 17 17
    ## 18 18
    ## 19 19
    ## 20 20
    ##                                                                                      taxon
    ## 1                                                                       Arecaceae Mauritia
    ## 2                                                        Solanaceae Solanum bipatens Dunal
    ## 3                        HYPOPTERYGIACEAE Hypopterygium incrassatolimbatum Ma^sAAAll. Hal.
    ## 4                                                     Helotiaceae Diplothrix juniperifolia
    ## 5                                                      Arecaceae Leopoldinia pulchra Mart.
    ## 6                                                        Melastomataceae Leandra schenckii
    ## 7                                                                   Hydnocarpus macrocarpa
    ## 8                      Campyliaceae Warnstorfia trichophylla (Warnst. ) Tuom. & T. J. Kop.
    ## 9                                                                     Piper arboreum Aubl.
    ## 10                                         Poaceae Pseudochaetochloa australiensis Hitchc.
    ## 11 Juglandaceae Engelhardia spicata var. colebrookeana (Lindl. ex Wall. ) Koord. & Valeton
    ## 12                                                          Malvaceae Hibiscus 'Old Yella'
    ## 13                                                           Fabaceae Mimosa vepres Lindm.
    ## 14                                               Berberidaceae Epimedium xpurpureum Bailly
    ## 15                                                       Asteraceae Senecio beguei Humbert
    ## 16                                                                      Coelogyne fragrans
    ## 17                                           Cyperaceae Rhynchospora cephalotes (L. ) Vahl
    ## 18                                                Pteridophyte Nephrolepis mollis Rosenst.
    ## 19                                                      Piperaceae Piper crassipeduncullum
    ## 20                                 Asteraceae Hieracium billyanum var. parvulum B. de Retz

    # Note that there are a variety of formats represented here, sometimes including
    # scientific name only
    # genus only
    # family and genus
    # family, scientific name, and author

    results <- TNRS(taxonomic_names = fulldata)

    # Inspect the results
    head(results, 10)

    ##    ID                                                      Name_submitted
    ## 1   1                                                  Arecaceae Mauritia
    ## 2   2                                   Solanaceae Solanum bipatens Dunal
    ## 3   3   HYPOPTERYGIACEAE Hypopterygium incrassatolimbatum Ma^sAAAll. Hal.
    ## 4   4                                Helotiaceae Diplothrix juniperifolia
    ## 5   5                                 Arecaceae Leopoldinia pulchra Mart.
    ## 6   6                                   Melastomataceae Leandra schenckii
    ## 7   7                                              Hydnocarpus macrocarpa
    ## 8   8 Campyliaceae Warnstorfia trichophylla (Warnst. ) Tuom. & T. J. Kop.
    ## 9   9                                                Piper arboreum Aubl.
    ## 10 10                     Poaceae Pseudochaetochloa australiensis Hitchc.
    ##    Overall_score Name_matched_id                     Name_matched Name_score
    ## 1      1.0000000         1408073                         Mauritia  1.0000000
    ## 2      1.0000000         1725998                 Solanum bipatens  1.0000000
    ## 3      0.9302800         1147521 Hypopterygium incrassatolimbatum  1.0000000
    ## 4      0.5995738           82217         Diplothrix juniperifolia  0.5995738
    ## 5      1.0000000          219935              Leopoldinia pulchra  1.0000000
    ## 6      1.0000000         1065588                Leandra schenckii  1.0000000
    ## 7      1.0000000          918035           Hydnocarpus macrocarpa  1.0000000
    ## 8      0.6796591         1131553         Warnstorfia trichophylla  0.5995738
    ## 9      1.0000000          473591                   Piper arboreum  1.0000000
    ## 10     1.0000000          886582  Pseudochaetochloa australiensis  1.0000000
    ##    Name_matched_rank              Author_submitted              Author_matched
    ## 1              genus
    ## 2            species                         Dunal                       Dunal
    ## 3            species               Ma^sAAAll. Hal.                  Müll. Hal.
    ## 4            species
    ## 5            species                         Mart.                       Mart.
    ## 6            species
    ## 7            species
    ## 8            species (Warnst. ) Tuom. & T. J. Kop. (Warnst.) Tuom. & T.J. Kop.
    ## 9            species                         Aubl.                       Aubl.
    ## 10           species                       Hitchc.                     Hitchc.
    ##    Author_score            Canonical_author Name_matched_accepted_family
    ## 1            NA                        L.f.                    Arecaceae
    ## 2        1.0000                       Dunal                   Solanaceae
    ## 3        0.6514                  Müll. Hal.             Hypopterygiaceae
    ## 4            NA                         DC.                   Asteraceae
    ## 5        1.0000                       Mart.                    Arecaceae
    ## 6            NA                       Cogn.              Melastomataceae
    ## 7            NA               (Bedd.) Warb.                  Achariaceae
    ## 8        1.0000 (Warnst.) Tuom. & T.J. Kop.              Calliergonaceae
    ## 9        1.0000                       Aubl.                   Piperaceae
    ## 10       1.0000                     Hitchc.                      Poaceae
    ##      Genus_submitted     Genus_matched Genus_score Specific_epithet_submitted
    ## 1           Mauritia          Mauritia           1
    ## 2            Solanum           Solanum           1                   bipatens
    ## 3      Hypopterygium     Hypopterygium           1         incrassatolimbatum
    ## 4         Diplothrix        Diplothrix           1              juniperifolia
    ## 5        Leopoldinia       Leopoldinia           1                    pulchra
    ## 6            Leandra           Leandra           1                  schenckii
    ## 7        Hydnocarpus       Hydnocarpus           1                 macrocarpa
    ## 8        Warnstorfia       Warnstorfia           1               trichophylla
    ## 9              Piper             Piper           1                   arboreum
    ## 10 Pseudochaetochloa Pseudochaetochloa           1              australiensis
    ##    Specific_epithet_matched Specific_epithet_score Family_submitted
    ## 1                                               NA        Arecaceae
    ## 2                  bipatens                      1       Solanaceae
    ## 3        incrassatolimbatum                      1 Hypopterygiaceae
    ## 4             juniperifolia                      1      Helotiaceae
    ## 5                   pulchra                      1        Arecaceae
    ## 6                 schenckii                      1  Melastomataceae
    ## 7                macrocarpa                      1
    ## 8              trichophylla                      1     Campyliaceae
    ## 9                  arboreum                      1
    ## 10            australiensis                      1          Poaceae
    ##      Family_matched Family_score Infraspecific_rank
    ## 1         Arecaceae            1
    ## 2        Solanaceae            1
    ## 3  Hypopterygiaceae            1
    ## 4                             NA
    ## 5         Arecaceae            1
    ## 6   Melastomataceae            1
    ## 7                             NA
    ## 8                             NA
    ## 9                             NA
    ## 10          Poaceae            1
    ##    Infraspecific_epithet_matched Infraspecific_epithet_score
    ## 1                                                         NA
    ## 2                                                         NA
    ## 3                                                         NA
    ## 4                                                         NA
    ## 5                                                         NA
    ## 6                                                         NA
    ## 7                                                         NA
    ## 8                                                         NA
    ## 9                                                         NA
    ## 10                                                        NA
    ##    Infraspecific_rank_2 Infraspecific_epithet_2_matched
    ## 1
    ## 2
    ## 3
    ## 4
    ## 5
    ## 6
    ## 7
    ## 8
    ## 9
    ## 10
    ##    Infraspecific_epithet_2_score Annotations Unmatched_terms
    ## 1                             NA
    ## 2                             NA
    ## 3                             NA
    ## 4                             NA                 Helotiaceae
    ## 5                             NA
    ## 6                             NA
    ## 7                             NA
    ## 8                             NA                Campyliaceae
    ## 9                             NA
    ## 10                            NA
    ##                                                       Name_matched_url
    ## 1   https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:31356-1
    ## 2  https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:818455-1
    ## 3                https://www.worldfloraonline.org/taxon/wfo-0001162747
    ## 4  https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:201833-1
    ## 5  https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:667794-1
    ## 6  https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:136759-2
    ## 7                https://www.worldfloraonline.org/taxon/wfo-0000926452
    ## 8                https://www.worldfloraonline.org/taxon/wfo-0001146720
    ## 9  https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:680435-1
    ## 10 https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:418837-1
    ##    Name_matched_lsid Phonetic Taxonomic_status              Accepted_name
    ## 1                           Y         Accepted                   Mauritia
    ## 2                           Y          Synonym        Solanum cordifolium
    ## 3                           Y          Synonym    Hypopterygium tamarisci
    ## 4                           Y          Synonym       Zinnia juniperifolia
    ## 5                           Y         Accepted        Leopoldinia pulchra
    ## 6                           Y          Synonym      Miconia alterninervia
    ## 7                           Y         Accepted     Hydnocarpus macrocarpa
    ## 8                           Y          Synonym Sarmentypnum trichophyllum
    ## 9                           Y         Accepted             Piper arboreum
    ## 10                          Y          Synonym        Cenchrus arnhemicus
    ##              Accepted_species      Accepted_name_author Accepted_name_id
    ## 1                                                  L.f.          1408073
    ## 2         Solanum cordifolium                     Dunal          1015964
    ## 3     Hypopterygium tamarisci (Sw.) Brid. ex Müll. Hal.          1147590
    ## 4        Zinnia juniperifolia                    A.Gray            90034
    ## 5         Leopoldinia pulchra                     Mart.           219935
    ## 6       Miconia alterninervia        (Cogn.) R.Goldenb.          1434412
    ## 7      Hydnocarpus macrocarpa             (Bedd.) Warb.           918035
    ## 8  Sarmentypnum trichophyllum         (Warnst.) Hedenäs          1198425
    ## 9              Piper arboreum                     Aubl.           473591
    ## 10        Cenchrus arnhemicus        (F.Muell.) Morrone           908972
    ##    Accepted_name_rank
    ## 1               genus
    ## 2             species
    ## 3             species
    ## 4             species
    ## 5             species
    ## 6             species
    ## 7             species
    ## 8             species
    ## 9             species
    ## 10            species
    ##                                                        Accepted_name_url
    ## 1     https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:31356-1
    ## 2    https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:818796-1
    ## 3                  https://www.worldfloraonline.org/taxon/wfo-0001162816
    ## 4    https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:261346-1
    ## 5    https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:667794-1
    ## 6  https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:77207378-1
    ## 7                  https://www.worldfloraonline.org/taxon/wfo-0000926452
    ## 8                  https://www.worldfloraonline.org/taxon/wfo-0001213924
    ## 9    https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:680435-1
    ## 10 https://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:77105982-1
    ##    Accepted_name_lsid  Accepted_family Overall_score_order
    ## 1                            Arecaceae                   1
    ## 2                           Solanaceae                   1
    ## 3                     Hypopterygiaceae                   1
    ## 4                           Asteraceae                   1
    ## 5                            Arecaceae                   1
    ## 6                      Melastomataceae                   1
    ## 7                          Achariaceae                   1
    ## 8                      Calliergonaceae                   1
    ## 9                           Piperaceae                   1
    ## 10                             Poaceae                   1
    ##    Highertaxa_score_order Source Warnings  WarningsEng
    ## 1                       1   wcvp        0
    ## 2                       1   wcvp        0
    ## 3                       1    wfo        0
    ## 4                       2   wcvp        4 [HigherTaxa]
    ## 5                       1   wcvp        0
    ## 6                       1   wcvp        0
    ## 7                       1    wfo        0
    ## 8                       2    wfo        4 [HigherTaxa]
    ## 9                       1   wcvp        0
    ## 10                      1   wcvp        0

    # The output includes information on the name submitted, the match score (how close the match is), the name matched, the status of the matched name, and the accepted name.

# TNRS metadata

When using the TNRS, we ask that you cite both the TNRS itself and the data sources that are used by the TNRS. The TNRS couldn’t function without these data sources, and it is important to recognize the work of these data providers by citing their work. Users may also want to report metadata about the version of the TNRS they used in their analyses for the purposes of reproducibility. The function `TNRS_metadata` facilitates citations and version reporting by providing this information in an easily-used format. This function returns:

1. Bibtex-formatted citation information. This information can be optionally be written to a file specified by the “bibtex_file” argument.
2. Information about TNRS data sources
3. TNRS version information

    metadata <- TNRS_metadata()

    # If you want to see the TNRS version information (e.g. to report in an manuscript):

    metadata$version

    ##   app_version db_version build_date code_version api_version
    ## 1         5.3        4.4 2024-01-17          5.1         5.2

    # To see the sources that are used by the TNRS:

    metadata$sources

    ##   sourceID sourceName                           sourceNameFull
    ## 1        1        wfo                       World Flora Online
    ## 2        2       wcvp       World Checklist of Vascular Plants
    ## 3        3       cact Cactaceae checklist (caryophyllales.org)
    ##                                        sourceUrl geographic_scope
    ## 1               http://www.worldfloraonline.org/           global
    ## 2                  https://wcvp.science.kew.org/           global
    ## 3 https://caryophyllales.org/cactaceae/Checklist           global
    ##   taxonomic_scope   scope
    ## 1     Embryophyta  global
    ## 2    Tracheophyta  global
    ## 3       Cactaceae limited
    ##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            description
    ## 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 The World Flora Online will be an open-access, Web-based compendium of the worlds plant species. It will be a collaborative, international project, building upon existing knowledge and published floras, checklists and revisions but will also require the collection and generation of new information on poorly know plant groups and plants in unexplored regions. WFO replaces The Plant List
    ## 2  The World Checklist of Vascular Plants is based on Kew names and taxonomic backbone which has been created by reconciling the names from the International Plant Names Index (IPNI) with the taxonomy from the World Checklist of Selected Plant Families (WCSP). This Beta version therefore only displays names that are in both IPNI and WCVP. It contains both families that have been completed and peer reviewed by both external and internal experts on the relevant families as well as families that are in the process of being edited and reviewed. Some of the original data which WCSP built upon came from our generous collaborators listed in the acknowledgements. WCVP aims to represent a global consensus view of current plant taxonomy by reflecting the latest published taxonomies while incorporating the opinions of taxonomists based around the world.
    ## 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Cactaceae at Caryophyllales.org – a dynamic online species-level taxonomic backbone for the family.
    ##                                                                       dataUrl
    ## 1 https://files.worldfloraonline.org/files/WFO_Backbone/_WFOCompleteBackbone/
    ## 2                     http://sftp.kew.org/pub/data-repositories/WCVP/wcvp.zip
    ## 3                                                                [by request]
    ##                                                                   logo_path
    ## 1 https://bien.nceas.ucsb.edu/bien/wp-content/uploads/2021/07/wfo_logo.jpeg
    ## 2  https://bien.nceas.ucsb.edu/bien/wp-content/uploads/2021/07/kew_logo.png
    ## 3 https://bien.nceas.ucsb.edu/bien/wp-content/uploads/2024/02/cact_logo.png
    ##   isDefault   version sourceReleaseDate tnrsDateAccessed
    ## 1         1 v.2023.06        2023-06-01       2024-01-10
    ## 2         0        12        2023-09-28       2024-01-08
    ## 3         0      <NA>              <NA>       2023-11-02

    # To get the citation information to paste into a reference manager (e.g. paperpile, zotero):

    # writeLines(text = metadata$citations$citation)