Skip to content

Commit

Permalink
simplify get_cave_table_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferis committed Jul 11, 2024
1 parent 6608d9a commit b1829a3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions R/cave-tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ banc_nuclei <- function (rootids = NULL,

#' @rdname banc_cave_tables
#' @export
#' @importFrom dplyr mutate ends_with across
#' @importFrom nat xyzmatrix2str
banc_cell_info <- function(rootids = NULL, rawcoords = FALSE){
table <- "cell_info"
res <- get_cave_table_data(table)
if (isTRUE(rawcoords))
res
else {
res %>% dplyr::mutate(dplyr::across(dplyr::ends_with("position"), function(x)
nat::xyzmatrix2str(banc_raw2nm(x))))
res %>% mutate(across(ends_with("position"),
function(x) xyzmatrix2str(banc_raw2nm(x))))
}
}

Expand Down Expand Up @@ -146,16 +148,12 @@ get_cave_table_data <- function(table, rootids = NULL, ...){
if (!is.null(rootids)) {
rootids <- flywire_ids(rootids)
df <- if (length(rootids) < 200) {
rid <- paste(rootids, collapse = ",")
ridq <- reticulate::py_eval(sprintf("{\"pt_root_id\": [%s]}",
rid), convert = F)
fafbseg::flywire_cave_query(table = table,
filter_in_dict = ridq, ...)
filter_in_dict = list(pt_root_id=rootids), ...)
} else {
fafbseg::flywire_cave_query(table = table,
live = F, ...)
fafbseg::flywire_cave_query(table = table, live = F, ...)
}
}else{
} else {
df <- fafbseg::flywire_cave_query(table = table , ...)
}
df
Expand Down

0 comments on commit b1829a3

Please sign in to comment.