class: center, middle, inverse, title-slide .title[ # Antarctic Marine Species Traits ] .subtitle[ ## A hands-on tour of the
worrms
R package ] .author[ ### Pablo Deschepper | Institute for Natural Sciences, Brussels ] .date[ ### 2026-03-31 ] --- --- class: inverse, center, middle # What is WoRMS? --- # World Register of Marine Species .pull-left[ The **authoritative global checklist** of all known marine species. Maintained by taxonomic experts, hosted by **VLIZ**. **WoRMS provides:** - Validated accepted names + full synonymy - Taxonomic classification (kingdom β species) - Trait / attribute data (functional groups, body size, IUCN status) - Geographic distribution - Cross-links to GBIF, BOLD, FishBase, IUCNβ¦ π [www.marinespecies.org](https://www.marinespecies.org) ] .pull-right[ <br><br> **The `worrms` R package** - Official rOpenSci R client for the WoRMS REST API - No API key required - Every function starts with `wm_` - Functions ending in `_` are **vectorised** - All results returned as **tibbles** ```r install.packages("worrms") library(worrms) ``` ] --- # Every taxon has a unique AphiaID The **AphiaID** is a stable integer identifier β the primary key across all `worrms` functions. .pull-left[ ``` r # Name β AphiaID krill_id <- wm_name2id("Euphausia superba") krill_id ``` ``` #> [1] 236217 ``` ``` r # AphiaID β name wm_id2name(236217) ``` ``` #> [1] "Euphausia superba" ``` ] .pull-right[ ``` r # Vectorised batch lookup (one API call) spp <- c("Euphausia superba", "Dissostichus eleginoides", "Notothenia coriiceps") wm_name2id_(spp) ``` ``` #> $`Euphausia superba` #> [1] 236217 #> #> $`Dissostichus eleginoides` #> [1] 234700 #> #> $`Notothenia coriiceps` #> [1] 234679 ``` ] --- class: inverse, center, middle # Function families --- # Family 1 β Full taxon records `wm_record()` is the workhorse: ~25 fields per taxon. .pull-left[ ``` r krill_record <- wm_record(236217)[1:15] |> glimpse() ``` ``` #> Rows: 1 #> Columns: 15 #> $ AphiaID <int> 236217 #> $ url <chr> "https://www.marinespecies.org/aphia.php?p=taxdetaβ¦ #> $ scientificname <chr> "Euphausia superba" #> $ authority <chr> "Dana, 1850" #> $ status <chr> "accepted" #> $ unacceptreason <lgl> NA #> $ taxonRankID <int> 220 #> $ rank <chr> "Species" #> $ valid_AphiaID <int> 236217 #> $ valid_name <chr> "Euphausia superba" #> $ valid_authority <chr> "Dana, 1850" #> $ parentNameUsageID <int> 110673 #> $ originalNameUsageID <int> 236217 #> $ kingdom <chr> "Animalia" #> $ phylum <chr> "Arthropoda" ``` ] .pull-right[ | Field | Meaning | |---|---| | `AphiaID` | Unique WoRMS identifier | | `scientificname` | Name queried | | `status` | `"accepted"` or `"unaccepted"` | | `valid_AphiaID` | Points to accepted record | | `rank` | Species, Genus, β¦ | | `isMarine` | Habitat flag | | `isBrackish` | Habitat flag | | `isFreshwater` | Habitat flag | | `isExtinct` | Extinction status | | `lsid` | Globally unique URI | ] --- # Family 1 β Searching & fuzzy matching .pull-left[ **Exact & fuzzy search** ``` r # Exact match wm_records_name("Euphausia superba") |> select(AphiaID, scientificname, status) ``` ``` #> # A tibble: 1 Γ 3 #> AphiaID scientificname status #> <int> <chr> <chr> #> 1 236217 Euphausia superba accepted ``` ``` r # Fuzzy β great for typos wm_records_name("Euphausia su", fuzzy = TRUE) |> select(scientificname, match_type) ``` ``` #> # A tibble: 1 Γ 2 #> scientificname match_type #> <chr> <chr> #> 1 Euphausia superba like ``` ] .pull-right[ **TAXAMATCH** β WoRMS' own algorithm, ideal for cleaning field species lists ``` r messy <- c("Euphausia superba", # correct "Euphausia supurba", # typo "Notothenia coriceps")# missing letter res <- wm_records_taxamatch(messy) bind_rows(res, .id = "query") |> select(query, scientificname, status, match_type) ``` ``` #> # A tibble: 3 Γ 4 #> query scientificname status match_type #> <chr> <chr> <chr> <chr> #> 1 1 Euphausia superba accepted exact #> 2 2 Euphausia superba accepted phonetic #> 3 3 Notothenia coriiceps accepted phonetic ``` ] --- # Family 2 β Taxonomy tree navigation .pull-left[ **Full classification path** ``` r wm_classification(236217) |> select(rank, scientificname) |> head() ``` ``` #> # A tibble: 6 Γ 2 #> rank scientificname #> <chr> <chr> #> 1 Kingdom Animalia #> 2 Phylum Arthropoda #> 3 Subphylum Crustacea #> 4 Superclass Multicrustacea #> 5 Class Malacostraca #> 6 Subclass Eumalacostraca ``` ] .pull.right[ **Direct children of a taxon** ``` r euphausiacea_id <- wm_name2id( "Euphausiacea") wm_children(euphausiacea_id) |> select(AphiaID, scientificname, status ) ``` ``` #> # A tibble: 3 Γ 3 #> AphiaID scientificname status #> <int> <chr> <chr> #> 1 110670 Bentheuphausiidae accepted #> 2 1649973 Euphausidae misspelling - incorrect original spelling #> 3 110671 Euphausiidae accepted ``` ] --- # Family 2 β Taxonomy tree navigation .pull-left[ **Rank lookups** ``` r wm_ranks_id(220) # β "Species" wm_ranks_name("Species") # β 220 ``` > β οΈ The same rank (e.g. *Species*) exists > independently in multiple kingdoms β > rank IDs are kingdom-specific. ] .pull.right[ **All species under a parent taxon** ``` r euphausiidae_id <- wm_name2id( "Euphausiidae") wm_records_rank(220, id = euphausiidae_id) |> select(AphiaID, scientificname, status) |> head() ``` ``` #> # A tibble: 6 Γ 3 #> AphiaID scientificname status #> <int> <chr> <chr> #> 1 370561 Boreophausia inermis superseded combination #> 2 492675 Boreophausia raschii superseded combination #> 3 1650121 Cyrtopia detruncata nomen dubium #> 4 492689 Cyrtopia rostrata nomen dubium #> 5 110682 Euphausia americana accepted #> 6 478929 Euphausia antarctica junior subjective synonym ``` ] --- # Family 3 β Synonyms & vernacular names .pull-left[ **Synonyms** ``` r # Euphausia superba syn <- wm_synonyms(236217) syn |> select(scientificname, status) ``` ``` #> # A tibble: 4 Γ 2 #> scientificname status #> <chr> <chr> #> 1 Euphausia antarctica junior subjective synonym #> 2 Euphausia australis junior subjective synonym #> 3 Euphausia glacialis junior subjective synonym #> 4 Euphausia murrayi junior subjective synonym ``` ] .pull-right[ **Common / vernacular names** ``` r # All common names for krill wm_common_id(236217) ``` ``` #> # A tibble: 4 Γ 3 #> vernacular language_code language #> <chr> <chr> <chr> #> 1 Antarctic krill eng English #> 2 Antarctisch krill nld Dutch #> 3 Antarktischer Krill deu German #> 4 krill antarctique fra French ``` ] --- # Family 4 β Distribution & external IDs .pull-left[ **Geographic distribution** ``` r krill_dist <- wm_distribution(236217) # Records per locality krill_dist |> count(locality, sort = TRUE) |> head(10) ``` ``` #> # A tibble: 1 Γ 2 #> locality n #> <chr> <int> #> 1 Antarctic Ocean 1 ``` **Literature sources** ``` r wm_sources(236217) |> select(source_id, reference, page) ``` ] .pull-right[ **Cross-links to external databases** | Code | Database | |---|---| | `tsn` | ITIS | | `bold` | Barcode of Life | | `eol` | Encyclopedia of Life | | `col` | Catalogue of Life | | `iucn` | IUCN Red List | | `fishbase` | FishBase | ``` r wm_external(234700, type = "fishbase") ``` ``` #> [1] 467 ``` ] --- class: inverse, center, middle # Family 5 β Trait attributes --- # Trait attributes β overview WoRMS stores structured **functional trait data** attached to taxa. .pull-left[ **Browse attribute type definitions** ``` r wm_attr_def(id = 1) # IUCN Red List wm_attr_def(id = 7) # Functional group wm_attr_def(id = 15) # Body size ``` ] .pull-right[ **Browse values within a category** ``` r wm_attr_category(id = 7) |> select(measurementValueID, measurementValue) ``` ``` #> # A tibble: 8 Γ 2 #> measurementValueID measurementValue #> <int> <chr> #> 1 183 benthos #> 2 184 plankton #> 3 194 nekton #> 4 323 neuston #> 5 621 pleuston #> 6 620 benthopelagic #> 7 378 edaphofauna #> 8 331 not applicable ``` ] --- # Trait attributes β overview **Fetch traits for a taxon** ``` r krill_attrs <- wm_attr_data(236217) krill_attrs |> glimpse() ``` ``` #> Rows: 8 #> Columns: 10 #> $ AphiaID <int> 236217, 236217, 236217, 236217, 236217, 236217, 2362β¦ #> $ measurementTypeID <int> 23, 23, 15, 15, 15, 15, 65, 62 #> $ measurementType <chr> "Species importance to society", "Species importanceβ¦ #> $ measurementValue <chr> "FAO-ASFIS: Species for Fishery Statistics Purposes"β¦ #> $ source_id <int> 197354, 127093, 560782, 560782, 560782, 560782, 2173β¦ #> $ reference <chr> "FAO Fishery Fact Sheets Collections: Aquatic Sciencβ¦ #> $ qualitystatus <chr> "unreviewed", "unreviewed", "unreviewed", "unrevieweβ¦ #> $ AphiaID_Inherited <int> 236217, 236217, 236217, 236217, 236217, 236217, 2362β¦ #> $ CategoryID <int> 13, 13, NA, NA, NA, NA, 30, 28 #> $ children <list> [<data.frame[1 x 10]>], [<data.frame[1 x 10]>], [<daβ¦ ``` --- # Trait attributes β overview **Vectorised batch retrieval** ``` r ids <- unlist(wm_name2id_(c( "Euphausia superba", "Dissostichus eleginoides", "Notothenia coriiceps"))) bind_rows(wm_attr_data_(ids)) |> select(AphiaID, measurementType, measurementValue) ``` ``` #> # A tibble: 16 Γ 3 #> AphiaID measurementType measurementValue #> <int> <chr> <chr> #> 1 236217 Species importance to society FAO-ASFIS: Species β¦ #> 2 236217 Species importance to society IUCN Red List #> 3 236217 Body size 18 #> 4 236217 Body size 60 #> 5 236217 Body size 19 #> 6 236217 Body size 59 #> 7 236217 Brooding No #> 8 236217 Development indirect development #> 9 234700 Species importance to society FAO-ASFIS: Species β¦ #> 10 234700 Body size 215 #> 11 234700 Body size 70 #> 12 234700 Species exhibits underwater soniferous behaviour Does not or is unliβ¦ #> 13 234679 Species importance to society FAO-ASFIS: Species β¦ #> 14 234679 Body size 62 #> 15 234679 Body size 50 #> 16 234679 Species exhibits underwater soniferous behaviour Does not or is unliβ¦ ``` --- # Trait attributes β querying by attribute `wm_attr_aphia()` flips the question: *which taxa have a given attribute?* ``` r # All taxa with an IUCN Red List category (attribute type 1) # Results are paginated β up to 50 per page taxa_with_iucn <- wm_attr_aphia(id = 1) head(taxa_with_iucn, 10) ``` ``` #> # A tibble: 10 Γ 2 #> AphiaID Attributes #> <int> <list> #> 1 100801 <df [1 Γ 10]> #> 2 100807 <df [1 Γ 10]> #> 3 100822 <df [1 Γ 10]> #> 4 100823 <df [1 Γ 10]> #> 5 100830 <df [1 Γ 10]> #> 6 100831 <df [1 Γ 10]> #> 7 100870 <df [1 Γ 10]> #> 8 100888 <df [1 Γ 10]> #> 9 100906 <df [1 Γ 10]> #> 10 100985 <df [1 Γ 10]> ``` --- class: inverse, center, middle # Use-case ### Antarctic *Notothenioidei* + GBIF --- # The workflow .center[ ``` WoRMS (worrms) GBIF (rgbif) βββββββββββββββββββββββββ ββββββββββββββββββββββββββ wm_name2id("Notothenioidei") wm_children() βββΊ occ_search() south of 60Β°S wm_records_rank() βββΊ bind_rows() + filter coords β visualise (ggplot2 + sf, EPSG:3031) ``` ] **Goal:** map *Notothenioidei* (dominant Antarctic fish suborder) occurrences with **colour = family** and explore **species richness** and **sampling effort** through time. --- # Step 1 β Build the species list .pull-left[ ``` r notothenioidei_id <- wm_name2id("Notothenioidei") # Confirm taxonomic position wm_classification(notothenioidei_id) |> select(rank, scientificname) ``` ``` #> # A tibble: 10 Γ 2 #> rank scientificname #> <chr> <chr> #> 1 Kingdom Animalia #> 2 Phylum Chordata #> 3 Subphylum Vertebrata #> 4 Infraphylum Gnathostomata #> 5 Parvphylum Osteichthyes #> 6 Gigaclass Actinopterygii #> 7 Superclass Actinopteri #> 8 Class Teleostei #> 9 Order Perciformes #> 10 Suborder Notothenioidei ``` ] .pull-right[ ``` r # Direct children (families) notothenioidei_families <- tryCatch( wm_children(notothenioidei_id), error = function(e) { message(conditionMessage(e)); tibble() } ) # All accepted species per family (rank 220 = Species) family_ids <- filter(notothenioidei_families, rank == "Family")$AphiaID family_names <- filter(notothenioidei_families, rank == "Family")$scientificname species_list <- map(family_ids, \(fid) tryCatch(wm_records_rank(220, id = fid), error = \(e) NULL)) names(species_list) <- family_names notothenioidei_spp <- bind_rows(species_list, .id = "family") |> filter(status == "accepted") cat("Total accepted species:", nrow(notothenioidei_spp)) ``` ``` #> Total accepted species: 120 ``` ] --- # Step 2 β GBIF occurrences south of 60Β°S ``` r target_species <- notothenioidei_spp$scientificname gbif_results <- map(target_species, \(sp) tryCatch( occ_search( scientificName = sp, decimalLatitude = "-90,-60", hasCoordinate = TRUE, limit = 200, fields = c("name", "decimalLatitude", "decimalLongitude", "year", "datasetName", "species") )$data, error = \(e) { message("Error for ", sp, ": ", conditionMessage(e)) NULL } )) gbif_df <- bind_rows(gbif_results) |> filter(!is.na(decimalLatitude), !is.na(decimalLongitude)) cat("Total GBIF records:", nrow(gbif_df)) ``` ``` #> Total GBIF records: 6996 ``` --- # Step 3 β Join gbif data with taxonomy ``` r # WoRMS lookup table worms_lookup <- notothenioidei_spp |> filter(scientificname %in% target_species) |> select(scientificname, AphiaID, family, isMarine, isExtinct) # Join onto GBIF records gbif_enriched <- gbif_df |> rename(scientificname = species) |> left_join(worms_lookup, by = "scientificname") ``` --- # Step 4 β Occurrence map (EPSG:3031) ``` r world <- ne_countries(scale = "medium", returnclass = "sf") gbif_sf <- st_as_sf(gbif_enriched, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326) occplot <- ggplot() + geom_sf(data = st_transform(world, 3031), fill = "grey80", colour = "white", linewidth = 0.15) + geom_sf(data = st_transform(gbif_sf, 3031), aes(colour = family), alpha = 0.7, size = 1.8) + coord_sf(crs = 3031, xlim = c(-4e6, 4e6), ylim = c(-4e6, 4e6)) + scale_colour_brewer(palette = "Set3", name = "Family") + labs(title = "Notothenioidei β GBIF occurrences south of 60Β°S", subtitle = paste0(nrow(gbif_enriched), " records | ", n_distinct(gbif_enriched$scientificname), " species"), x = NULL, y = NULL) + theme_minimal(base_size = 11) + theme(legend.position = "bottom", plot.title = element_text(face = "bold")) ``` --- # Step 4 β Occurrence map (EPSG:3031) ``` r occplot ``` <img src="worrms_antarctic_slides_files/figure-html/occurrence map-1.png" alt="" width="80%" style="display: block; margin: auto;" /> --- # Step 5 β Species richness & sampling effort .pull-left[ ``` r richness_plot <- notothenioidei_spp |> count(family, name = "n_species") |> mutate(family = fct_reorder( family, n_species)) |> ggplot(aes(n_species, family, fill = n_species)) + geom_col(show.legend = FALSE) + scale_fill_viridis_c( option = "mako", direction = -1) + labs(title = "Species richness", x = "Accepted species", y = NULL) + theme_minimal() ``` ] .pull-right[ ``` r richness_plot ``` <img src="worrms_antarctic_slides_files/figure-html/richness-plotted-1.png" alt="" width="80%" style="display: block; margin: auto;" /> ] --- # Step 5 β Species richness & sampling effort .pull-left[ ``` r temporal_plot <- gbif_enriched |> filter(!is.na(year)) |> mutate(decade = (year %/% 10) * 10) |> count(decade, family) |> ggplot(aes(decade, n, fill = family)) + geom_col() + scale_fill_brewer( palette = "Set3", name = "Family") + labs(title = "Records per decade", x = "Decade", y = "N occurrences") + theme_minimal() + theme(legend.position = "bottom") ``` ] .pull-right[ ``` r temporal_plot ``` <img src="worrms_antarctic_slides_files/figure-html/temporal-plotted-1.png" alt="" width="80%" style="display: block; margin: auto;" /> ] --- class: inverse, center, middle # Quick reference & best practices --- # All `worrms` functions at a glance .pull-left[ | Function | Purpose | `_` variant? | |---|---|:---:| | `wm_name2id()` | Name β AphiaID | β | | `wm_id2name()` | AphiaID β name | β | | `wm_record()` | Full AphiaRecord | β | | `wm_records_name()` | Search by name | β | | `wm_records_names()` | Multiple names | β | | `wm_records_taxamatch()` | TAXAMATCH | β | | `wm_records_common()` | Search by vernacular | β | | `wm_records_rank()` | Taxa by rank | β | | `wm_records_date()` | Modified since date | β | | `wm_classification()` | Full taxonomy path | β | | `wm_children()` | Direct children | β | ] .pull-right[ | Function | Purpose | `_` variant? | |---|---|:---:| | `wm_synonyms()` | All synonyms | β | | `wm_common_id()` | Vernacular names | β | | `wm_distribution()` | Distribution records | β | | `wm_external()` | External DB IDs | β | | `wm_record_by_external()` | External ID β WoRMS | β | | `wm_sources()` | Literature sources | β | | `wm_attr_def()` | Attribute definitions | β | | `wm_attr_category()` | Attribute values | β | ] --- | Function | Purpose | `_` variant? | |---|---|:---:| | `wm_attr_data()` | **Trait data** | β | | `wm_attr_aphia()` | Taxa by attribute | β | | `wm_ranks_id/name()` | Rank lookup | β | --- # Best practices .pull-left[ **1. Use `_` variants for multiple taxa** ```r # β N separate API calls map(my_ids, wm_record) # β One API call wm_record_(my_ids) ``` **2. Guard `wm_children()` with `tryCatch()`** ```r # HTTP 204 = no children β hard error tryCatch( wm_children(id), error = function(e) tibble() ) ``` ] .pull-right[ **3. Always check `status`** ```r records |> filter(status == "accepted") # Or redirect synonyms: records |> mutate( use_id = if_else( status == "accepted", AphiaID, valid_AphiaID)) ``` **4. Cache during development** ```r knitr::opts_chunk$set(cache = TRUE) ``` **5. Cite WoRMS** > WoRMS Editorial Board (2025). > World Register of Marine Species. > DOI: [10.14284/170](https://doi.org/10.14284/170) ] --- class: inverse, center, middle # Thank you **Full annotated tutorial:** <img src="worrms_antarctic_slides_files/figure-html/qr-code-1.png" alt="" width="25%" style="display: block; margin: auto;" /> **Other links:** π¦ [docs.ropensci.org/worrms](https://docs.ropensci.org/worrms) π [www.marinespecies.org](https://www.marinespecies.org) π¬ [obis.org](https://obis.org) π [docs.ropensci.org/rgbif](https://docs.ropensci.org/rgbif)