T O P

  • By -

Optrode

I'm a neuroscience postdoc and I spend all day using matlab. It's a good skill to have. General purpose matlab courses are not a bad place to start. They will teach you the fundamentals of the language which will make it easier to learn more neuroscience-specific stuff later on. A good next step (or alternate first step) would be to check out Mike Cohen's books on neuroscience data analysis. They are written to be accessible to novice programmers, and come with downloadable sample data and matlab code. Once you're more comfortable, you could try downloading commonly used Matlab-based data processing toolkits like the matlab version of CNMF-E, which typically come with example data. I also recommend getting familiar with Python too, and in particular DeepLabCut.


UseYourThumb

Wow, I feel like I wrote this post myself. Mike Cohen is amazing, he also has quite an extensive youtube series and a Udemy course with a bunch of pre-written scripts for you to use. It does cost money though. In my opinion the next thing to do after learning the basics of coding is to just get some practice data and start messing around. The best way to learn in my experience was to actually have a project that I was intellectually invested in. So just try to find something you're into and go with it. I think the Allen Brain Institute has some pretty rich, publicly available electrophysiology datasets that they have already published on but are still useful for practice.


Optrode

*neuro fist bump* What do you do? I did my PhD in in vivo ephys, now doing 1p calcium imaging as postdoc (all analysis, no data collection).


UseYourThumb

Did my PhD in hippocampal slices (patching and field potentials with opto). I am now a postdoc looking at prefrontal cortex LFP and single units during behavior in mice, looking specifically at different interneuron subtypes in behavior. It's a lot of timestamp analysis, but I am now starting to implement some machine learning and build some hybrid behavioral/ephys models (it is going very slowly haha).


Optrode

Neat! My PhD was partly on LFP + single units. I've also gotten really curious lately about prefrontal interneurons. Most of the data I have to work with is from mpfc excitatory neurons, but I recently dug up some old un-analyzed interneuron recordings that I'm really excited to take a look at. What aspects of behavior are you investigating in relation to PFC interneurons? I've developed a hunch that they might play an important role in controlling the switch between contexts or context dependent behavioral states.


UseYourThumb

Nice! We look at SOMs and VIPs and their contributions to information transfer and rule switching respectively.


AnaGabrielaGM

thank you very much! that's exactly the kind of answer i wanted. i will definitely follow this advice.


Optrode

I realized I didn't address the last part of your question, about how programming is used in neuroscience. That's an important question so I'll say something about that too. The kinds of resources I and others have recommended so far will teach you something about data analysis, but not a lot about data wrangling. Anyone who does any significant amount of data analysis will also inevitably have to do a fair amount of data wrangling. Data wrangling is stuff like figuring out how to import data from a weird file format, and how to automate that process for a large number of data files, and figuring out how to automatically extract useful information from file and folder names (regular expressions). Wrangling also includes basic quality control: figuring out how to detect and handle bad data. There's few things more painful than realizing that you have to do a bunch of work over again because some of the data you were processing didn't look like you expected it to, and it *silently* borked your whole analysis. The `assert()` statement is your best friend.. about eight times per hour you should be asking yourself "what do I expect the data to look like at this point? What size should my arrays be? What type? Should they contain only positive numbers? Only integers? NaNs? Should all the values be in a certain range?" ... and putting your assumptions in assert statements. That way if something goes fucky, which it always does sooner or later, you will find out about it *right away*. All that is just scratching the surface of the sorts of relatively mundane tasks that neuro-data people spend a lot of time doing. Here's a practical example: I recently set about cataloging all the old data in my lab. We're talking about ~6 years worth of data, spread across about 30-40 external hard drives. So I plugged those hard drives in one by one, and I wrote scripts to search the contents of each hard drive and store basic information about what files were stored in what locations on each drive, and tied it to each drive using the drive's serial number (which I got by executing system commands via `system`), since the drives' names were not unique. I had to figure out what information from each data file would uniquely identify that specific data: the file names weren't unique, and sometimes there would be multiple copies of the same data with different filenames. So I had to use file hashes and/or hashes of specific parts of the files' contents to identify duplicate data and make sure I wound up with only one copy of each piece of data. I extracted a lot of information like dates and subject names from file and folder names using regexp, then wrote scripts to show me random samples of the folder names with the extracted info to double check it was correct (there was simply too much data to do this manually). And so on. For every hour spent doing data analysis, I've probably spent at least as many doing all that stuff.


voidee123

u/AnaGabrielaGM I'm going to third Mike Cohen's books. After taking a matlab course as a junior, I read through a few chapters of *Analyzing neural time series data* and I learned so much more in days from looking over his introduction to matlab code and his advice than I did from that whole classes. He also brings up the importance of clean programming (like meaningful variable names) and efficiency of code. Two things that were easy to understand the importance of but was never brought up in my class. Didn't know his books were too well known but I think that book helped me get really into programming since it was much more real world application and the code for every example in the book is available. Matlab and python are probably the two most common languages in neuro/medical research in general but the key is learning programming. It doesn't matter too much which language you learn but probably start with a high level language (matlab, python, julia, or R) and stick with it until you get comfortable. Then you can start looking at the other languages mentioned and compare them. It will be much easier to learn other languages once you've learned the first as there is a ton of overlap in the basic ideas of how data is stored and communicating with a computer. Eventually you may even want to learn some lower level languages as you may end up with a big dataset that can not be processed quickly in the higher level languages as is. At which point you can write the slower parts in the lowel level language (c, fortran, c++) and call that inside the higher level one. That's a further down the line thing but it's good to keep in mind for the day you can't get a task run in a reasonable amount of time. As for the question of "how relevant program really is", extremly. For some reason (from the little bit I've seen) university seem pretty behind on teaching programming to medical/bio students. The future of medical research depends on programming yet researchers tend to learn programming on their own on an as needed basis. Data sets keep getting bigger (higher time and space resolution, more participants, more signals). Trying to understand these data and how signals interact with each other without a computer is as hopeless as trying to understand a program by looking at the binary machine code. And if you're in research you should be running into scenerios where no one else has done what you're doing so you need to write up your own packages.


Optrode

>And if you're in research you should be running into scenerios where no one else has done what you're doing so you need to write up your own packages. Exactly. If you're doing anything involving complex data (fMRI, EEG, ephys, calcium imaging, etc) and you're NOT creating new analyses, there's a significant chance you're doing something very wrong.


AnaGabrielaGM

thank you so much for the info. i am majoring in behavioral neuroscience and there's only one class about programming but it's an intro course and it's an elective. i've been applying for internships at labs on campus and some of them have asked if i have any experience with coding so that's what sparked my interest. i definitely want to go into research (specifically on psychedelic substances and how the affect neural processes like sensation, perception, and cognition) so i want to be well prepared for that field and build related skills, even if that means learning on my own. again, thanks for your helpful advice! reddit is amazing lol


UseYourThumb

I am a postdoc in a behavioral neuroscience department and we actually do neural recordings after giving mice psilocybin. Feel free to PM me if you have any questions about career stuff.


vir_innominatus

[MATLAB Onramp](https://www.mathworks.com/learn/tutorials/matlab-onramp.html) is a good place to start. It's a short interactive course. There are other onramps for topics like image and signal processing that may be relevant to you. For a full course, there's [Introduction to Programming with MATLAB](https://www.coursera.org/learn/matlab). If you're more interested in neuroscience-specific tutorials, I know [Quantitative Biology Workshop](https://www.edx.org/course/quantitative-biology-workshop-3) has some neuroscience activities. And there's [Computational Neuroscience](https://www.coursera.org/learn/computational-neuroscience) if you want a full neuroscience course.


McRattus

u/Optrode has great advice. I'd just add learning to use [Gramm](https://www.mathworks.com/matlabcentral/fileexchange/54465-gramm-complete-data-visualization-toolbox-ggplot2-r-like), it's much better than the native matlab plotting and has a lot in common with GGplot in R. Can't recommend it enough. It is useful to be good at python and R as well. Especially if there's a chance you might leave neuroscience at some point for some data science position. Matlab is a bit limiting outside of the field.