UsingQBMSwithBreedbase - solgenomics/sgn GitHub Wiki

QBMS installation in R on Debian, Ubuntu, PopOS

The QBMS system needs prerequisites installed on the system, otherwise the R package install will fail.

The prerequisites can be installed in the terminal:

sudo apt-get install libgdal-dev libgeos-dev libproj-dev libtbb-dev libnetcdf-dev

Then, in R:

## normally, you would install directly from CRAN:
##install.packages('QBMS', installdeps=true)
## but due to an issue you should install from github:

if (!require("remotes")) install.packages("remotes")

remotes::install_github("icarda-git/QBMS")

Querying using QBMS

from the QBMS R-documentation (see https://cran.r-project.org/web/packages/QBMS/vignettes/breedbase_example.html):

# load the QBMS library
library(QBMS)

# Cassava BreedBase server
set_qbms_config("https://cassavabase.org/", no_auth = TRUE, engine = "breedbase")

# login_breedbase("username", "password")

# list supported crops in the current BreedBase server
list_crops()

# list all breeding programs in the selected crop
list_programs()

# select a breeding program by name
set_program("IITA")

# list all folders in the selected program
list_trials()

# select a specific folder by name, choose the last/final folder that contains 
# your experiments in any nested folder structure
set_trial("20_Abuja")

# list all studies/experiments in the selected folder
list_studies()

# select a specific study/experiment by name
set_study("20NCRP12yrtAB")

# another option, select a specific study/experiment by location name (first match)
# studies <- list_studies()
# set_study(studies[studies$locationName == "Abuja", "studyName"][1])

# retrieve general information, data, and germplasm list 
# of the selected study/experiment
info <- get_study_info()
data <- get_study_data()

# not effecient call at the BreedBase backend BrAPI endpoint
germplasm <- get_germplasm_list()

# get observation variable ontology in the selected study/experiment
ontology <- get_trial_obs_ontology()

# replace long trait names with short ones from the ontology 
fields <- colnames(data) 

for (i in 1:length(fields)) {
  j <- which(ontology$name %in% fields[i])
  if (length(j) > 0) fields[i] <- ontology$synonyms[j](/solgenomics/sgn/wiki/j)[1]
}

colnames(data) <- fields

# retrieve all studies/experiments data in the selected folder
MET <- get_trial_data()