3 Hub Tools: What They Are and How to Use Them

3.1 Overview

The VBD Hub brings together datasets, tools, and community resources to support vector-borne disease research. In the pre-work, you learnt how to navigate the Hub and where to find its useful resources. This session builds on that by focusing on two tools for searching and retrieving data, Hub Search, the Hub’s web-based search interface, and ohvbd, an R package that allows you to search for and retrieve data directly in R. During this workshop, you will practice using both, learn how to refine your searches, and check what they return, and compare the two tools so you can choose the one that best fits your workflow.

3.1.1 Learning Objectives

By the end of this workshop, you should be able to:

  1. Use Hub Search filters to search and download datasets relevant to a specific research question.
  2. Build an ohvbd pipeline in R to search for, filter, and fetch VBD data.
  3. Refine ohvbd searches using smart search functions.
  4. Inspect retrieved data to check it matches your research questions and identify whether wrangling is required.
  5. Understand the differences between the Hub Search and ohvbd package, and choose the right tool for your workflow.

3.3 Searching and Retrieving Data with the ohvbd R Package

ohvbd is an R package developed by the VBD Hub that allows you to search for and retrieve data within R, without needing to download files manually from multiple sources.

It connects to several VBD databases at once, including:

  • VecTraits (vt)
  • VecDyn (vd)
  • GBIF (gbif)
  • ProteomeXchange (px)
  • AREAdata, which is accessed with separate functions, such as fetch_ad()

This means you can pull datasets directly into your R workflow, making data retrieval much more efficient.

3.3.1 Building a Search Pipeline with ohvbd

To get started, we need to install and load the ohvbd package in R:

Once installed, we can start searching for data.

The ohvbd package uses a piped workflow, which allows us to build our search step-by-step.

If we wanted to search for data on Ixodes ricinus from the VecTraits database, we can run:

ixodes_ricinus_data <- search_hub("Ixodes ricinus") |>
  filter_db("vt") |>
  fetch() |>
  glean()

Let’s break this down a bit so we can understand what each step is doing:

  • search_hub() - Searches for datasets matching your query, here we want to search for "Ixodes ricinus". This gives us the IDs of matching datasets, not the data itself.
  • filter_db() - Narrows results to a specific database, in this case "vt", for VecTraits.
  • fetch() - Downloads the data for those IDs, in its raw format.
  • glean() - Converts the raw data into a usable dataframe.

Tip: We can consider a basic search with ohvbd as 4 stages:

  1. Find the data.
  2. Filter the search.
  3. Fetch the data.
  4. Format the data.

The data retrieved using ohvbd is often raw, and its structure depends on how the original source database is formatted. This means that after retrieving the data, you will usually need to wrangle the data before you start any analysis.

3.3.2 Quick Searches with ohvbd

If you know which database you want to use, you can make your search more efficient by specifying the details directly into search_hub:

search_hub("ixodes ricinus", db = "vt")

This gives the same result as filter_db(), but is more efficient because it only searches the database you need.

Tip: You can write ?search_hub or ?fetch_vt in the R console to access guide documents if you need extra help using ohvbd.

3.3.4 Unexpected Search Results

As you become more familiar with the ohvbd package, you might find that your searches do not always return exactly what you expect.

This is because searches are not only based on exact matches, but also on how datasets are indexed and described within the underlying databases.

For example, a search term may match multiple fields within the dataset:

  • Species names
  • Dataset titles
  • Metadata descriptions

This means that a search can return results that are related to your query, but not exactly what you intended.

Example: Unexpected Results from a Bemisia Search

Let’s have a look at an example of a search that returns unexpected results.

Imagine we are searching for trait data on Bemisia, a genus of whitefly, using the VecTraits database:

df <- search_hub("Bemisia", db = "vt") |>
  fetch() |>
  glean()

head(df)

At first glance, everything may look fine. However, if we explore the dataset further, for example, by checking the unique values in the genus column, we might notice something unexpected:

unique(df$Interactor1Genus)

Alongside Bemisia, another genus appears: Axinoscymnus, which is a ladybird. This can seem confusing, we searched for whiteflies, not ladybirds.

If we look more closely at the dataset, we can see that:

  • Axinoscymnus appears in the Interactor1Genus column
  • Bemisia appears in the Interactor2Genus column

This tells us that the dataset includes interactions between species. So while Bemisia is included in the search results, it is not always the primary species the trait data refers to.

To mitigate unexpected results, the ohvbd package provides more advanced ways to refine your search.

One key approach is to use smart search functions, written as search_x_smart(), where x can be replaced with the code for the appropriate database, such as vt for VecTraits, or vd for VecDyn.

Unlike search_hub(), which searches across multiple fields, smart search functions let you choose which field to search, how to match it (e.g. "equals" or "contains"), and the value to look for. This means you can control exactly where your search term is being matched.

Example: Unexpected Results from a Bemisia Search (cont.)

Instead of searching broadly for Bemisia, we can refine our search using a smart search function.

Our previous code (see previous Example) returned datasets where Bemisia appeared in multiple columns, including as a secondary interacting species.

To make the search more specific, we can use search_vt_smart() to target the column that represents the primary species the traits refer to:

df_smart <- search_vt_smart("Interactor1Genus", "equals", "Bemisia") |>
  fetch() |>
  glean(
    cols = c("Interactor1Genus", "Interactor1Species", "Interactor2Genus"),
    returnunique = TRUE
  )

unique(df_smart$Interactor1Genus)

Here we have also used cols in glean() to keep only the columns we need, and returnunique = TRUE to remove any duplicate rows.

We can see that only Bemisia appears in the primary species column. This mitigates the unintended results, such as Axinoscymnus, that appeared in our earlier search.

By using smart search functions, we can more precisely control how our query is applied, ensuring that the data we retrieve aligns with our research question.

In addition to refining the search itself, it is often necessary to apply data wrangling techniques after retrieval.

These might include:

  • Filtering rows based on specific conditions
  • Standardising or correcting species names
  • Merging columns where necessary

These steps are a normal part of working with integrated datasets, where multiple species, interactions, or naming conventions may be present.

By combining targeted searching with careful data wrangling, we can ensure that the final dataset aligns with our specific research question.

3.4 Hub Search vs. ohvbd

You might have noticed that the ohvbd package and the Hub Search are quite similar, as they both allow you to search across multiple databases.

However, there are some differences between the two resources:

  • With ohvbd, once your code is written, it can be re-run to retrieve updated data, which improves reproducibility.
  • Additionally, all results can be retrieved and combined directly within R.
  • With Hub Search, datasets are typically downloaded manually one at a time.
  • ohvbd is most useful for users who work in R, whereas users who work with other software will find the Hub Search more appropriate.

Both tools are useful, and the best choice depends on your workflow and experience.

Task: Retrieving the Same Dataset with Hub Search and ohvbd

Have a go at retrieving the data from this paper using both the Hub Search and ohvbd: Blagrove MSC, Arias-Goeta C, Di Genua C, Failloux A-B, Sinkins SP (2013). A Wolbachia wMel transinfection in Aedes albopictus is not detrimental to host fitness and inhibits Chikungunya virus. PLoS Neglected Tropical Diseases 7(3): e2152.

Remember to think about which filters will narrow your search most efficiently.

For Hub Search, open the dataset, check its metadata, and download it. For ohvbd, use fetch() and glean() to retrieve the dataset as a dataframe.

Once you have retrieved your dataset, consider:

  • Which filters did you use, were these the most efficient?
  • Which tool got you to the dataset faster?
  • Which tool would you use if you needed this dataset plus several similar ones?

3.5 Key Takeaways

  • The Hub Search and ohvbd both let you search several VBD databases at once, so you don’t need to search each source individually.
  • Start with a broad search and then narrow down, checking results for relevance, coverage and structure before downloading.
  • Searches match across species names, dataset titles and metadata, so results may include data you didn’t expect. Smart search functions with ohvbd let you target a specific column.
  • Choose the tool that best fits your workflow. Hub Search suits point-and-click exploration and non-R users. ohvbd is better suited to R users, anyone working with multiple datasets, and anyone who needs a reproducible search they can re-run.