Scripts

From SpanLabWiki
Jump to: navigation, search

txt2master.py

Python script for generating master vectors from E-Prime .txt data outputs.

Run "python ./txt2master.py" for help. last modified ???

File:Txt2master.zip

Download Txt2master.zip‎

tcourse2excel.py

Python script for converting Reorder outputs and master vectors into timecourse spreadsheets.

Run "python ./tcourse2excel.py" for help. last modified ???

File:Tcourse2excel.zip

Download Tcourse2excel.zip‎

Fizzio

Windows program for analyzing psychophysiology data (resampling, removing outliers, clustering, etc).

Unzip fizzio.zip into a directory and run fizzio.exe. See built-in Help menu or readme. last modified Sat May 15 22:18:33 2004

File:Fizzio.zip

Download Fizzio.zip‎

tableDump.py

Usage: This script is for creating tables in csv format from 3dclust output.

          Example1: tableDump.py 3dclustOut.txt
          Example2: tableDump.py 3dclustOut.txt mySpecialOutputName

Input: 3dclust output from afni

Optional Input: a base filename for your output. The default is to use your cluster file name.

Output: a file called table_[yourfilename].csv which contains a csv file of the region name, x, y, z coordinates and max zScore for each cluster in the 3dclust file. You will also get a file called wai_[yourfilename].csv which contains the output from the afni whereami command.

Download tableDump.zip‎

The IRESP method for generating time courses.

1. To dump timecourses using iresp, you'll first need to make sure you have the "starter" files your scripts will need:

(a) m2v lookup tables
These are not the same as our traditional m2v lookup files, which mark EVENTS of interest WITHIN trials. These mark the beginning of trial types, instead, which iresp uses to know where to start dumping those trial types for the VOI dumps. Place these m2v files in a directory called "iresp" in your expt home directory. You'll also place your iresp script here. For more on the iresp script, see below.
(b) runs.1D files
(c) sag116 file
(d) normed, filtered data, as output by your process script (eg, norm12f+orig.BRIK)


2) Run the irespbipomid script to

(a) Create individualized vector .1D files using the m2v lookup tables.
(b) Use 3ddeconvolve to remove the contribution of motion to your data, and to create, for each subject, an average response to each specified trial type. "Impulse response" refers to the fact you flagged the _beginning_ of each trial type. It then dumps the response from that point in time forward as you specify (in this case, 10 + 1 TRs). 3dDeconvolve takes as input the .1D files created earlier in the script, as well as your runs.1D file (which specifies block length) and your normed, filtered data.
(c) 3dDeconvolve will output BRIK files for each trial type of interest for each individual subject.
(d) Use 3dTCat to concatenate all the BRIK files into a single BRIK with all the trial types concatenated one after the other in the order specified. -prefix will specify the name of this new, uber-BRIK.
 This script can be run on individuals alone as you add them.
 The irespbipomid script usually lives in the iresp directory with the iresp m2v files.
 The irespbipomid script is doing FULL BRAIN dumps -- there's no ROI timecourse data yet. 
 These are volumes with information about the average response in each and every individual voxel in the brain for that individual.


3) Then run the masterTCdump script. This script actually pulls the timecourse data from the voxels in the ROIs and averages it using 3dMaskAve. The script takes the following files as input: your sag116 file, your mask files, and your irespbipomid BRIK file, as created by the irespbipomid script, above. The masterTCdump script drops the time course files into a time course folder in your home directory.

4) Now you'll need to operate in Matlab.

(a) Move one of the MatlabDemo.m files into the timecourse folder. You can find it in the old bipomid timecourse folder.
(b) Open matlab (type matlab at the prompt while in the folder), double-click on the matlabdemo file on the LH side.
(c) Open the matlabDemo.m file if it doesn't automatically open in an extra window.
(d) The matlabDemo file uses tcpaste to concatenate your subjects into groups, eg controls versus patient population, sorted by region, and concatenated in the order you specified in masterTCdump. You shouldn't run the entire file, however, as it contains different script snippets. All you need do is highlight three lines:
subjects = [' ...
regions = [' ...
tcPaste(subjects, regions)

Once highlighted, right click and hit "Evaluate Selection."

5) This will generate your csv files. You should now be able to open your concatenated data by double clicking on, say, "nacc_allTRctrs.csv" and importing it into your workspace. Then graph to your heart's desire.