Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get synapses fix #102

Merged
merged 3 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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