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

Adams model on ketamine #358

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Peaks = "18e31ff7-3703-566c-8e60-38913d67486b"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pluto and Plots shouldn't be in the Neuroblox project.

The way I'd recommend doing this would be to add a Project.toml in the examples folder that has things like Plots and Pluto in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MasonProtter thanks for checking out. Once the code is straightened, I always remove those packages before merging. Its not an oversight I assure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but I think it'd actually be helpful to have those tools in a separate project so that users can use them in the examples.

The way this would be done is you'd do something like

cd Neuroblox
julia --project=examples

and then from within julia you'd do

julia> using Pkg; pkg"dev ." # add Neuroblox itself to the current environment

julia> pkg"add Plots Pluto DifferentialEquations Graphs MetaGraphs"

and then whenever you work on code that goes in the examples, you just need to activate the Neuroblox/examples folder instead of the Neuroblox folder itself.

Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Expand Down
34 changes: 34 additions & 0 deletions examples/Adam_NMDA_MWE.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Neuroblox
using DifferentialEquations
using Graphs
using MetaGraphs
using Plots

@named n1=HHNeuronExci_pyr_Adam_Blox(σ=3;N_nmda=1,namespace=:g)
@named n2=HHNeuronExci_pyr_Adam_Blox(σ=3;N_nmda=1,namespace=:g)

assembly = [n1,n2]
g = MetaDiGraph()
add_blox!.(Ref(g), assembly)
add_edge!(g,1,2,Dict(:weight=>0,:nmda=>true,:nmda_weight=>1))

@named neuron_net = system_from_graph(g)
sys = structural_simplify(neuron_net)
prob = SDEProblem(sys, [], (0.0, 2000), [])
sol = solve(prob, ImplicitEM(),saveat = 0.01)
ss=convert(Array,sol)
st=unknowns(sys)
vlist=Int64[]
for ii = 1:length(st)
if contains(string(st[ii]), "V(t)")
push!(vlist,ii)
end
end
V = ss[vlist,:]

VV=zeros(length(vlist),length(sol.t))
for ii = 1:length(vlist)
VV[ii,:] .= V[ii,:] .+ 200*(ii-1)

end
plot(sol.t,VV[:,:]',color= "blue",label=false)
7 changes: 5 additions & 2 deletions src/Neuroblox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ abstract type Merger end
# subtypes of Blox define categories of Blox that are displayed in separate sections of the GUI
abstract type AbstractNeuronBlox <: AbstractBlox end
abstract type NeuralMassBlox <: AbstractBlox end
abstract type CompositeBlox <: AbstractBlox end
abstract type AbstractCompositeBlox <: AbstractBlox end
abstract type StimulusBlox <: AbstractBlox end
abstract type ObserverBlox end # not AbstractBlox since it should not show up in the GUI
abstract type AbstractReceptorBlox end # not shown in the GUI

# we define these in neural_mass.jl
# abstract type HarmonicOscillatorBlox <: NeuralMassBlox end
Expand Down Expand Up @@ -99,6 +100,7 @@ include("blox/cortical_blox.jl")
include("blox/canonicalmicrocircuit.jl")
include("blox/neuron_models.jl")
include("blox/DBS_Model_Blox_Adam_Brown.jl")
include("blox/Ketamine_Cortical_Model_Blox_Adam_Brown.jl")
include("blox/van_der_pol.jl")
include("blox/ts_outputs.jl")
include("blox/sources.jl")
Expand Down Expand Up @@ -188,7 +190,8 @@ export JansenRitSPM12, next_generation, qif_neuron, if_neuron, hh_neuron_excitat
hh_neuron_inhibitory, van_der_pol, Generic2dOscillator
export HHNeuronExciBlox, HHNeuronInhibBlox, IFNeuron, LIFNeuron, QIFNeuron, IzhikevichNeuron,
CanonicalMicroCircuitBlox, WinnerTakeAllBlox, CorticalBlox, SuperCortical, HHNeuronInhib_MSN_Adam_Blox, HHNeuronInhib_FSI_Adam_Blox, HHNeuronExci_STN_Adam_Blox,
HHNeuronInhib_GPe_Adam_Blox, Striatum_MSN_Adam, Striatum_FSI_Adam, GPe_Adam, STN_Adam
HHNeuronInhib_GPe_Adam_Blox, Striatum_MSN_Adam, Striatum_FSI_Adam, GPe_Adam, STN_Adam, HHNeuronExci_pyr_Adam_Blox, HHNeuronInh_inter_Adam_Blox
export Cortical_Pyramidal_Assembly_Adam, Cortical_Interneuron_Assembly_Phasic_Adam, Cortical_Interneuron_Assembly_Tonic_Adam, NMDA_receptor, Steady_Glutamate, Glutamate_puff
export LinearNeuralMass, HarmonicOscillator, JansenRit, WilsonCowan, LarterBreakspear, NextGenerationBlox, NextGenerationResolvedBlox, NextGenerationEIBlox
export Matrisome, Striosome, Striatum, GPi, GPe, Thalamus, STN, TAN, SNc
export HebbianPlasticity, HebbianModulationPlasticity
Expand Down
8 changes: 4 additions & 4 deletions src/blox/DBS_Model_Blox_Adam_Brown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Subcortical Blox used for DBS model in Adam et al,2021
"""

struct Striatum_MSN_Adam <: CompositeBlox
struct Striatum_MSN_Adam <: AbstractCompositeBlox
namespace
parts
odesystem
Expand Down Expand Up @@ -69,7 +69,7 @@ struct Striatum_MSN_Adam <: CompositeBlox

end

struct Striatum_FSI_Adam <: CompositeBlox
struct Striatum_FSI_Adam <: AbstractCompositeBlox
namespace
parts
odesystem
Expand Down Expand Up @@ -165,7 +165,7 @@ struct Striatum_FSI_Adam <: CompositeBlox

end

struct GPe_Adam <: CompositeBlox
struct GPe_Adam <: AbstractCompositeBlox
namespace
parts
odesystem
Expand Down Expand Up @@ -232,7 +232,7 @@ struct GPe_Adam <: CompositeBlox

end

struct STN_Adam <: CompositeBlox
struct STN_Adam <: AbstractCompositeBlox
namespace
parts
odesystem
Expand Down
Loading
Loading