Final task We will base our decision about your marks on your solutions of this task. People who do not send me a solution of this task but who attended the course regularly (at least 70% of the total course time), submitted several homework tasks and discussed them in the seminar have the choice To get a letter of confirmation about their course attendance To get an “ausreichend” as grade that is send to the Prüfungsamt. Rules: The final task has to be solved individually, not in groups. It is ok to use help from Wikipedia, the Matlab help etc, as long the Help does not come from another course member, your big brother or is downloaded from the internet. If you have questions please contact Sirko Straube (sirko.straube@unioldenburg.de), Julia Furche (julia.furche@mail.uni-oldenburg.de or me (jutta.kretzberg@uni-oldenburg.de, Raum W4-0-078, Tel 798 3314) I will accept also incomplete solutions and descriptions of ways how to solve the task. If you send me programs that do not work properly, please also submit a description of what does work and what does not. Solutions must be send by email to me jutta.kretzberg@uni-oldenburg.de until October 11, 2009. I will reconfirm by email when I receive your program. I will contact you when I am finished with reading, testing and comparing all programs. If necessary, I will ask you to come to my office to discuss your solution. (It might take some weeks until you hear from me.) Criteria for giving marks: Completeness and correctness of the solution Amount of extensions Generality of the programs (applicable to other data sets) Documentation (comments, help texts, variable names…) “Elegance” of the solution (structure of the program in sub-programs, usage of input and output arguments, loops vs. vecorized solutions…) Design of the user interface (user inputs, monitor outputs, figure labels…) Error tolerance (reaction to unwanted user inputs or input arguments) Exam Task SS 2009 Your task is to program two methods for the analysis of neuronal data. I would like to give you the advice to first solve the preparation exercises. They will help you a lot when you try to solve the two main tasks. You should first program the basic versions for both tasks and after that start to work on the extensions. Background: Neurons (nerve cells) transmit information via changes in their membrane voltage. They communicate with each other by generating so-called action potentials (or “spikes”). Spikes are fast, stereotypic changes of the membrane potential, which last for approximately one millisecond. Since spikes of the same neuron always look very similar, most people consider the exact shape of the spike to be irrelevant. It is only relevant if a spike occurred or not. One of the tasks of action potentials is to transfer information about visual impressions (pictures) from the eye to the brain. Based on the action potential sequences of many thousands of retinal ganglion cells the brain has to find out what the picture that elicited these responses looked like. Our impression of what we (or the laboratory animal) see originates from these signals. In the neurosciences it is an important question how the brain solves this task: Which features of the neural action potential sequences encode the stimulus? Most neuroscientists assume from the fact that in particular the spike rate (the number of the action potentials which appear in a period of certain length) plays an important role for stimulus encoding. The goal is to find the relationship between a stimulus parameter (in our case the velocity of a moving dot pattern) and the neural response, measured as the number of spikes in a time window of certain length. Data set: The matrix [CellResp.mat] contains example data from a neurophysiological experiment in which responses of retinal ganglion cells were measured. This data set contains responses of 20 simultaneously recorded retinal ganglion cells. The recording lasted for 180 seconds. The responses are stored in time bins of 1 ms. Each element of the matrix contains one of two possible values: If CellResp(17, 3089) is equal to 1, neuron 17 has generated a spike in time step 3089. If it is equal to 0 no spike was generated at this time. (You will see that the matrix contains more 0 than 1). These neuronal responses were elicited by a moving dot pattern. This pattern moved for 500 ms with a constant speed in the same direction. After this period it randomly changed its speed and sometimes also its direction and stayed constant again for 500 ms. The movement had one of 9 different velocities: -2.5, - 1.875, -1.25, -0.625, 0, 0.625, 1.25, 1.875, 2.5 [mm/s] The sign of the values indicates in which of two possible directions (left versus right) the pattern moved. 0 means that the pattern was standing still for 500 ms. The sequence of pattern velocities is stored in [StimVec.mat]. Each element of this vector means that the pattern moved for 500 ms with this velocity, stimulating the 20 neurons contained in the data set. Preparation tasks: I would suggest that you practice to handle the data before you start to work on the task. It is not so easy to take a look at the data because the data set is relatively big. Practice by calculating: a. How many spikes were generated in total by each of the neurons? b. How many spikes were generated during the first 500 ms (during the presentation of the first stimulus) by each of the neurons? c. How many spikes did all neurons together generate during the first 500 ms? d. Does the first 250 ms half of this time period contain more or less spikes than the second half? e. Use imagesc to take a look at the responses of all neurons during the first 500 ms. (Each spike appears as a red line on blue background.) Does the data you see match the numbers you calculated before? f. How many times was each of the 9 velocities presented to the retina? g. Generate a vector that contains the stimulus velocity for each millisecond and plot this vector. (How long does it have to be?) Also plot only the first 10 seconds of the stimulus velocity. h. How many spikes were generated by neuron 3 when the stimulus velocity -2.5 was present for the first time? i. How many spikes were generated by neuron 3 in response to each of presentations of the stimulus velocity -2.5? Task 1: Tuning curves A tuning curve shows how the number of spikes a neuron generates depends on a stimulus property. For our example we want to find out how the typical number of spikes a neuron generates in 500 ms depends on the stimulus velocity. Write a function that plots for one individual neuron the mean and the standard deviation of the response spike counts versus the velocities of the stimulus pattern. Task 2: Population responses The population response is the average of the responses of all recorded neurons to a stimulus. This type of analysis assumes that it is not important which neuron generates which spike. Write a program that calculates for each of the 500 ms long response sequences the population average of the responses of all neurons. (You will obtain one number for each 20x500 sub-matrix.) Plot the time sequence of the average responses. (Remember to use adequate figure labels.) Design your program in a flexible way, so that the user can choose the length of the time window. Possible extensions: General: a. Keep in mind that your programs should be written as general as possible. You should be able to use them for a different data set with as few efforts as possible. The next data set could contain a different number of cells, a different stimulus sequence, or even stimuli of different length. b. Design you programs in a user-friendly way. Think about the questions which outputs could be interesting for the user and where the user should be able to influence the calculations by providing input values. c. Special additional task: If you have a lot of time and are interested in programming in general, you could program a graphical user interface (GUI). You will find a tutorial how to program GUIs in the Matlab help. (This task is not easy and takes a lot of time. It is really meant as a special add-on, you do not need to program a GUI to get top marks.) Tuning curves: d. Use your function to calculate a tuning curve of one neuron to calculate the tuning curves for all neurons. Alternatively you could program a user dialogue in which the user can choose which tuning curve to display. e. Analyze the distributions of the spike numbers generated by the individual cells in response to repeated identical stimulation. Would it be more useful to calculate the median instead of the mean to generate the tuning curves of these neurons? f. Tuning can also be calculated for shorter response times than the full 500 ms during which a neuron responds to a constant stimulus velocity. Generalize your programs to make it possible to use shorter time windows (e.g. only the first 100 ms after the stimulus changes). Is the tuning different for different window lengths? Is it different if you use the last part of the responses (e.g. the last 100 ms) before the stimulus changes again instead of using the first part? g. Use curve fitting to find functions, which describe the tuning curves you calculated. Which polynome order is optimal to fit the tuning curves? What are the differences between the polynomes you find? h. ** The tuning curves can be grouped into two classes: neurons with symmetrical tuning (approximately equal spike rates for stimulus movement in both directions) and direction selective neurons (which respond with more spikes to movement in one direction than in the other). Try to find a criterion and an algorithm to separate the two classes automatically by assigning each of the tuning curves to one of the classes. Population responses: i. Adjust your program to show on the x-axis of the plot the time in seconds. Moreover make sure that you get average response vectors of equal lengths independent of the time window used for averaging. j. Systematically vary the length of the time window used for averaging. Do you find a temporal structure also within the 500 ms long periods of constant stimulus conditions? What is the shortest averaging time window for which this method is still useful? k. Use a relatively short averaging time window (e.g. 20 ms or 50 ms) to calculate the time course of the average population responses of all cells in response to all presentations of each of the 9 stimulus velocities. l. ** Try to find an algorithm to use this mean time course for each of the 9 stimulus velocities to classify the population responses. Your task is the same as the task of the brain: you have to estimate based on the population response to a single presentation of a stimulus which of the stimuli it was. Do some statistics how often your program estimates the correct stimulus.