CIP-RIU / brapi

An R package to use the Breeding API (BrAPI) for accessing plant breeding data.
13 stars 7 forks source link

Downloading multiple trials? #32

Open wolfemd opened 6 years ago

wolfemd commented 6 years ago

Hi there,

I'm a cassava base user. Most of my analysis is done in R. I'm trying to integrate direct DB calls into my pipeline using your package. I was wondering what you recommended or planned for downloading multiple trials?

Below is my solution, which works but is VERY VERY slow (hours or days) and often times out... in contrast direct calls to download the same data using the GUI / web interface for the DB takes minutes/hours.

library(tidyverse); library(brapi)
db<-ba_db()$cassavabase
trials_1<-db %>% 
    ba_studies_search(programDbId = "162") %>% 
    mutate(seasons=as.numeric(seasons)) %>% 
    filter(seasons >= 2015,
           seasons <= 2016) %>% 
    mutate(studyDbId=as.character(studyDbId),
           data=map(studyDbId,~ba_studies_table(db,.)))
c5sire commented 6 years ago

Hi,

let me check. I will come back to you in a couple of days or so.

Best,

Reinhard