Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes ncbi_searcher error on some queries #107

Merged
merged 1 commit into from
May 1, 2018

Conversation

zachary-foster
Copy link
Contributor

@zachary-foster zachary-foster commented May 1, 2018

Description

I was getting the following error with the current github and CRAN versions:

> x <- traits::ncbi_searcher(id = "155619", fuzzy = TRUE)
Working on 155619...
...retrieving sequence IDs...
...retrieving available genes and their lengths...
Error in taxids[grepl(names(out)[i], taxids)] <- out[[i]] : 
  replacement has length zero

It was caused by an error being returned from the NCBI API instead of taxonomic information at this line:

res <- GET(paste0(url_esummary, "?db=taxonomy&id=", uids[i]))

I am not sure why the error was occurring, but I changed the code so it returns NA in that case instead of failing.

Example

x <- traits::ncbi_searcher(id = "155619", fuzzy = TRUE)
> dplyr::as_tibble(x)
# A tibble: 500 x 5
   taxon                    length gene_desc                                                                   acc_no   gi_no
 * <chr>                     <dbl> <chr>                                                                       <chr>    <dbl>
 1 Lanmaoa pseudosensibilis   941. Lanmaoa pseudosensibilis voucher Mushroom Observer #275044 large subunit r… MH244…  1.38e9
 2 Boletaceae sp.             991. Boletaceae sp. voucher Mushroom Observer #250391 large subunit ribosomal R… MH244…  1.38e9
 3 Boletaceae sp.             988. Boletaceae sp. voucher Mushroom Observer #248795 large subunit ribosomal R… MH244…  1.38e9
 4 Boletus separans           993. Boletus separans voucher Mushroom Observer #282660 large subunit ribosomal… MH244…  1.38e9
 5 Boletus subvelutipes       750. Boletus subvelutipes voucher Mushroom Observer #285181 internal transcribe… MH244…  1.38e9
 6 Boletus subvelutipes       979. Boletus subvelutipes voucher Mushroom Observer #285181 large subunit ribos… MH244…  1.38e9
 7 Boletaceae sp.             567. Boletaceae sp. voucher Mushroom Observer #215899 small subunit ribosomal R… MH244…  1.38e9
 8 Leccinum snellii           967. Leccinum snellii voucher Mushroom Observer #288473 large subunit ribosomal… MH238…  1.38e9
 9 Boletus vermiculosoides    607. Boletus vermiculosoides voucher Mushroom Observer #279688 internal transcr… MH238…  1.38e9
10 NA                         756. Gliophorus cf. psittacinus internal transcribed spacer 2 and large subunitMH2371.38e9
# ... with 490 more rows

@codecov-io
Copy link

Codecov Report

Merging #107 into master will decrease coverage by 0.14%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #107      +/-   ##
=========================================
- Coverage   24.04%   23.9%   -0.15%     
=========================================
  Files          17      17              
  Lines         682     686       +4     
=========================================
  Hits          164     164              
- Misses        518     522       +4
Impacted Files Coverage Δ
R/ncbi_searcher.R 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 089094a...1b0a7ba. Read the comment docs.

@sckott sckott added this to the v0.4 milestone May 1, 2018
@sckott
Copy link
Contributor

sckott commented May 1, 2018

looks good to me

@sckott sckott merged commit 9be3d5b into ropensci:master May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants