Skip to content

Data_Analysis_Notes

Victoria Kelly edited this page Feb 8, 2019 · 11 revisions

This page contains notes for pre-processing and analyzing data for SRNDNA.

One thing to note: the majority of the headaches and issues I had were either path errors (insert Dave's voice here) or permissions errors. The extra step listed between steps 1 and 2 will tell you what to do if you run into a permissions error while running these scripts. The computer will tell you if it's a permission error very clearly. I've also tried to list as many paths as I can so that neither of us are lost in the directory while trying to run these scripts. To make things easier, it might be best to run these commands from my username tuj67828 because that's what I've been using and it's been working for me. Supposedly everyone has access to everything through the Linux workstation, so if you want to try your username go for it!

Another thing to note: when you see $sub in the commands below, don't include $ in the subject ID. For example, for subject ID 103, use 103 instead of $103.

Basic steps for experimenters:

1. Transfer data from XNAT to dicoms folder (e.g., /data/projects/srndna/dicoms/SMITH-AgindDM-102).

XNAT: an extensible open-source imaging informatics software platform dedicated to imaging-based research. This is where our imaging data is housed. DICOM: a standard for handling, storing, printing, and transmitting information in medical imaging. It includes a file format definition and a network communications protocol. This is the format that our images will be pre-processed with.

WHY? This puts the imaging folders onto our computer in the proper location so that our later codes know where to look for the files. The DICOM files should be moved to /data/projects/srndna/dicoms/SMITH-AgingDM-SUB_ID in the Linux computer.

2. Run wrapper to convert Convert data to BIDS, preprocess, and run QA using bash run_prestats.sh $sub $xnat $nruns

WHY? Wrapper command runs 3 separate scripts.

  1. Run heudiconv to convert dicoms to BIDS using bash run_heudiconv.sh $sub $xnat $nruns.

Heudiconv: A flexible DICOM converter for organizing brain imaging data into structured directory layouts.

BIDS: a format for organizing and describing outputs of neuroimaging experiments.

Heudiconv (which stands for heuristics DICOM converter) is how we are going to transfer our imaging files (which are in DICOM format) into BIDS format, which will allow us to run the rest of our analyses on the imaging files.

  1. Run PyDeface to remove the face from the anats. This is done using bash run_pydeface.sh $sub.

We need to anonymize our data. Some of the commands that we run automatically share the output files to a database for other researchers to use. Data that is posted online can't be traced back to a specific subject, which is why we need to make sure that our participants cannot be identified through their anatomical scans.

  1. Run mriqc and fmriprep using bash run_mriqc.sh $sub and bash run_fmriprep.sh $sub, respectively.

Both of these data preprocessing pipelines help us read our data visually and gives us qualitative data related to our scans. This is what is going to allow us to analyze our functional scans. This is going to be done in the Command Prompt. Before running anything, make sure that you are in the path of the run_prestats.sh command. This is found in /data/projects/srndna.

$sub - subject’s ID number

$xnat - indicates whether the data were downloaded from XNAT (1) or transferred directly on disk (0).

$nruns - indicates how many rounds of the trust game were conducted. Necessary because some subjects will not have the full set of five runs for the trust task.

Note: this is going to take a Mississippi minute (2-3 hours). Go get coffee and call your family while you wait for this to finish running.

3. Run pay_subject(subnum) in Matlab to place events files in bids folder.

WHY? This places all of our bonus money data in our bids folder, which will help us keep track of how much bonus money we gave our scanned participants. Open Matlab from the Command Prompt. To do this, run the command matlab &, which can be done from wherever you are in the directory.

matlab: opens Matlab

&: allows you to access the Command Prompt without ending the Matlab program that you are running.

Once in Matlab, you should be able to run pay_subject(subnum), which will automatically do the following: convertSharedReward_BIDS.m convertTrust_BIDS.m convertUG_BIDS.m

4. Convert *_events.tsv files to 3-column files (compatible with FSL) using Tom Nichols’ BIDSto3col.sh script.

This script is wrapped into our pipeline using bash gen_3col_files.sh $sub

WHY? This will convert a BIDS event TSV file to a 3 column FSL file, which we will need for our next step. To do this, make sure you are in the /data/projects/srndna path.

5. Run analyses in FSL.

Analyses in FSL consist of two stages, which we call “Level 1” (L1) and “Level 2” (L2). The basic analysis scripts follow the same logic as above but also include a run number for L1 analyses: bash L1_task-trust_model-01.sh $sub $run.

WHY? FSL is how we will do the majority of our analyses. It is a visual tool that we can use to see 2D and 3D images of the brains that we scanned. There should be an FSL command for each of the tasks run:

L1_task-sharedreward_model-01.sh (5 runs)

L1_task-trust_model-01.sh (2 runs)

L1_task-ultimateum_model-01.sh (2 runs)

For each of these tasks, make sure to run through each individual run (number of runs listed above). Note: this will NOT run unless you’ve done all the other steps.

6. Display the runall_L2stats.sh script and edit the two for subrun in lines to include the appropriate subject numbers and trust runs they had.