diff --git a/DESCRIPTION b/DESCRIPTION index a26c645..c91bcce 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,7 +37,7 @@ Suggests: reticulate, readobj, Rvcg, - Morpo, + Morpho, usethis, rmarkdown, spelling, diff --git a/R/cave-tables.R b/R/cave-tables.R index 05ab3fc..f1b9483 100644 --- a/R/cave-tables.R +++ b/R/cave-tables.R @@ -75,23 +75,23 @@ banc_nuclei <- function (rootids = NULL, } if (nrow(nuclei) == 0) return(nuclei) - nuclei <- nuclei %>% right_join(data.frame(pt_root_id = as.integer64(rootids)), + nuclei <- nuclei %>% dplyr::right_join(data.frame(pt_root_id = as.integer64(rootids)), by = "pt_root_id") %>% select(colnames(nuclei)) if (length(rootids) < 200) { nuclei } else { - nuclei %>% mutate(pt_root_id = flywire_updateids(.data$pt_root_id, + nuclei %>% dplyr::mutate(pt_root_id = flywire_updateids(.data$pt_root_id, svids = .data$pt_supervoxel_id)) } }else { nid <- paste(nucleus_ids, collapse = ",") nidq <- reticulate::py_eval(sprintf("{\"id\": [%s]}", nid), convert = F) - nuclei <- flywire_cave_query(table = nucleus_table_name(), + nuclei <- flywire_cave_query(table = table, filter_in_dict = nidq, ...) - nuclei %>% right_join(data.frame(id = nucleus_ids), by = "id") %>% - select(colnames(nuclei)) + nuclei %>% dplyr::right_join(data.frame(id = nucleus_ids), by = "id") %>% + dplyr::select(colnames(nuclei)) } res # apply coordinate transform @@ -99,7 +99,7 @@ banc_nuclei <- function (rootids = NULL, if (isFALSE(rawcoords)) res else { - res %>% dplyr::mutate(across(ends_with("position"), function(x) xyzmatrix2str(flywire_nm2raw(x)))) + res %>% dplyr::mutate(dplyr::across(dplyr::ends_with("position"), function(x) nat::xyzmatrix2str(flywire_nm2raw(x)))) } } diff --git a/R/meshes.R b/R/meshes.R index 32921dc..43baa96 100644 --- a/R/meshes.R +++ b/R/meshes.R @@ -45,7 +45,7 @@ banc_read_nuclei_mesh <- function(ids, lod = 1L, savedir=NULL, method=c('vf', ' #' Subset points to be in the brain or in the VNC #' -#' @param x an object with 3d points to be subsetted, e.g. an xyz matrix, a \code{neuron}, \cpode{neuronlist} or a \code{mesh3d} object. +#' @param x an object with 3d points to be subsetted, e.g. an xyz matrix, a \code{neuron}, \code{neuronlist} or a \code{mesh3d} object. #' Points must be in native BANC space, i.e. plottable inside \code{banc.surf}. #' @param invert if \code{FALSE} returns brain points, if \code{TRUE} returns VNC points. #' @@ -67,17 +67,17 @@ banc_decapitate <- function(x, invert = FALSE, reference = "BANC"){ v2 <- c(1e10,y.cut,0) v3 <- c(0,y.cut,1e10) if (reference!="BANC"){ - v1 <- xform_brain(v1, sample = "BANC", reference = reference) - v2 <- xform_brain(v2, sample = "BANC", reference = reference) - v3 <- xform_brain(v3, sample = "BANC", reference = reference) + v1 <- nat.templatebrains::xform_brain(v1, sample = "BANC", reference = reference) + v2 <- nat.templatebrains::xform_brain(v2, sample = "BANC", reference = reference) + v3 <- nat.templatebrains::xform_brain(v3, sample = "BANC", reference = reference) y.cut <- v1[,2] } ismesh <- any(class(x[[1]]), class(x)) %in% "mesh3d" if(!ismesh & any(class(x)%in%c("neuron","neuronlist","mesh3d"))){ if (invert){ - z <- subset(x,yy.cut) + z <- subset(x,x$y>y.cut) } }else if (ismesh){ if (any(class(x)=="mesh3d")){ diff --git a/R/synapses.R b/R/synapses.R index 1b4143f..bb986cd 100644 --- a/R/synapses.R +++ b/R/synapses.R @@ -65,7 +65,7 @@ banc_all_synapses <- function(path = "gs://zetta_lee_fly_cns_001_synapse/240623_ ) # Are we just sampling or going for the full thing? - if(!is.null(nrows)){ + if(!is.null(n_max)){ syns <- readr::read_csv(file=path, col_types = col.types, lazy = TRUE, n_max = n_max) return(syns) }else if (!table_exists|overwrite){ @@ -81,7 +81,7 @@ banc_all_synapses <- function(path = "gs://zetta_lee_fly_cns_001_synapse/240623_ # If the table already exists, it will be overwritten DBI::dbWriteTable(con, "synapses", df, overwrite = TRUE) DBI::dbDisconnect(con) - message("Added tab synapses, nrows: ", nrow(syns)) + message("Added tab synapses, no. rows: ", nrow(syns)) } # Read diff --git a/banc b/banc deleted file mode 100644 index e69de29..0000000 diff --git a/man/banc_decapitate.Rd b/man/banc_decapitate.Rd index e3eba09..a3256db 100644 --- a/man/banc_decapitate.Rd +++ b/man/banc_decapitate.Rd @@ -7,7 +7,7 @@ banc_decapitate(x, invert = FALSE, reference = "BANC") } \arguments{ -\item{x}{an object with 3d points to be subsetted, e.g. an xyz matrix, a \code{neuron}, \cpode{neuronlist} or a \code{mesh3d} object. +\item{x}{an object with 3d points to be subsetted, e.g. an xyz matrix, a \code{neuron}, \code{neuronlist} or a \code{mesh3d} object. Points must be in native BANC space, i.e. plottable inside \code{banc.surf}.} \item{invert}{if \code{FALSE} returns brain points, if \code{TRUE} returns VNC points.}