Psychophysiological interaction (PPI): Instruction and scripts (FSL)

PPI.

Jill O’Reilly had previously posted a detailed overview that was great, it looks like most of this material is now covered here.

Running the analysis.

a. Model the psychological main effect. If you are combining two conditions (to look at brain areas where connectivity is greater in one condition than another) you can easily combine people’s individual onsets using script A below.

b. Generate subject-specific ROI. Generate your region of interest, then convert to each participant’s native space and binarize the roi (Script B below). 5 mins.

c. extract roi timeseries for each person (script C below).

You now have the PPI regressor and the extracted seed timeseries. You se these to…

a. Run session first levels.

b. Run subject fixed effects models.

c. Run second levels.

####################################################################################

A. Script to combine existing onsets:

####################################################################################

SUBJECTS=”flu002 flu003 flu008 flu009 flu010 flu011 flu012 flu013 flu014 flu016 flu017 grm017″

RUNS=”run1 run2″

FILE=”ppi_reg_1.txt”

FILE2=”ppi_reg_2.txt”

FILE3=”ppi_reg_3.txt”

FILE4=”ppi_reg_4.txt”

FILE5=”ppi_reg_5.txt”

FILE6=”ppi_reg_6.txt”

FILE7=”ppi_reg_7.txt”

FILE8=”ppi_reg_8.txt”

FILEc=”ppi_reg_1c.txt”

FILE2c=”ppi_reg_2c.txt”

FILE3c=”ppi_reg_3c.txt”

FILE4c=”ppi_reg_4c.txt”

FILE5c=”ppi_reg_5c.txt”

FILE6c=”ppi_reg_6c.txt”

FILE7c=”ppi_reg_7c.txt”

FILE8c=”ppi_reg_8c.txt”

for SUBJECT in $SUBJECTS ; do

for RUN in $RUNS ; do

cd /chb/users/cbenjamin/gaabdata/data/fluency2/regressors/${SUBJECT}/${RUN}

awk ‘NF{printf(“%f %f %f\n”, $1, $2, $3)}’ *_2_*.txt > ${FILE}

awk ‘NF{printf(“%f %f %f\n”, $1, $2, $3)}’ *_3_*.txt >> ${FILE}

awk ‘NF{printf(“%f %f %f\n”, $1, $2, $3)}’ *_4_*.txt >> ${FILE}

awk ‘NF{printf(“%f %f -%f\n”, $1, $2, $3)}’ *_5_*txt >> ${FILE}

awk ‘NF{printf(“%f %f -%f\n”, $1, $2, $3)}’ *_6_*txt >> ${FILE}

awk ‘NF{printf(“%f %f -%f\n”, $1, $2, $3)}’ *_7_*txt >> ${FILE}

sed -i ‘s/-0.000000//g’ ${FILE}

sed -i ‘s/0.000000//g’ ${FILE}

done

done

####################################################################################

B. BATCH SCRIPT TO CONVERT A SERIES OF MNI-DEFINED ROI INTO SUBJECTS’ NATIVE SPACE.

####################################################################################

. /etc/fsl/fsl.sh
#List of subjects.

SUBJECTS=”flu002 X flu008 flu009 flu010 flu011 flu012 flu013 flu014 flu016 flu017 grm017″

#List of ROIs.

ROI=”cope4a_5mm.hdr cope4c_5mm.hdr cope4d_5mm.hdr cope4e_5mm.hdr cope4f_5mm.hdr cope4g_5mm.hdr”

for ROI in $ROIS ; do

for SUBJECT in $SUBJECTS ; do

THISROI=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/a_roi/2_functional_ROI_GLM/${ROI}.hdr”

#Select the prefiltered data

#THISPREFILT1=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e1/op.feat/filtered_func_data.nii.gz”

THISPREFILT2=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e2/op.feat/filtered_func_data.nii.gz”

THISPREFILT3=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e3/op.feat/filtered_func_data.nii.gz”

#Select the person’s transformation matrix to back-transform the standard space ROI to native space

#THISMATRIX1=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e1/op.feat/reg/standard2example_func.mat”

THISMATRIX2=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e2/op.feat/reg/standard2example_func.mat”

THISMATRIX3=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e3/op.feat/reg/standard2example_func.mat”

#Determine the output location

#OUT1=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e1/op.feat/${ROI}”

OUT2=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e2/op.feat/${ROI}”

OUT3=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e3/op.feat/${ROI}”

#THIS CONVERTS THE ROI INTO THE CORRECT SPACE

#flirt -in ${THISROI} -ref ${THISPREFILT1} -out $OUT1 -init ${THISMATRIX1} -applyxfm

flirt -in ${THISROI} -ref ${THISPREFILT2} -out $OUT2 -init ${THISMATRIX2} -applyxfm

flirt -in ${THISROI} -ref ${THISPREFILT3} -out $OUT3 -init ${THISMATRIX3} -applyxfm

#THIS BINARIZES THE ROI

#a threshold of 0.5 will (approximately) preserve the size of the original mask any voxel in the new

#space that overlaps by 50% or more with the original mask will be included in the new binary mask

#fslmaths $OUT1 -thr 0.5 -bin $OUT1

fslmaths $OUT2 -thr 0.5 -bin $OUT2

fslmaths $OUT3 -thr 0.5 -bin $OUT3

done

done

####################################################################################

C. BATCH SCRIPT TO EXTRACT TIMESERIES DATA FOR A SERIES OF SUBJECTS IN A SERIES OF ROI

####################################################################################

#SUBJECTS=”flu002 X flu008 flu009 flu010 flu011 flu012 flu013 flu014 flu016 flu017 grm017″
SUBJECTS=”flu004″
#ROI=”cope4a_5mm.hdr cope4b_5mm.hdr cope4c_5mm.hdr cope4d_5mm.hdr cope4e_5mm.hdr cope4f_5mm.hdr cope4g_5mm.hdr”
ROIS=”cope4b_5mm”
for ROI in $ROIS ; do
for SUBJECT in $SUBJECTS ; do
#roi defined in native volume space.
# THISROI1=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e1/op.feat/${ROI}.nii.gz”
#filtered functional data, from which mean timeseries will be extracted
# THISPREFILT1=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e1/op.feat/filtered_func_data.nii.gz”
#the output mean time series file name & location
# OUT1=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e1/op.feat/meants_${ROI}”
# fslmeants -i $THISPREFILT1 -o $OUT1 -m $THISROI1
THISROI2=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e2/op.feat/${ROI}.nii.gz”
THISPREFILT2=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e2/op.feat/filtered_func_data.nii.gz”
OUT2=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e2/op.feat/meants_${ROI}”
fslmeants -i $THISPREFILT2 -o $OUT2 -m $THISROI2
THISROI3=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e3/op.feat/${ROI}.nii.gz”
THISPREFILT3=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e3/op.feat/filtered_func_data.nii.gz”
OUT3=”/net/osx1927/chb/users/cbenjamin/gaabdata/data/fluency2/${SUBJECT}/e3/op.feat/meants_${ROI}”
fslmeants -i $THISPREFILT3 -o $OUT3 -m $THISROI3
done
done
####################################################################################

Leave a comment