Skip to content

Commit

Permalink
Namespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbates committed Jul 2, 2024
1 parent 0fe8c0d commit 5a71b0b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Suggests:
reticulate,
readobj,
Rvcg,
Morpo,
Morpho,
usethis,
rmarkdown,
spelling,
Expand Down
12 changes: 6 additions & 6 deletions R/cave-tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,31 @@ 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
# res <- standard_nuclei(res)
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))))
}
}

Expand Down
12 changes: 6 additions & 6 deletions R/meshes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand All @@ -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,y<y.cut)
z <- subset(x,x$y<y.cut)
}else{
z <- subset(x,y>y.cut)
z <- subset(x,x$y>y.cut)
}
}else if (ismesh){
if (any(class(x)=="mesh3d")){
Expand Down
4 changes: 2 additions & 2 deletions R/synapses.R
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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
Expand Down
Empty file removed banc
Empty file.
2 changes: 1 addition & 1 deletion man/banc_decapitate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a71b0b

Please sign in to comment.