Connections issue

94 views
Skip to first unread message

Anirudh Sivarajan

unread,
Jul 10, 2024, 2:53:23 PM7/10/24
to neuPrint
Hello Neuprint,

I'm currently working with a specific region of interest (ROI) in my  project. So far, I've identified the neurons that are both presynaptic and postsynaptic to this ROI. Now, I'd like to further analyze the connections. Specifically, I want to trace how these presynaptic and postsynaptic neurons connect to the neurons within the ROI, forming a pathway from presynaptic to intermediate (within ROI) to postsynaptic neurons. Below is some example code of what I have so far.

Thanks,
Anirudh

Image 7-10-24 at 11.52 AM.jpg

stuar...@gmail.com

unread,
Jul 10, 2024, 5:25:40 PM7/10/24
to neuPrint
Hi Anirudh,

Can you provide some more detail about exactly which neurons you're interested in?  Have you selected specific sets of neurons which are upstream or downstream of the FB?  Are are you interested in all neurons that are upstream or downstream of the FB?  And are you interested only in those connections with require exactly one intermediate neuron?

Maybe the following code is a decent starting point for you.

-Stuart


from neuprint import Client, NeuronCriteria as NC, fetch_adjacencies
c = Client('neuprint.janelia.org', 'hemibrain:v1.2.1')

# Replace these with your specific neurons of interest, if you have a list.
upstream = NC(outputRois='FB')
downstream = NC(outputRois='FB')

# This finds all the direct adjacencies between the upstream and downstream set (no intermediates)
_, direct_conn = fetch_adjacencies(upstream, downstream, rois='FB', min_roi_weight=10)

# This will find all connections with a single intermediate (possibly including some that didn't need the intermediate)
_, conn_into_FB = fetch_adjacencies(upstream, None, rois='FB', min_roi_weight=10)
_, conn_outof_FB = fetch_adjacencies(conn_into_FB['bodyId_post'].unique(), downstream, rois='FB', min_roi_weight=10)
intermediates = conn_outof_FB['bodyId_pre'].unique()

# Filter the incoming connection table to include only the rows with valid intermediates.
conn_into_FB_filtered = conn_into_FB.query('bodyId_post in @intermediates')

Anirudh Sivarajan

unread,
Jul 10, 2024, 6:20:12 PM7/10/24
to neuPrint
Hey Stuart,

Thanks for the swift response, I'm interested in all neurons that are upstream and downstream of  the FB. Not only am I trying to find connections that have one intermediate neurons in the FB, but ones that may have multiple intermediates as well. I was confused about the upstream and downstream part, I want to know how the presynaptic neurons are connected to intermediate neurons inside the FB and they're connected to postsynaptic neurons. 

Thanks,

Anirudh

Lou Scheffer

unread,
Jul 11, 2024, 9:23:59 PM7/11/24
to neuPrint
Hi, Anirudh!
The problem that you will face is that there are too many paths that meet your requirements for a practical analysis.  If we make the simplifying (and true as far as I know) assumption that there are no FB intrinsic neurons, and that each FB neuron is bi-directional (has both pre and post synapses outside the FB) then we can ask how many distinct connections from any neuron coming in, to any going out (with no intermediate).  That is found by the CYPHER query:

MATCH (n:Neuron{FB:true}) - [c:ConnectsTo] -> (m:Neuron{FB:true}) RETURN n.bodyId, c.weight, m.bodyId

and there are 431,000 of them.  Even if we restrict it to strengths >= 10, as in

MATCH (n:Neuron{FB:true}) - [c:ConnectsTo] -> (m:Neuron{FB:true}) WHERE c.weight >= 10  return n.bodyId, c.weight, m.bodyId

there are more than 50,000 such connections.

Of course one-intermediate paths will be even more numerous.  A rough guess is more than 400 million, and the system will timeout if you ask for them all.  Some experimentation reveals you need to limit them to roughly strength >= 20 for both links to avoid a timeout, such as

MATCH (n:Neuron{FB:true}) - [c:ConnectsTo] -> (m:Neuron{FB:true}) - [cc:ConnectsTo] -> (p:Neuron{FB:true}) WHERE c.weight >= 20 and cc.weight >= 20 return n.bodyId, c.weight, m.bodyId, cc.weight, p.bodyId

and there are still more than 393,000 paths that meet this description.  You can then repeat this process for all 2-intermediate paths, as in

MATCH (n:Neuron{FB:true}) - [c:ConnectsTo] -> (m:Neuron{FB:true}) - [cc:ConnectsTo] -> (p:Neuron{FB:true}) - [ccc:ConnectsTo] -> (q:Neuron{FB:true}) WHERE c.weight >= 40 and cc.weight >= 40 and ccc.weight > 40 return n.bodyId, c.weight, m.bodyId, cc.weight, p.bodyId, ccc.weight, q.bodyId

and now you need to demand that all strengths are >= 40 to reduce the number of paths to consider to a mere 390,000.  (Without the strength limit there will be literally billions of such paths.)  You can repeat this process to find 3-intermediate, 4-intermediate, and so on, but you will need successively stronger limits to avoid generating too many paths.

Other restrictions (other than strength) are possible, but you will need to limit them in some manner - otherwise there are just too many paths for practical analysis.

   -Lou
Message has been deleted

Anirudh Sivarajan

unread,
Jul 20, 2024, 6:54:51 PM7/20/24
to neuPrint
Hey Lou,

Thanks so much for the insight! I am truly grateful for this information. I had a follow-up query, since my analysis changed. How will i be able to extract information about any connections inside a specific Roi, for example only the FB.
Thanks,
Anirudh

Reply all
Reply to author
Forward
0 new messages