russelljjarvis / SpinnakerHippocampus

Assignments for an academic course
0 stars 3 forks source link

Rich Club: Sprint/Backlog for assignment. #5

Closed russelljjarvis closed 6 years ago

russelljjarvis commented 6 years ago

@danpetty @deniseEjohnson

Greetings team mates. I am going to put some work here to guide the team assignment in case it's unclear about what we need to do in the next ~4 weeks.

For anyone feeling lost, or needing low hanging fruit: Make any of the following presentations slides described herein. The task of making these slides will help you understand the project more, and conversely doing more project will help you understand more slides.

Goals and Strategies:

Slides

Slide 1.

What is a network connection matrix, explain: row elements are presynaptic neurons, column elements are post synaptic neurons.

Slide 2 and 3

Why does the connection matrix look more intuitive and informative as a chord diagram or a cluster map?

Slide 4.

What is an ISI? This slide is mainly a graph of a single neuron spike train, and maybe an ISI histogram also.

Slide 5.

What is the Coefficient of variation? And how might it detect repeating temporal patterns?

Slide 6.

What is a raster plot? Develop a raster plot with excitatory and inhibitory neurons colour coded. At best, including a rotated bar chart for CV where CV per cell matches raster plot cell indexes

Slide 7.

What is bivariate Spike Distance?

Slide 8

What is multivariate spike distance and why does this look better visualized as a seaborne cluster map?

Slide 8.5

What is a 'Rich club', what is a 'clique'?

Slide 8.75

Last slide Continued ... In slide 1, we described 'structural connectivity' ie real structural synaptic connections. In slide 7-8 we described spike distances which relate to 'effective connectivity'. The 'Rich club', or the 'clique', is a bridge between structure and function.

Slide 9

Small world versus biologically informed connectivity.

Slide 10

Information in the network is an experimental wiring pattern in a small network
sufficient for producing high between neuron spike distances, and low within neuron coefficient of variation.

Slide 11.

Answering slide 10. Experimentally informed wiring is probably not enough in such a simple network to create the expected ISI variance within and between neurons, and this is why.

Slide 12.

Information in the clique, or the indegree more spike distant and are outdegree hubs less distant?

Slide 13

Bibliography using three references at the end.

With what I have written below, I don't think it matters if you both do work on each others objectives. As long as keep track on who did what, and as long as everyone feels confident that they have their own territories in the presentation material. As I have divided out (possible) responsibilities below Dan might have a bit too much work and Denise too little. I propose that if anyone feels like it, voluntarily redistributing work with each other, but communicating about it.

Writing in some of the theoretical foundations from the above three literature sources into a power point presentation could be another way of doing work towards the project.

Code methods:

Dan and I found that is sometimes better to manually download files from this link. https://www.dropbox.com/sh/2a7jddzztsh3h24/AAAvSeRNTZjsTzgexv0t0bgBa?dl=0

@denise I made some progress with Plotting chord diagrams. I found out that making interactive chord diagrams involves a non trivial debugging of plot.ly code. Instead I propose using the methods that worked [here]. I would prefer the interactive graphs, but I am just worried that they are not achievable in the limited time. (https://github.com/danpetty/DAnalysisCNeuro/blob/master/PlotChords.ipynb) to make non interactive graphs. We should write generalizable code that numbers each neuron, and color codes the ribbons depending on if each neuron is making an excitatory or inhibitory synapse with its projection target (the projecting end of the ribbon).

If you are having trouble simply getting the data, Dan and I found through trial and error that you might need to manually dowload onto your own machine by using this link (github has file size limits)

When I write generalizable above I mean that the list/matrix sizes are not hard coded, and that the chord plot code is wrapped in a function

def plot_chord(parameter_matrix):
    pass
    # code that plots that converts types and plots the chord diagram

we need a method that takes either a numpy.matrix, a numpy.array of arrays, or a list of lists. The lengths of all these types can probably be found with np.shape(parameter_matrix), or len(parameter_matrix).

Since the graph is directed (not bi directional), it might be worth putting an arrow head on each ribbon too if possible.

@danpetty

Argument Spike Distance Versus Coefficient of Variation:

We want to argue that a realistic network should have high neuronal De-synchronization (high multivariate spike distance), while at the same time, over long duration neuronal recordings, neurons should have a relatively lower coefficient of variation (compared to that the CV resulting from high-frequency noise) because of repeating temporal spatial patterns. The bar chart we made today of elephant.cv(spike_train) versus neuron can help make that argument that Coefficient of Variation (CV) is low, while simultaneously there is high spike distance relative to the other neurons in the network (low within neuron spike time variance, with higher between neuron spike variance). Ideally we would have that bar chart rotated by 90degrees and plotted along side this raster plot. I don't think it matters if the CV is in fact found to be as high as noisey spike times at the same spike rate (a control condition), just as long we describe what we find and make an argument about the observation.

@danpetty in your file https://github.com/danpetty/DAnalysisCNeuro/blob/master/PickleRecoveryAttempt.ipynb We have made a skeleton work flow for plotting matrices that are sorted, and then have hierarchical dendrograms (seaborn cluster maps) projecting out of the sides.

mport seaborn as sns
sns.set()
sns.clustermap(conn_mat[0],cmap='vlag',vmin=-1,vmax=1);

It would be awesome if this was inside a function definition too, such that we could put in the right type and it would plot the cluster map.

I propose that every matrix used in the network simulation that we plot should either be visualized as a chord diagram or a seaborn cluster gram.

Also @danpetty in the latest file on your local machine Untitled.ipynb, we can use the pickle loaded file to create spike train distance plots using the code below:

Ideally we need to data wrangle them such that the matrices plotted in the imshow like code below, are instead visualized as chord diagrams/ or sns cluster maps (as we unanimously agree that 2D flat plots of matrices are dumb and ugly):

import pyspike as spk

plt.figure()
plt.plot(x, np.abs(y), '--k', label="ISI-profile")
print("ISI-distance: %.8f" % f.avrg())
f = spk.spike_profile(spike_trains, indices=[0, 1])
x, y = f.get_plottable_data()
plt.plot(x, y, '-b', label="SPIKE-profile")
print("SPIKE-distance: %.8f" % f.avrg())
plt.legend(loc="upper left")
plt.show()

plt.figure()

f = spk.spike_sync_profile(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()
plt.plot(x, y, '--ok', label="SPIKE-SYNC profile")
#print(f.x)
#print(f.y)
#print(f.mp)

print("Average:", f.avrg())

f = spk.spike_profile(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()

plt.plot(x, y, '-b', label="SPIKE-profile")

plt.axis([0, 4000, -0.1, 1.1])
plt.legend(loc="center right")

plt.figure()

plt.subplot(211)

f = spk.spike_sync_profile(spike_trains)
x, y = f.get_plottable_data()
plt.plot(x, y, '-b', alpha=0.7, label="SPIKE-Sync profile")

x1, y1 = f.get_plottable_data(averaging_window_size=50)
plt.plot(x1, y1, '-k', lw=2.5, label="averaged SPIKE-Sync profile")

plt.subplot(212)

f_psth = spk.psth(spike_trains, bin_size=50.0)
x, y = f_psth.get_plottable_data()
plt.plot(x, y, '-k', alpha=1.0, label="PSTH")

print("Average:", f.avrg())

plt.show()

#print(spike_trains)
plt.figure()
isi_distance = spk.isi_distance_matrix(spike_trains)
plt.imshow(isi_distance, interpolation='none')
plt.title("ISI-distance")
plt.show()

plt.figure()
spike_distance = spk.spike_distance_matrix(spike_trains, interval=(0, tstop))
plt.imshow(spike_distance, interpolation='none')
plt.title("SPIKE-distance, T=0-1000")
plt.show()

plt.figure()
spike_sync = spk.spike_sync_matrix(spike_trains, interval=(0, tstop))
plt.imshow(spike_sync, interpolation='none')
plt.title("SPIKE-Sync, T=2000-4000")
plt.show()

My goals

bulk_download.sh

wget -O more_files "https://www.dropbox.com/sh/ap2zd8ozjdowxsp/AABkFH5LRqrvQHbxy3VuMHgaa?dl=1"
nohup bulk_download.sh

I am guessing no one will read this so I am putting it last:

Theoretical Background:

Explaining how the small world network research paper, would have been better if the network connectivity was not an artificially derived small world connectivity, but rather an experimentally derived network connectivity, such as the one described here. Also the analysis described by Qi and Zao's would have been better if it didn't just consider between cell spike train distance (between neuron dissimilarity, and desychronization), but if it also considered within neuronal repeating temporal spatial patterns, (implied by low coefficients of variation within the same neuron)

Direct Qoute: "Clustering dendrograms revealed repeating motifs of three or more patterns at up to 17 sites in CA3 that were importantly associated with specific spatial-temporal patterns of tunnel activity. The number of these motifs recorded in 3 min was significantly higher than shuffled spike activity and not seen above chance in control networks in which CA3 was apposed to CA3 or DG to DG. Together, these results demonstrate spontaneous input-dependent repeatable coding of distributed activity in CA3 networks driven by engineered inputs from DG networks. These functional configurations at measured times of activation (motifs) emerge from anatomically accurate feed-forward connections from DG through tunnels to CA3."

russelljjarvis commented 6 years ago

Other links: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2743683/

https://arxiv.org/pdf/1605.09073.pdf

http://hippocampome.org/php/index.php

https://github.com/rgutzen/ValidationTools/blob/master/Graph_theory_example_figures.ipynb (edited)

danpetty commented 6 years ago

Russell: The arxiv link in the last comment doesn't work for me at the moment. Do you know what it was called?

russelljjarvis commented 6 years ago

Hi @danpetty I think it is: 'Feedback through graph motifs relates structure and function in complex networks', it was recommended by Sharon.