recording current

Anything that doesn't fit elsewhere.
Post Reply
shyam_u2
Posts: 77
Joined: Sun Feb 20, 2011 7:15 pm

recording current

Post by shyam_u2 »

I have a network of cells connected by gap junctions and GABA synapses.. I need to record the total membrane current of each cell and analyse them. Is extracellular mechanism a way to do this ? If so, will it alter the cell's behaviour ?
What should be the value of the parameters in extracellular mechanism ?

Thanks in advance.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording current

Post by ted »

Just insert extracellular into all compartments. Its default parameter values are fine for your application and will have no effect on simulation results. If you must record all membrane currents, it will be necessary to set up Vector record in all segments of all sections. Since i_membrane is in density units, it will be necessary to multiply all recorded currents by the corresponding segment areas after the simulation.
Example of how to set up recording of currents:

Code: Select all

// assumes that model setup is complete
// and that extracellular has already been inserted into all sections
objref iveclist // will be a List that holds all Vectors that record i_membrane
iveclist = new List()
objref areavec // will be a Vector whose elements are the comparment areas
areavec = new Vector()

proc set_up_recording() { localobj tobj
  iveclist = new List()
  areavec = new Vector()
  forall for (x,0) {
    tobj = new Vector()
    tobj.record(&i_membrane(x))
    iveclist.append(tobj) // currents will be in mA/cm2
    areavec.append(area(x)) // areas will be in um2
  }
}

set_up_recording()
Example of how to automate postprocessing of recorded currents:

Code: Select all

proc myrun() { local i
  run()
  i = 0
  forall for (x,0) {
    iveclist.o(i).mul(1e-2*areavec.x[i]) // convert (mA/cm2) into (nA)
    i+=1
  }
}

myrun() // execute a simulation and postprocess the recorded data
shyam_u2
Posts: 77
Joined: Sun Feb 20, 2011 7:15 pm

Re: recording current

Post by shyam_u2 »

But the current is too small even after doing post processing(scaling).
Its something around 10 to the power of -13 nA.
Thats way too small.
Any comments?
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording current

Post by ted »

Suggest you run some tests on simple models. Start with a model consisting of one biophysical model cell, with one synapse driven by events from a NetStim. What membrane current do you find?

Then make a toy network that has two biophysical model cells that are connected by a gap junction. Drive a synapse on one of them with events from a NetStim. What membrane current do you find?
shilpa
Posts: 14
Joined: Wed May 25, 2005 9:01 am
Location: India

Re: recording current

Post by shilpa »

Hello Ted,
I get the following error when I try to implement the code with a preexisting model:
extracellular mechanism not inserted in section xScale
However if I go to the GUI and view inserted mechanisms xtra is present. I am not sure what I am missing. I also tried with xtr.mod, same error. My adapted is code is as below

Code: Select all

objref iveclist, tobj,Res,savdata,xvec,yvec,zvec,xyzMat, areavec
iveclist = new List ()
xvec= new Vector()
yvec= new Vector()
zvec= new Vector()
xyzMat=new Matrix()
 areavec=new Vector()
 
 forall {
         insert xtra
  }
 
forall for (x,0) {
    tobj = new Vector()
    tobj.record(&i_membrane(x))
    iveclist.append(tobj) // currents will be in mA/cm2
    areavec.append(area(x)) // areas will be in um2
    xvec.append(x3d(x))
     yvec.append(y3d(x))
      zvec.append(z3d(x))
  }
 
proc calcCurr() { local i localobj savdata1
run()
savdata1 = new File()
savdata1.wopen("matRecData.dat")
   i = 0
  forall for (x,0) {
      (iveclist.o(i).mul(1e-2*areavec.x[i])).printf(savdata1)  // convert (mA/cm2) into (nA)    
    i+=1
  }
  savdata1.close()
}
calcCurr() // execute a simulation and postprocess the recorded data

xyzMat.resize(xvec.size(),3)
xyzMat.setcol(0,xvec)
xyzMat.setcol(1,yvec)
xyzMat.setcol(2,zvec)

savdata = new File()
savdata.wopen("matRecxyz.dat")
xyzMat.fprint(savdata)
savdata.close()
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording current

Post by ted »

shilpa wrote:I get the following error when I try to implement the code with a preexisting model:
extracellular mechanism not inserted in section xScale
However if I go to the GUI and view inserted mechanisms xtra is present.
The message means there is a section called xScale that does not have the extracellular mechanism. To confirm that this section exists and lacks extracellular, at the oc> prompt type
xScale psection()
and examine the interpreter's output.

The name "xScale" suggests that the section is being used only as a means to draw a line with appropriate length and orientation, i.e. it serves only a cosmetic purpose and is not really part of a "model cell." A "forall" statement, however, will try to do something to ALL sections that exist at the moment the "forall" statement is executed, even those sections that are just cosmetic. You're running into problems when tobj.record(&i_membrane(x)) tries to capture the time course of i_membrane in the sections that lack extracellular--which of course is not present in a cosmetic section like xScale.

One solution would be to revise your program by creating a SectionList that contains only those sections that are part of the model cell, then using
forsec sectionlistname
instead of "forall" when you want to iterate over only the model's sections. There are at least two ways to set up such a SectionList.
1. Easiest is if there is only one model cell, and you know the name of one section in that model cell. Then you could use the SectionList class's wholetree() method. Most model cells have a section called soma, and it makes sense to treat soma as the root of the cell's tree architecture like so

Code: Select all

objref cellsections
cellsections = new SectionList()
soma cellsections.wholetree()
2. Alternatively, if the only sections that are used as "scale bars" have names that contain the string "Scale," you could do this:

Code: Select all

objref cellsections
cellsections = new SectionList()
forall cellsections.append() // cellsections now contains all sections
forsec "Scale" cellsections.remove() // eliminates sections whose names contain the string "Scale"
After doing either 1 or 2--whichever you judge to be easiest--you can do
forsec cellsections
and you'll be iterating over only those sections that are actually part of a model cell.
shilpa
Posts: 14
Joined: Wed May 25, 2005 9:01 am
Location: India

Re: recording current

Post by shilpa »

Hello Ted,
thanks for your solution, but I am facing another problem now which didn't happen before. I get the
Segmentation violation error when I use run() after I insert the xtra mechanism
. I tried forall and forsec cellsections (with either of the methods that you suggested) both gave me the same response. The problem is only for xtra/xtr, I have used extracellular too that works fine. Do I have to change the mod file because I am excluding some sections (i.e. xScale, yScale, zScale and sElec)?
thanks again
Shilpa
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording current

Post by ted »

Sounds like I'll have to replicate this for myself. Could you zip up the necessary files and email them to me
ted dot carnevale at yale dot edu
?
Please note what to send and not to send as described in
What to include in a zip file, and what to leave out
viewtopic.php?f=28&t=560
shilpa
Posts: 14
Joined: Wed May 25, 2005 9:01 am
Location: India

Re: recording current

Post by shilpa »

Hello Ted,
I solved the issue, I was using multiple scripts and something went wrong in the order in which I called it, now I don't get any more errors. However I had a question, I want to save the data to be read in matlab from your earlier code to automate the postprocessing of recorded currents. I wasn't sure if I should write into a matrix or a list before saving as the values are from each element of list* respective area
iveclist.o(i).mul(1e-2*areavec.x)


thanks you again for your help,

Shilpa
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: recording current

Post by ted »

shilpa wrote:I wasn't sure if I should write into a matrix or a list before saving
The choice is totally up to you. If the data were recorded to Vectors that are elements of a List, it would be most direct to simply iterate over each element of the List, writing the contents of the Vectors one at a time to a single file.
Post Reply