Skip to content

Commit 70fee10

Browse files
Add "gigaclass" to rank_ref_zoo
references issue #885
1 parent 8325bd9 commit 70fee10

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

R/downstream-utils.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ prune_too_low <- function(x, rank, ignore_no_rank = FALSE, zoo = FALSE,
1515
# the pruning
1616
rr <- if (zoo) taxize_ds$rank_ref_zoo else taxize_ds$rank_ref
1717
rank_target_no <- as.numeric(rr[which_rank(rank, zoo = zoo), "rankid"])
18-
rank_nos <- as.numeric(rr$rankid[vapply(x$rank, function(z) which_rank(z, zoo = zoo), 1)])
18+
rank_nos <- as.numeric(rr$rankid[vapply(x$rank, FUN.VALUE = numeric(1), function(z) {
19+
out <- which_rank(z, zoo = zoo)
20+
if (length(out) == 0) {
21+
stop('The rank "', z, '" is not part of rank_ref so cannot be assigned a relative position.',
22+
'\n\n Post an issue at https://github.com/ropensci/taxize/issues/ to get the rank added.')
23+
} else {
24+
return(out)
25+
}
26+
})])
1927
if (ignore_no_rank) rank_nos[rank_nos %in% c(300, 400)] <- 0
2028
x[!rank_nos > rank_target_no, ]
2129
}

R/tp_accnames.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#' # No accepted names found
1414
#' tp_accnames(id = 25509881)
1515
#' }
16-
1716
tp_accnames <- function(id, key = NULL, ...) {
1817
url = sprintf('http://services.tropicos.org/Name/%s/AcceptedNames', id)
1918
key <- getkey(key, "TROPICOS_KEY")

data/rank_ref_zoo.rda

8 Bytes
Binary file not shown.

inst/ignore/rank_ref_script.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ids_zoo <- c(
4444
'01', # domain
4545
'05','10','20','25', # kingdom
4646
'30','40','45', # phylum/division
47-
'50','60','70','80','81','82', # class
47+
'47', '50','60','70','80','81','82', # class
4848
'83','84','85','86','87', # cohort
4949
'90','100','110','120','125', # order
5050
'126','127', # section/subsection
@@ -60,7 +60,7 @@ ranks_zoo <- c(
6060
'domain', # domain
6161
'superkingdom','kingdom','subkingdom','infrakingdom,superphylum', # kingdom
6262
'phylum,division','subphylum,subdivision','infraphylum,infradivision', # phylum/division
63-
'superclass','class','subclass','infraclass','subterclass','parvclass', # class
63+
'gigaclass', 'superclass','class','subclass','infraclass','subterclass','parvclass', # class
6464
'megacohort','supercohort','cohort','subcohort','infracohort', # cohort
6565
'superorder','order','suborder','infraorder','parvorder', # order
6666
'section','subsection', # section/subsection
@@ -72,12 +72,12 @@ ranks_zoo <- c(
7272
'biotype,isolate,pathogroup,serogroup,serotype,strain,aberration', # genetic variants
7373
'unspecified,no rank,unranked,clade' # unspecified
7474
)
75-
rank_ref_zoo <- data.frame(
75+
rank_ref_zoo <- tibble::tibble(
7676
rankid = ids_zoo,
7777
ranks = ranks_zoo
7878
)
7979
# NOTE: "version = 2" is so that we don't have to require R > 3.5
80-
save(rank_ref_zoo, file = "data/rank_ref_zoo.RData", version = 2)
80+
usethis::use_data(rank_ref_zoo, overwrite = TRUE)
8181
# NOTES:
8282
# - genetic variants: placed slightly higher above 'unspecified' just to denote
8383
# they're not no rank, but they're not really a taxonomic rank either

0 commit comments

Comments
 (0)