Skip to content

Commit

Permalink
Merge pull request #102 from natverse/get_synapses_fix
Browse files Browse the repository at this point in the history
Get synapses fix
  • Loading branch information
romainFr authored Mar 19, 2020
2 parents 699acf2 + ad7abfc commit 6530fce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion R/name.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ neuprint_get_meta <- function(bodyids, dataset = NULL, all_segments = TRUE, conn
"size","cellBodyFiber"),
dataset=dataset,conn=conn,...)
returnCypher <- paste0("n.",fieldNames," AS ",dfFields(fieldNames),collapse=" , ")
#n.bodyId AS bodyid, n.%s AS name, n.type AS type, n.status AS status, n.statusLabel AS statusLabel, n.size AS voxels, n.pre AS pre, n.post AS post,n.cropped AS cropped, exists(n.somaLocation) as soma, n.cellBodyFiber as cellBodyFiber, n.downstream as downstream"
cypher = sprintf(
paste(
"WITH %s AS bodyIds UNWIND bodyIds AS bodyId ",
Expand Down
8 changes: 4 additions & 4 deletions R/synapses.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ neuprint_get_synapses <- function(bodyids, roi = NULL, remove.autapses=TRUE,
". Please call neuprint_ROIs() to see the available ROIs."
)
}
roi = sprintf("AND (exists(s.`%s`))", roi)
roiQ = sprintf("AND (exists(s.`%s`))", roi)
}
n <- length(bodyids)
if(is.numeric(chunk)) {
Expand Down Expand Up @@ -91,7 +91,7 @@ neuprint_get_synapses <- function(bodyids, roi = NULL, remove.autapses=TRUE,
}
return(d)
}
if(is.null(roi)) roi <- ""
if(is.null(roi)) roiQ <- ""
cypher.post = sprintf(paste("WITH %s AS bodyIds UNWIND bodyIds AS bodyId",
"MATCH (a:`%s`)-[:Contains]->(:SynapseSet)-[:Contains]->(p:Synapse)<-[:SynapsesTo]-(s:Synapse)<-[:Contains]-(c:SynapseSet)<-[:Contains]-(b:`%s`)",
"WHERE a.bodyId=bodyId AND (s.type='pre') %s",
Expand All @@ -101,7 +101,7 @@ neuprint_get_synapses <- function(bodyids, roi = NULL, remove.autapses=TRUE,
id2json(bodyids),
"Segment",
"Segment",
roi)
roiQ)
cypher.pre = sprintf(paste("WITH %s AS bodyIds UNWIND bodyIds AS bodyId",
"MATCH (a:`%s`)-[:Contains]->(c:SynapseSet)-[:Contains]->(s:Synapse)-[:SynapsesTo]->(:Synapse)<-[:Contains]-(:SynapseSet)<-[:Contains]-(b:`%s`)",
"WHERE a.bodyId=bodyId AND (s.type='pre') %s",
Expand All @@ -111,7 +111,7 @@ neuprint_get_synapses <- function(bodyids, roi = NULL, remove.autapses=TRUE,
id2json(bodyids),
"Segment",
"Segment",
roi)
roiQ)
nc.post = neuprint_fetch_custom(cypher=cypher.post, conn = conn, dataset = dataset, ...)
nc.pre = neuprint_fetch_custom(cypher=cypher.pre, conn = conn, dataset = dataset, ...)
m = rbind(neuprint_list2df(nc.post),neuprint_list2df(nc.pre))
Expand Down

0 comments on commit 6530fce

Please sign in to comment.