phylotastic / datelife

R package containing datelife's core functionality
http://phylotastic.org/datelife/
13 stars 11 forks source link

query of >250 spp names not supported by rotl::tnrs_match_names fn #39

Closed LunaSare closed 6 years ago

LunaSare commented 6 years ago

Trying to retrieve the induced subtree for all birds, using code from GetBoldOToLTree fn: rotl::tol_induced_subtree(ott_ids=rotl::tnrs_match_names(names = input)$ott_id, label_format = "name", otl_v = otol_version)

and got the following error: Error: HTTP failure: 400 Queries containing more than 250 strings are not supported. You may submit multiple smaller queries to avoid this

Traced the error to here: rotl::tnrs_match_names(names = input)$ott_id

Implementing a loop to get ott_ids in batches of 250 solves this issue: batches <- seq(1,12750, 250) for (i in batches){ aves_ott_ids <- c(aves_ott_ids, rotl::tnrs_match_names(names = aves_names[i:(i+249)])$ott_id) }

I think it's worthy to implement this intoGetBoldOToLTree function too, since, as long as rotl::tnrs_match_names does not allow querying >250 names, trying to construct trees with large sizes with BOLD will not work. What do you think?

LunaSare commented 6 years ago

Done 👍