Closed vi-hart closed 3 years ago
rebased onto main
to pull in recent patches, tests, and dependency updates. I'll start reviewing the changes next
Still not done, but the idea is to continue implementing overloads to satisfy the AbstractSystem
interface next.
Then, in channel construction we can do something roughly like...
kinetics = merge(mgate, hgate)
wrap = ODESystem([g ~ gbar * mgate.transform(mgate.output) * ... etc], name = :NaV)
channel = extend(wrap, convert(ODESystem, kinetics))
Implemented basic macros for generating gates and ion channels. It may break while reworking gates and ion channels, but is a start/template for later.
# p defaults to 1
@gate h begin
α = 0.07*exp(-(Vₘ + 65)/20)
β = 1/(1 + exp(-(Vₘ + 35)/10))
end
# a gate can be generated with a unique variable name
@gate begin
α = 0.07*exp(-(Vₘ + 65)/20)
β = 1/(1 + exp(-(Vₘ + 35)/10))
end
# support for additional parameters (ie. vshift)
@gate m begin
α = 0.1*(Vₘ + 40 - vshift)/(1 - exp(-(Vₘ + 40)/10))
β = 4*exp(-(Vₘ + 65)/18)
end p = 3
# order of the rate equations doesn't matter
@gate m begin
β = 4*exp(-(Vₘ + 65)/18)
α = 0.1*(Vₘ + 40)/(1 - exp(-(Vₘ + 40)/10))
end p = 3
# gate macros can be nested inside an ionchannel macro
NaV = @ionchannel NaV{Sodium} begin
@gate m begin
α = 0.1*(Vₘ + 40)/(1 - exp(-(Vₘ + 40)/10))
β = 4*exp(-(Vₘ + 65)/18)
end p = 3
@gate h begin
α = 0.07*exp(-(Vₘ + 65)/20)
β = 1/(1 + exp(-(Vₘ + 35)/10))
end
end gbar = 100mS/cm^2
@pjh6654 Nice start! The macro work should really live in a separate PR though. Even though there's more to do here and tests aren't passing, I'm going to merge what we have so far to main
so that dividing up the additional work is less complicated.
Gate
can accept anyAbstractSystem
allowing for overloading of functions likeIonChannel
or_conductance
. The Generator forGate
uses aReactionSystem
and allows for simple conversion to other system types through optional kwargs.