Let’s imagine that we are interested in a species in a given area and wish to know as much as possible about it. But, you can’t go out in the field because funding is running short. What we do have, however, is a certain knowledge of the open data science tools that are at our disposal. In a series of post about online ecology, we will find out exactly just how far these tools allow us to delve into the ecology of the species that interest us.
Online ecology posts:
This post focuses on the simplest yet still complicated aspect of ecology, i.e. describing a species as thoroughly as possible with the tools at our disposal.
Special thanks to the developers at ROpenSci, who built many of the R package used to access the open access tools we present in this post.
sessionInfo()[]$version.string #R>  "R version 3.5.0 (2017-01-27)"
We start by selecting the species and the area in which we are interested. For this post, we focus on the Atlantic cod (Gadus morhua) in the estuary and gulf of St. Lawrence in eastern Canada.
Let’s set the parameters and create the spatial bounding box that we will be using for the area of interest. Note that all these parameters can be changed to extract information for other species in other habitats.
# Species of interest sp <- 'Gadus morhua' # Extent of area of interest latmax <- 52.01312 latmin <- 45.52399 lonmax <- -55.73636 lonmin <- -71.06333 # Create a spatial bounding box for the area of interest using the 'sf' package: # create a matrix: bb <- cbind(c(lonmin,lonmax,lonmax,lonmin,lonmin), c(latmin,latmin,latmax,latmax,latmin)) %>% # put that matrix into a list, because that's what `st_polygon()` needs list() %>% # Make the matrix a 'simple features' polygon: sf::st_polygon() %>% # and let's make it a simple feature column and give it information about the projection: sf::st_sfc(crs="+proj=longlat +datum=WGS84") %>% # finally, let's put the sfc in a simple features data.frame in the variable `geometry`: sf::st_sf(name="Study Site",geometry=.)
We’ll start with a description of the species. First, let’s see what fishbase has to offer. This online data repository, along with sealifebase, contains a lot of precious information on marine and aquatic species all over the world and is accessible through the package
# Species ecology ecol <- rfishbase::ecology(sp) ecol <- cbind(colnames(ecol), t(ecol)) rownames(ecol) <- NULL ecol <- ecol[ecol[,2] != 0, ] # remove 0 ecol <- ecol[!is.na(ecol[,2]), ] # remove NAs knitr::kable(ecol, col.names = c('Descriptors', 'Attributes'), "html") %>% kableExtra::kable_styling(full_width = FALSE)
|Herbivory2||mainly animals (troph. 2.8 and up)|
|FeedingType||hunting macrofauna (predator)|
|DietRemark||Troph of adults from 7 studies.|
|FoodRemark||Trophic level estimated from a number of food items using a randomized resampling routine.|
|AddRems||Opportunistic predator that forages mainly at dawn and dusk (Refs. 1371, 46189). Larvae feed mainly on zooplankton while juveniles prey predominantly on benthic crustaceans; adults feed mainly on zoobenthos and fish (Refs. 5743, 9604, 26813) including juvenile cod. Fish prey becomes more common in the diet with increasing body size (Refs. 1371, 89387). Adults may cover large distances during the feeding period (Ref. 89387). Young cod are also preyed upon by different fish species and octopus. Adult cod are prey items of top predators like sharks, rays, whales, dolphins, seals, and sea birds (Refs. 9023, 9581, 26954, 43651, 45735). In the Baltic it grows up to 5 kg weight in 7-8 years; in the North Sea it reaches 8 kg in the same time span . Natural mortality for adults of both stocks is assumed to be around M=0.2, resulting in a mean adult life expectancy and mean duration of the reproductive phase of 5 years (Ref. 88171). Parasites of the species include protozoans (trypanosome), myxosporidians, monogeneid, trematodes, cestodes, nematodes, acanthocephalan, hirudinid and copepods (Ref. 5951).|
|SchoolingLifestage||juveniles and adults|
|AssociationsRemarks||Generally considered a demersal fish although its habitat may become pelagic under certain hydrogrphic conditions, when feeding or spawning. There is some evidence that cod leave the bottom and school pelagically to spawn in preferred temperatures when bottom tempetatures are unsuitable. Gregarious during the day, forming compact schools that swim between 30-80 m above the bottom, and scatter at night (Ref. 1371). Schooling behavior may be adaptive for feeding. Reproductive behavior during spawning involves the circling of a female often by only one male per spawning bout (Ref. 86779).|
We can also extract taxonomic information using the package
taxize. This package allows you to extract and validate, among other things, the taxonomy of millions of species by accessing an important number of online databases accessible through their Application Programming Interface (API).
# Export the taxonomy of the species of interest taxize::classification(sp, db = 'worms', accepted = TRUE, verbose = FALSE)[] %>% knitr::kable("html") %>% kableExtra::kable_styling(full_width = FALSE)
# Retrieve a tsn for Gadus morhua, i.e. an unique identifier from the itis db idtsn <- taxize::get_tsn(sp, accepted=TRUE, verbose = FALSE, row=1)
# We can also extract the common or scientific names using sci2comm() & comm2sci(), respectively. taxize::sci2comm(taxize::as.tsn(idtsn), db = 'itis') #R> $`164712` #R>  "morue de l'Atlantique" "bacalao del Atlántico" "cod" #R>  "rock cod" "morue franche" "Atlantic cod" # Or find out whether there are other names under which the species is known taxize::synonyms(taxize::as.tsn(idtsn), db = 'itis') #R> $`164712` #R> sub_tsn acc_tsn message #R> 1 164712 164712 no syns found
# Another really interesting feature is to extract all known species at a given # taxonomic scale. With the itis db, you should first find the tsn associated # with Gadus. Using `taxize::get_tsn('gadus')` you'll find out that it is 164710 knitr::kable(taxize::children(164710, db = 'itis')[], "html") %>% kableExtra::kable_styling(full_width = F)
Sounds like this is consistent with what Wikipedia says!
We can also retrieve information on known biotic interactions involving our species of interest. The Global Biotic Interactions web platform contains thousands of empirical binary interactions for multiple types of interactions, all over the world, and is accessible using the package
# There are multiple types of interactions available on GloBI knitr::kable(rglobi::get_interaction_types()[,1:3], 'html') %>% kable_styling(full_width = F)
# For now let's focus on predator-prey interactions prey <- rglobi::get_prey_of(sp)$target_taxon_name # Retrieve prey pred <- rglobi::get_predators_of(sp)$target_taxon_name # Retrieve predators length(prey) # Number of prey #R>  170 length(pred) # Number of predators #R>  53 prey[1:20] # First 20 prey #R>  "Ammodytes tobianus" "Rossia moelleri" #R>  "Bathypolypus bairdii" "Natatolana borealis" #R>  "Arctica islandica" "Bathypolypus arcticus" #R>  "Rossia macrosoma" "Buenia jeffreysii" #R>  "Zeugopterus punctatus" "Phrynorhombus norvegicus" #R>  "Neocalanus tonsus" "Lithodes maja" #R>  "Buccinum undatum" "Lethenteron camtschaticum" #R>  "Eledone cirrhosa" "Crangon allmanni" #R>  "Atelecyclus rotundatus" "Corystes cassivelanus" #R>  "Ammodytes dubius" "Myxine glutinosa" pred[1:20] # First 20 predators #R>  "Thalasseus sandvicensis" "Myxine glutinosa" #R>  "Sebastes mentella" "Scomber scombrus" #R>  "Anarhichas lupus" "Molva molva" #R>  "Eutrigla gurnardus" "Lophius piscatorius" #R>  "Merlangius merlangus" "Sebastes" #R>  "Xiphias gladius" "Reinhardtius hippoglossoides" #R>  "Phoca vitulina" "Petromyzon marinus" #R>  "no name" "Thalasseus sandvicensis" #R>  "Myxine glutinosa" "Sebastes mentella" #R>  "Scomber scombrus" "Anarhichas lupus"
Since we are interested in a specific area, making our search spatially explicit would be highly valuable. Luckily, there are tools that allow us to do just that.
OBIS is the Ocean Biogeographic Information System and their vision is: “To be the most comprehensive gateway to the world’s ocean biodiversity and biogeographic data and information required to address pressing coastal and world ocean concerns.” We can get access to their HUGE database through the
Similarly, GBIF is the Global Biodiversity Information Facility and it aims at providing free and open access to biodiversity data. This open source platform can be accessed through the
We only cover the OBIS package in this post since the targeted species is marine, but visit
rgbif github repository for more information on its use.
# Download occurrence data for species and area of interest between 2010 and 2017 OBIS <- robis::occurrence(scientificname = sp, geometry=sf::st_as_text(bb$geometry), startdate = as.Date("2010-01-01"), enddate = as.Date("2017-01-01"), fields = c("species", "yearcollected","decimalLongitude", "decimalLatitude")) #R> Retrieved 1342 records of 1342 (100%) # Remove duplicates OBIS <- unique(OBIS) # Transform as spatial file OBIS <- sf::st_as_sf(OBIS, coords = c("decimalLongitude", "decimalLatitude"), crs="+proj=longlat +datum=WGS84", remove=FALSE) # Visualize with mapview mapview::mapview(OBIS, cex = 4)@map