From 40fe9e9562eccac21b83d622b3e8a1622e364c1e Mon Sep 17 00:00:00 2001 From: Emily Jane McTavish Date: Thu, 14 Dec 2023 16:13:31 -0800 Subject: [PATCH 1/4] update ott species name code --- R/datelife_query.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/datelife_query.R b/R/datelife_query.R index 3e5b3b78..592a65fe 100644 --- a/R/datelife_query.R +++ b/R/datelife_query.R @@ -125,7 +125,7 @@ make_datelife_query <- function(input = c("Rhea americana", "Pterocnemia pennata species_list <- get_opentree_species(taxon_name = cleaned_names_tnrs$unique_name, ott_id = cleaned_names_tnrs$ott_id, synth_tree_only = TRUE) - cleaned_names <- species_list$species_names + cleaned_names <- unname(species_list$tnrs_names) ott_ids <- species_list$ott_ids } else { # example: df <- get_ott_children(ott_ids = 698424, ott_rank = "species") From 8e2aea30dc0fa1d000f85426a64073aad26d3d5d Mon Sep 17 00:00:00 2001 From: Emily Jane McTavish Date: Thu, 14 Dec 2023 16:20:50 -0800 Subject: [PATCH 2/4] Error if no names --- R/datelife_query.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/datelife_query.R b/R/datelife_query.R index 592a65fe..54efd958 100644 --- a/R/datelife_query.R +++ b/R/datelife_query.R @@ -169,7 +169,7 @@ make_datelife_query <- function(input = c("Rhea americana", "Pterocnemia pennata ifelse(length(cleaned_names) <= 10, ".", paste("... omitted ", length(cleaned_names) - 10, "taxon names."))) - message("DateLife query done!\n") + ifelse(length(cleaned_names) < 1, message("ERROR: No names retained for search\n"), message("DateLife query done!\n")) return(structure(datelife_query_return, class = "datelifeQuery")) } #' Process a phylo object or a character string to determine if it's correct newick From 10d876457798d0ac6714753f4ce1fe57a34e611b Mon Sep 17 00:00:00 2001 From: Emily Jane McTavish Date: Fri, 15 Dec 2023 13:49:17 -0800 Subject: [PATCH 3/4] fix ifelse bug --- R/datelife_query.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/datelife_query.R b/R/datelife_query.R index 54efd958..417731e7 100644 --- a/R/datelife_query.R +++ b/R/datelife_query.R @@ -169,7 +169,11 @@ make_datelife_query <- function(input = c("Rhea americana", "Pterocnemia pennata ifelse(length(cleaned_names) <= 10, ".", paste("... omitted ", length(cleaned_names) - 10, "taxon names."))) - ifelse(length(cleaned_names) < 1, message("ERROR: No names retained for search\n"), message("DateLife query done!\n")) + if(length(cleaned_names) < 1) { + message("ERROR: No names retained for search\n") + } else{ + message("DateLife query made!\n") + } return(structure(datelife_query_return, class = "datelifeQuery")) } #' Process a phylo object or a character string to determine if it's correct newick From 40d87d4fbec9a9baaf6ecbf45e21d62837f2c34c Mon Sep 17 00:00:00 2001 From: Emily Jane McTavish Date: Fri, 15 Dec 2023 14:31:53 -0800 Subject: [PATCH 4/4] fix bug in https://github.com/phylotastic/datelife/issues/81 --- R/opentree_taxonomy.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/opentree_taxonomy.R b/R/opentree_taxonomy.R index 2002a5a0..95fbd189 100644 --- a/R/opentree_taxonomy.R +++ b/R/opentree_taxonomy.R @@ -90,7 +90,7 @@ check_ott_input <- function(input = NULL, ott_ids = NULL, ...) { message(input) stop("OTT ids are NULL.") } - if (is.numeric(input$ott_id) & !is.na(input$ott_id)) { + if (all(is.numeric(input$ott_id) & !is.na(input$ott_id))) { ott_ids <- input$ott_ids names(ott_ids) <- input$cleaned_names } else {