Modelling a channel with multiple markov states

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

Post Reply
SurG
Posts: 11
Joined: Fri Jun 19, 2015 4:39 pm

Modelling a channel with multiple markov states

Post by SurG »

Hello,
I'm trying to model a channel that is governed by 4 states, C1,C2,C3,O. The transitions from 1 state to another are bidirectional. I have initialised these states using the rxd.State and tried to model them using rxd.Rate, but am getting a compilation error "TypeError: unsupported operand type(s) for *: 'float' and 'Rate' ".

O = rxd.State(cyt_er_membrane, initial=0)
C1= rxd.State(cyt_er_membrane, initial=1)
C2 = rxd.State(cyt_er_membrane, initial=0)
C3 = rxd.State(cyt_er_membrane, initial=0)

C1 = rxd.Rate(C1, ((kim*C2)-(ki*ca[cyt]*C1))-((ko*ca[cyt]**2*C1)-(kom*O)))
C2 = rxd.Rate(C2, (((ki*ca[cyt]*O)-(kim*C2))-((kom*C2)-(ko*ca[cyt]**2*C3))))
O = rxd.Rate(O, ((ko*C1*ca[cyt]**2)-(kom*O))-((ki*ca[cyt]*O)-(kim*C2)))
C3 = rxd.Rate(C3, (((kom*C2)-(ko*C3*ca[cyt]**2))-((kim*C3)-(ki*ca[cyt]*C1))))

I had also tried using rxd.Reaction but the error is "'Reaction' object has no attribute '_sources'". I feel I'm making a fundamental mistake while modelling these equations in RxD.
(my apologies for the inelegant codes)
RBJ
Posts: 62
Joined: Sun Aug 02, 2015 4:28 am
Location: UK
Contact:

Re: Modelling a channel with multiple markov states

Post by RBJ »

...Interesting, I didn't realise that was a feature of RxD, my Markov channel models are built with Channel Builder and then imported into my code (that includes RxD). I will interested to hear the answer to this enquiry also.
Regards
SurG
Posts: 11
Joined: Fri Jun 19, 2015 4:39 pm

Re: Modelling a channel with multiple markov states

Post by SurG »

This channel has a parameter that is gated by ca[er]. I have an NMODL equivalent of this channel but I don't know how to make that .mod file read the changes in ca[er]. That's why I thought of modelling it in RxD, where I can declare its 'Region' and 'Direction of action'.
How did you overcome this problem? That might also help me in my end-objective.
RBJ
Posts: 62
Joined: Sun Aug 02, 2015 4:28 am
Location: UK
Contact:

Re: Modelling a channel with multiple markov states

Post by RBJ »

Sorry, my RXD models use pointers to gate channelbuilder channels with temperature not Ca[er]. So that approach may work with your problem, using Ca[er] instead of temperature... but look I am just a regular NEURON user, not an expert, so lets see what the experts say :-)
If "your" method works it seems much more direct!!!
adamjhn
Posts: 54
Joined: Tue Apr 18, 2017 10:05 am

Re: Modelling a channel with multiple markov states

Post by adamjhn »

I think the problem is with the Python namespace. When you create your first rate "C1 = rxd.Rate(C1, ... " it overwrites the C1 state you defined earlier, so when you come to use it in "O = rxd.Rate(O, ((ko*C1 ...", the C1 here now refers to a Rate not a State.

The solution is to use a different variable names for all your rates e.g.
C1transition = rxd.Rate(C1, ((kim*C2)-(ki*ca[cyt]*C1))-((ko*ca[cyt]**2*C1)-(kom*O)))
SurG
Posts: 11
Joined: Fri Jun 19, 2015 4:39 pm

Re: Modelling a channel with multiple markov states

Post by SurG »

Hello,
I have been working on this for a while and I'm quite lost.
As explained in the first post, I am trying to create a multiple state Markov model. It is of the form:

r1 = rxd.Rate(C1, ((kim*C2)-(ki*ca[cyt]*C1))-((ko*ca[cyt]**2*C1)-(kom*O)))
r2 = rxd.Rate(C2, (((ki*ca[cyt]*O)-(kim*C2))-((kom*C2)-(ko*ca[cyt]**2*C3))))
r3 = rxd.Rate(O, ((ko*C1*ca[cyt]**2)-(kom*O))-((ki*ca[cyt]*O)-(kim*C2)))
r4= rxd.Rate(C3, (((kom*C2)-(ko*C3*ca[cyt]**2))-((kim*C3)-(ki*ca[cyt]*C1))))
Kr = A*O #where A is a constant (float)
a1 = rxd.MultiCompartmentReaction(ca[er]>ca[cyt],Kr, membrane=cyt_er_membrane)

1. Now, I am unable to plot Kr with respect to time and the error displayed is:
ValueError: x and y must have same first dimension, but have shapes (1049,) and (1,)

2. The type(Kr) is "neuron.rxd.rxdmath._Arithmeticed", whereas it should be an array, same as type(time)
I tried converting Kr to an array but the above type does not have ".as_numpy() attribute"

3. I converted ca[cyt] to a numpy array and tried to resimulate r1, r2, r3, r4, but I get the following error:
TypeError: unhashable type: 'numpy.ndarray'

I'm not able to understand how to resolve this.
adamjhn
Posts: 54
Joined: Tue Apr 18, 2017 10:05 am

Re: Modelling a channel with multiple markov states

Post by adamjhn »

I think the problem is O is a rxd.State. To access the values of a state (or species) you can use the nodes.

E.g. If you have defined nodes on a section called ‘dend’ then;

Code: Select all

O.nodes(dend(0.5)).value
Will give you the value of O at the current time in the simulation, in the middle of ‘dend’.

To record the value during a simulation use;

Code: Select all

O_vec = h.Vector().record(O.nodes(dend(0.5))._ref_value)
To plot Kr just multiple the vector the float e.g.

Code: Select all

Kr_vec = A*O_vec
Similarly for ca, you can access the nodes by specifying both the region and the segment, e.g.

Code: Select all

ca_er_vec = h.Vector().record(ca.nodes(er)(dend(0.5))._ref_concentration)
SurG
Posts: 11
Joined: Fri Jun 19, 2015 4:39 pm

Re: Modelling a channel with multiple markov states

Post by SurG »

Thank you sir. I will try this out
Post Reply