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

Error in CAS search #5

Open
TBurla opened this issue Oct 18, 2023 · 2 comments
Open

Error in CAS search #5

TBurla opened this issue Oct 18, 2023 · 2 comments

Comments

@TBurla
Copy link

TBurla commented Oct 18, 2023

Hi, I have been using the program for several orders of fish and, in some of them, the search has some error, at first I thought that it could be caused by some special character (and I'm still checking for them), but now I saw the same message to the following search. Specificity
with "Colomesus asellus" or "Colomesus".

s_sp <- c("Colomesus asellus","Colomesus tocantinensis")
#Eschmeyer's Catalog of Fishes search
CAS <- search_cas(query = s_sp, type = "species") %>%

  • left_join(species_family()[, 1:4], by = "family")
    Error in dplyr::mutate():
    ℹ In argument: species = stringr::str_split(content, "\\. ", simplify = T)[, 1].
    Caused by error in stringr::str_split(content, "\\. ", simplify = T)[, 1]:
    ! subscript out of bounds
    Run rlang::last_trace() to see where the error occurred.

#TETRAODONTIFORMES -> For each group, change the name of the group and the s_sp
#Species list
s_sp <- c("Colomesus asellus", "Colomesus tocantinensis")
#Eschmeyer's Catalog of Fishes search
CAS <- search_cas(query = s_sp, type = "species") %>%

  • left_join(species_family()[, 1:4], by = "family")
    Error in dplyr::mutate():
    ℹ In argument: species = stringr::str_split(content, "\\. ", simplify = T)[, 1].
    Caused by error in stringr::str_split(content, "\\. ", simplify = T)[, 1]:
    ! subscript out of bounds
    Run rlang::last_trace() to see where the error occurred.

rlang::last_trace()
<error/dplyr:::mutate_error>
Error in dplyr::mutate():
ℹ In argument: species = stringr::str_split(content, "\\. ", simplify = T)[, 1].
Caused by error in stringr::str_split(content, "\\. ", simplify = T)[, 1]:
! subscript out of bounds


Backtrace:

  1. ├─search_cas(query = s_sp, type = "species") %>% ...
  2. ├─dplyr::left_join(., species_family()[, 1:4], by = "family")
  3. ├─rFishTaxa::search_cas(query = s_sp, type = "species")
  4. │ └─base::lapply(...)
  5. │ └─rFishTaxa (local) FUN(X[[i]], ...)
  6. │ └─rFishTaxa:::get_cas(x, type = type)
  7. │ └─... %>% dplyr::select(query, species_author, family, status)
  8. ├─dplyr::select(., query, species_author, family, status)
  9. ├─stats::na.omit(.)
  10. ├─dplyr::mutate(...)
  11. └─dplyr:::mutate.data.frame(...)
  12. └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  13. ├─base::withCallingHandlers(...)
    
  14. └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
    
  15.   └─mask$eval_all_mutate(quo)
    
  16.     └─dplyr (local) eval()
    

Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.

rlang::last_trace(drop = FALSE)
<error/dplyr:::mutate_error>
Error in dplyr::mutate():
ℹ In argument: species = stringr::str_split(content, "\\. ", simplify = T)[, 1].
Caused by error in stringr::str_split(content, "\\. ", simplify = T)[, 1]:
! subscript out of bounds


Backtrace:

  1. ├─search_cas(query = s_sp, type = "species") %>% ...
  2. ├─dplyr::left_join(., species_family()[, 1:4], by = "family")
  3. ├─rFishTaxa::search_cas(query = s_sp, type = "species")
  4. │ └─base::lapply(...)
  5. │ └─rFishTaxa (local) FUN(X[[i]], ...)
  6. │ └─rFishTaxa:::get_cas(x, type = type)
  7. │ └─... %>% dplyr::select(query, species_author, family, status)
  8. ├─dplyr::select(., query, species_author, family, status)
  9. ├─stats::na.omit(.)
  10. ├─dplyr::mutate(...)
  11. ├─dplyr:::mutate.data.frame(...)
  12. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  13. │ ├─base::withCallingHandlers(...)
  14. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
  15. │ └─mask$eval_all_mutate(quo)
  16. │ └─dplyr (local) eval()
  17. └─dplyr (local) <fn>(<sbscOOBE>)
  18. └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
@akarolinamoreno
Copy link

Did you manage to find a solution? I am also encountering the same error for some species..

@TBurla
Copy link
Author

TBurla commented Feb 6, 2024

I used the code below to know which species was the last that passed through the search, them searched the species or genus in CAS to see what happened. Some where writing mistakes, but the majority were old names that were not used, but you can trace the history in CAS site. I took the last valid name to replace the species names with problem and it worked well.

#Create empty data frame to store results
CAS_search <- data.frame(query = character(),
                         species_author = character(),
                         species = character(),
                         author = character(),
                         family = character(),
                         status = character(),
                         class = character(),
                         order = character(),
                         subfamily = character(),
                         stringsAsFactors = FALSE)

#loop through each species
for (species in data$species){
  #Construct cas query
  CAS_query <- paste0(species)
  #Perform CAS search
  CAS_r <- search_cas(query = CAS_query, type = "species") %>% left_join(species_family()[, 1:4], by = "family")
  CAS_search <- bind_rows(CAS_search, CAS_r)
}

mattiaghilardi added a commit to mattiaghilardi/rFishTaxa that referenced this issue Mar 1, 2024
Now search_cas() returns a message for matches not found
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

No branches or pull requests

2 participants