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

Resting State tutorial #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
HypothesisTests = "09f84164-cd44-5f33-b23f-e6b0d136a0d5"
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
Neuroblox = "769b91e5-4c60-41ee-bfae-153c84203cb2"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

Expand Down
Binary file added docs/anim_fps5.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions docs/src/tutorials/resting_state_wb.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ using DataFrames
using MetaGraphs
using DifferentialEquations
using Random
using Plots
using CairoMakie
using Statistics
using HypothesisTests

# read connection matrix from file
weights = CSV.read("../data/weights.csv",DataFrame)
weights = CSV.read("data/weights.csv",DataFrame)
region_names = names(weights)

wm = Array(weights)
Expand Down Expand Up @@ -55,7 +55,14 @@ To solve the system, we first create an Stochastic Differential Equation Problem
```@example resting-state-circuit
prob = SDEProblem(sys,rand(-2:0.1:4,76*2), (0.0, 6e5), [])
sol = solve(prob, EulerHeun(), dt=0.5, saveat=5)
plot(sol.t,sol[5,:],xlims=(1000,10000))

# show time series of one of the neural mass models
fig1 = Figure()
ax1 = Axis(fig1[1,1], xlabel="time in ms", ylabel="FH NMM #5")
xlims!(5000,10000)
ylims!(-0.5,0.2)
lines!(sol.t,sol[5,:])
fig1
```
To evaluate the connectivity of our simulated resting state network, we calculate the statistically significant correlations

Expand All @@ -73,10 +80,16 @@ for i in 1:76
p[i,j] = pvalue(OneSampleTTest(css[i,j,:]))
end
end
heatmap(log10.(p) .* (p .< 0.05),aspect_ratio = :equal)
fig2 = Figure()
ax2 = Axis(fig2[1,1], xlabel="regions", ylabel="regions",title="Simulated correlations")
heatmap!(log10.(p) .* (p .< 0.05),aspect_ratio = :equal)
fig2
```
Fig.: log10(p value) displaying statistally significant correlation between time series
```@example resting-state-circuit
heatmap(wm,aspect_ratio = :equal)
fig3 = Figure()
ax3 = Axis(fig3[1,1], xlabel="regions", ylabel="regions",title="HCP connection strength")
heatmap!(wm,aspect_ratio = :equal)
fig3
```
Fig.: Connection Adjacency Matrix that was used to connect the neural mass models
Loading