From d4b41075bde9274f620ea2ee4754ef54a4893123 Mon Sep 17 00:00:00 2001 From: Romain Franconville Date: Thu, 13 Feb 2020 10:14:01 -0500 Subject: [PATCH] Add an option to make fixed searches --- R/name.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/name.R b/R/name.R index 7efe9907..1f1b4531 100644 --- a/R/name.R +++ b/R/name.R @@ -132,15 +132,16 @@ neuprint_get_roiInfo <- function(bodyids, dataset = NULL, all_segments = FALSE, #' neuprint_search("AVF1",field = "cellBodyFiber") #' } #' @seealso \code{\link{neuprint_get_meta}}, \code{\link{neuprint_get_neuron_names}} -neuprint_search <- function(search, field = "name", meta = TRUE, all_segments = FALSE, dataset = NULL, conn = NULL, ...){ +neuprint_search <- function(search, field = "name", fixed=FALSE, meta = TRUE, all_segments = FALSE, dataset = NULL, conn = NULL, ...){ if(field=="name"){ conn = neuprint_login(conn) field = neuprint_name_field(conn) } all_segments.cypher = ifelse(all_segments,"Segment","Neuron") - cypher = sprintf("MATCH (n:`%s`) WHERE n.%s=~'%s' RETURN n.bodyId", + cypher = sprintf("MATCH (n:`%s`) WHERE n.%s %s '%s' RETURN n.bodyId", all_segments.cypher, field, + ifelse(fixed, "CONTAINS", "=~"), search) nc = neuprint_fetch_custom(cypher=cypher, dataset = dataset, ...) foundbodyids=unlist(nc$data)