This repository has been archived by the owner on Jun 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
L2_Emo_PPI.sh
executable file
·43 lines (35 loc) · 1.66 KB
/
L2_Emo_PPI.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
BASEDIR=`pwd`
MAINDATADIR=`pwd`/data
MAINOUTPUTDIR=`pwd`/fsl
subj=$1
INPUT1=${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_LR/L1_Emotion_PPI.feat
INPUT2=${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_RL/L1_Emotion_PPI.feat
OUTPUT=${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/L2_Emotion_PPI
# checking L2 output
NCOPES=7 #check last cope since they are done sequentially
if [ -e ${OUTPUT}.gfeat/cope${NCOPES}.feat/cluster_mask_zstat1.nii.gz ]; then
exit
else
rm -rf ${OUTPUT}.gfeat
fi
for run in LR RL; do
rm -rf ${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_${run}/L1_Emotion_PPI.feat/reg
mkdir -p ${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_${run}/L1_Emotion_PPI.feat/reg
ln -s $FSLDIR/etc/flirtsch/ident.mat ${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_${run}/L1_Emotion_PPI.feat/reg/example_func2standard.mat
ln -s $FSLDIR/etc/flirtsch/ident.mat ${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_${run}/L1_Emotion_PPI.feat/reg/standard2example_func.mat
ln -s $FSLDIR/data/standard/MNI152_T1_2mm.nii.gz ${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/tfMRI_EMOTION_${run}/L1_Emotion_PPI.feat/reg/standard.nii.gz
done
#find and replace
ITEMPLATE=${BASEDIR}/templates/L2_all_PPI.fsf
OTEMPLATE=${MAINOUTPUTDIR}/${subj}/MNINonLinear/Results/L2_Emotion_PPI.fsf
sed -e 's@OUTPUT@'$OUTPUT'@g' \
-e 's@INPUT1@'$INPUT1'@g' \
-e 's@INPUT2@'$INPUT2'@g' \
<$ITEMPLATE> $OTEMPLATE
#runs feat on output template
feat $OTEMPLATE
for C in `seq $NCOPES`; do
rm -rf ${OUTPUT}.gfeat/cope${C}.feat/filtered_func_data.nii.gz
rm -rf ${OUTPUT}.gfeat/cope${C}.feat/var_filtered_func_data.nii.gz
done