Skip to content

Commit

Permalink
Add "gigaclass" to rank_ref_zoo
Browse files Browse the repository at this point in the history
references issue #885
  • Loading branch information
zachary-foster committed Nov 2, 2021
1 parent 8325bd9 commit 70fee10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
10 changes: 9 additions & 1 deletion R/downstream-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ prune_too_low <- function(x, rank, ignore_no_rank = FALSE, zoo = FALSE,
# the pruning
rr <- if (zoo) taxize_ds$rank_ref_zoo else taxize_ds$rank_ref
rank_target_no <- as.numeric(rr[which_rank(rank, zoo = zoo), "rankid"])
rank_nos <- as.numeric(rr$rankid[vapply(x$rank, function(z) which_rank(z, zoo = zoo), 1)])
rank_nos <- as.numeric(rr$rankid[vapply(x$rank, FUN.VALUE = numeric(1), function(z) {
out <- which_rank(z, zoo = zoo)
if (length(out) == 0) {
stop('The rank "', z, '" is not part of rank_ref so cannot be assigned a relative position.',
'\n\n Post an issue at https://github.com/ropensci/taxize/issues/ to get the rank added.')
} else {
return(out)
}
})])
if (ignore_no_rank) rank_nos[rank_nos %in% c(300, 400)] <- 0
x[!rank_nos > rank_target_no, ]
}
1 change: 0 additions & 1 deletion R/tp_accnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#' # No accepted names found
#' tp_accnames(id = 25509881)
#' }

tp_accnames <- function(id, key = NULL, ...) {
url = sprintf('http://services.tropicos.org/Name/%s/AcceptedNames', id)
key <- getkey(key, "TROPICOS_KEY")
Expand Down
Binary file modified data/rank_ref_zoo.rda
Binary file not shown.
8 changes: 4 additions & 4 deletions inst/ignore/rank_ref_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ids_zoo <- c(
'01', # domain
'05','10','20','25', # kingdom
'30','40','45', # phylum/division
'50','60','70','80','81','82', # class
'47', '50','60','70','80','81','82', # class
'83','84','85','86','87', # cohort
'90','100','110','120','125', # order
'126','127', # section/subsection
Expand All @@ -60,7 +60,7 @@ ranks_zoo <- c(
'domain', # domain
'superkingdom','kingdom','subkingdom','infrakingdom,superphylum', # kingdom
'phylum,division','subphylum,subdivision','infraphylum,infradivision', # phylum/division
'superclass','class','subclass','infraclass','subterclass','parvclass', # class
'gigaclass', 'superclass','class','subclass','infraclass','subterclass','parvclass', # class
'megacohort','supercohort','cohort','subcohort','infracohort', # cohort
'superorder','order','suborder','infraorder','parvorder', # order
'section','subsection', # section/subsection
Expand All @@ -72,12 +72,12 @@ ranks_zoo <- c(
'biotype,isolate,pathogroup,serogroup,serotype,strain,aberration', # genetic variants
'unspecified,no rank,unranked,clade' # unspecified
)
rank_ref_zoo <- data.frame(
rank_ref_zoo <- tibble::tibble(
rankid = ids_zoo,
ranks = ranks_zoo
)
# NOTE: "version = 2" is so that we don't have to require R > 3.5
save(rank_ref_zoo, file = "data/rank_ref_zoo.RData", version = 2)
usethis::use_data(rank_ref_zoo, overwrite = TRUE)
# NOTES:
# - genetic variants: placed slightly higher above 'unspecified' just to denote
# they're not no rank, but they're not really a taxonomic rank either

0 comments on commit 70fee10

Please sign in to comment.