Remember the
last time you were sitting in front of your system with tons of unanalyzed data
looking back at you. And remember the kind of motivation you needed to get
yourself started on the unintelligent task of button pressing repeatedly, doing
the same thing over and over again for all your participants.
Above
statements might sound very familiar to researchers in any field but especially
to researchers in Neuro-Imaging where a 20 min MRI scan may produce data as
huge as 1 GB! And, where a common practice is to use atleast 16-25 participants
for one study. So you are stuck behind your computer, repeating a procedure
16-25 times without you getting any smarter.
All this can
be changed by just automatizing the whole process. So that you don’t have to do
the entire task manually but the computer does it automatically for you. You
just specify the procedure and then let the computer do everything else. How so
much magical it might sound, it’s a very feasible option and is practiced by
many labs. Customized Batch scripts as they are called are very useful option
while analyzing data.
Some of the
instances in Neuro-Imaging where making a batch script is useful include
1. fMRI preprocessing and statistics.
2. Behavioral data analysis.
fMRI
preprocessing and statistics is a very laborious but essential step to be
repeated for all participants. SPM8 version of the SPM software package
includes a very efficient batch system (Details shown in spm8 manual). Also,
the new batch system in spm8 allows for addition of new toolbox by adding
config files. These config files can be saved in spm8 toolbox folder and they
will be loaded just as other toolboxes (see some sample config files in folders
spm8/toolbox or in spm8/config). The new batch system allows you to specify inputs
to your function at the same time and an option for dependency (instead of
virtual files in spm5).
Behavioral
data analysis can be automated in different softwares. One of the easiest ways
is to automate it in Microsoft Excel by the use of Macros. Macros is a visual
basic addition to the Excel. It’s a set of stored series of commands and
functions that can be run to automate a process (see http://office.microsoft.com/en-us/excel-help/CH010100157.aspx). The way you create a macro is by
recording your actions just once and it saves whatever you do. This you can do
repeatedly for similar data.
For example,
a macro code (below) checks whether the accuracy in a list of trials is 1 or
not. What it essentially checks is the following condition in Excel : =IF((AND(F4="",E4="")),"",IF(OR(F4=1,E4=1),1,0))
Sub
AccuracyRTCorrec()
'
'
AccuracyRTCorrec Macro
'
' Keyboard
Shortcut: Ctrl+q
'
Range("M2").Select
ActiveCell.FormulaR1C1 = "Accuracy"
Range("M4").Select
ActiveCell.FormulaR1C1 = _
"=IF((AND(RC[-7]="""",RC[-8]="""")),"""",IF(OR(RC[-7]=1,RC[-8]=1),1,0))"
Range("M4").Select
Selection.Copy
Range("M5:M162").Select
ActiveSheet.Paste
End Sub
The
condition checks if the cells F4 and E4 are empty, returns an empty cell for it
or else if either one of them is 1, places the value as 1.
Such macros
are useful while analyzing behavioral data for different participants and can
do the calculation for 80-100 trials in just a second, by pressing a shortcut
key for the macro.
Automation
not only saves a huge amount of time for the researcher which he/she can use to
plan better experiments etc. , it also ensures that there is no human error
involved especially when its late in the night and you are in a hurry to
analyze data due for a presentation next morning (researchers who have to share
facilities and thus have to use them only at night, can relate to this). Plus
all of your data goes through the same code unbiased.
Limitations
of Automatisation:
As always
there are limitations to this entire nice magical seeming thing:
1. Everything can’t be automatised and if a single error creeps in the code, it’s most likely to go unnoticed if not checked properly: So always check the results for anything spurious.
2. Bad data è Wrong results. But if it’s automated, you may miss it: Keep checking your unanalyzed data for image artifacts and other problems.
3. You may miss out on interesting trends. Many researchers will agree that data sometimes shows some interesting and surprising trends that are best noticed when you are manually performing the analysis. But if such trends do indeed exist and is not a ghost, then they will survive.
So all in
all, automatisation is good. I hope we get more and more customized batch
scripts in future…
No comments:
Post a Comment