2-Group 3MVM code

Hi all. I am looking to convert a script for a 3-group 3MVM repeat-measures analysis with one covariate (which has been running successfully) to a 2-group repeat measures 3MVM analysis. I have amended all the GLT labels accordingly, and changed the number GLT (from 12 in 3-group to 5 in 2-group, in keeping with examples on AFNI 3MVM page). However, I am getting the error message

“The content under -dataTable is not rectangular ! 1074 5”

I woudl appreciate any guidance you could give on this. Kind regards.

Do you mind sharing your 3dMVM script plus a few lines of the data table?

Hi Ghang

sorry for delay- just checked back in today.

Script is below

thanks for your help

John

GNU nano 2.3.1 File: MVM_Creator_2GROUP_1COVAR.sh

#!/bin/bash

usage(){
echo “Usage: $0 $1 testname $2 Group1ScansList $3 Group2ScanList $4 Contrast $5 CovName $6 CovNum $7 Optional arguments”
exit 1
}

[[ $# -eq 0 ]] && usage

Testname=$1

Group1List=$2
Group1Name=$(echo $2|cut -d ‘_’ -f 1 )

Group2List=$3
Group2Name=$(echo $3|cut -d ‘_’ -f 1 )

GroupList=“$Group1List $Group2List”

Contrast=$4

CovName=$5

CovNum=Cov"$6"

maindir=/data/project/OXYASP/OXYASP_ANALYSIS/01_subbricks/01_DM

echo “3dMVM -prefix $1 -jobs 40 -bsVars "Group+$CovName" -wsVars Time -qVars $CovName \” > “$Testname”.csh

echo “-num_glt 5 \” >> “$Testname”.csh

echo “-gltLabel 1 “$Group1Name”_PreLtPost -gltCode 1 ‘Group : 1*$Group1Name Time : -1Pre 1Post’ \” >> “$Testname”.csh

echo “-gltLabel 2 “$Group2Name”_PreLtPost -gltCode 2 ‘Group : 1*$Group2Name Time : -1Pre 1Post’ \” >> “$Testname”.csh

echo “-gltLabel 3 “$Group1Name"Gr”$Group2Name”_Pre -gltCode 3 ‘Group : 1*$Group1Name -1*$Group2Name Time : 1*Pre’ \" >> “$Testname”.csh

echo “-gltLabel 4 “$Group1Name"Gr”$Group2Name”_Post -gltCode 4 ‘Group : 1*$Group1Name -1*$Group2Name Time : 1*Post’ \" >> “$Testname”.csh

echo “-gltLabel 5 “$Group1Name"PreLtPost”$Group2Name”_PreGtPost -gltCode 5 ‘Group : 1*$Group1Name -1*$Group2Name Time : -1Pre 1Post’ \" $

echo “-dataTable \” >> “$Testname”.csh

echo “Subj Group Time $CovName InputFile \” >> “$Testname”.csh

for Group in $GroupList; do
GroupName=$(echo $Group|cut -d ‘_’ -f 1 )
while IFS=$‘\t’ read Subj Cov1; do
#TestCov=$CovNum
echo “$Subj $GroupName Pre ${!CovNum} “$maindir”/”$Subj"_P/“$Contrast”+tlrc.HEAD \"
echo “$Subj $GroupName Post ${!CovNum} “$maindir”/”$Subj"_O/“$Contrast”+tlrc.HEAD \"
done < $Group >> “$Testname”.csh
done

ps that is my modified script for 2 Group.

This is the original 3-group script

GNU nano 2.3.1 File: MVM_Creator_Covar_IQ.sh

#!/bin/bash

usage(){
echo "Usage: $0 $1 testname $2 Group1ScansList $3 Group2ScanList $4 Group3ScanList $5 Contrast $6 CovName $7 CovNum what number is it$
exit 1
}

[[ $# -eq 0 ]] && usage

Testname=$1

Group1List=$2
Group1Name=$(echo $2|cut -d ‘_’ -f 1 )

Group2List=$3
Group2Name=$(echo $3|cut -d ‘_’ -f 1 )

Group3List=$4
Group3Name=$(echo $4|cut -d ‘_’ -f 1 )

GroupList=“$Group1List $Group2List $Group3List”

Contrast=$5

CovName=$6

CovNum=Cov"$7"

maindir=/data/project/OXYASP/OXYASP_ANALYSIS/01_subbricks/01_DM/

echo “3dMVM -prefix $1 -jobs 40 -bsVars "Group+$CovName" -wsVars Time -qVars $CovName \” > “$Testname”.csh

echo “-num_glt 12 \” >> “$Testname”.csh

echo “-gltLabel 1 “$Group1Name”_PreLtPost -gltCode 1 ‘Group : 1*$Group1Name Time : -1Pre 1Post’ \” >> “$Testname”.csh

echo “-gltLabel 2 “$Group2Name”_PreLtPost -gltCode 2 ‘Group : 1*$Group2Name Time : -1Pre 1Post’ \” >> “$Testname”.csh

echo “-gltLabel 3 “$Group3Name”_PreLtPost -gltCode 3 ‘Group : 1*$Group3Name Time : -1Pre 1Post’ \” >> “$Testname”.csh

echo “-gltLabel 4 “$Group1Name"Gr”$Group2Name”_Pre -gltCode 4 ‘Group : 1*$Group1Name -1*$Group2Name Time : 1*Pre’ \" >> “$Testname”.csh

echo “-gltLabel 5 “$Group1Name"Gr”$Group3Name”_Pre -gltCode 5 ‘Group : 1*$Group1Name -1*$Group3Name Time : 1*Pre’ \" >> “$Testname”.csh

echo “-gltLabel 6 “$Group2Name"Gr”$Group3Name”_Pre -gltCode 6 ‘Group : 1*$Group2Name -1*$Group3Name Time : 1*Pre’ \" >> “$Testname”.csh

echo “-gltLabel 7 “$Group1Name"Gr”$Group2Name”_Post -gltCode 7 ‘Group : 1*$Group1Name -1*$Group2Name Time : 1*Post’ \" >> “$Testname”.csh

echo “-gltLabel 8 “$Group1Name"Gr”$Group3Name”_Post -gltCode 8 ‘Group : 1*$Group1Name -1*$Group3Name Time : 1*Post’ \" >> “$Testname”.csh

echo “-gltLabel 9 “$Group2Name"Gr”$Group3Name”_Post -gltCode 9 ‘Group : 1*$Group2Name -1*$Group3Name Time : 1*Post’ \" >> “$Testname”.csh

echo “-gltLabel 10 “$Group1Name"PreLtPost”$Group2Name”_PreGtPost -gltCode 10 ‘Group : 1*$Group1Name -1*$Group2Name Time : -1Pre 1Post’ \$

echo “-gltLabel 11 “$Group1Name"PreLtPost”$Group3Name”_PreGtPost -gltCode 11 ‘Group : 1*$Group1Name -1*$Group3Name Time : -1Pre 1Post’ \$

echo “-gltLabel 12 “$Group2Name"PreLtPost”$Group3Name”_PreGtPost -gltCode 12 ‘Group : 1*$Group2Name -1*$Group3Name Time : -1Pre 1Post’ \$

echo “-dataTable \” >> “$Testname”.csh

echo “Subj Group Time $CovName InputFile \” >> “$Testname”.csh

for Group in $GroupList; do
GroupName=$(echo $Group|cut -d ‘_’ -f 1 )
while IFS=$‘\t’ read Subj Cov1; do
#TestCov=$CovNum
echo “$Subj $GroupName Pre ${!CovNum} “$maindir”/”$Subj"_P/“$Contrast”+tlrc.HEAD \"
echo “$Subj $GroupName Post ${!CovNum} “$maindir”/”$Subj"_O/“$Contrast”+tlrc.HEAD \"
done < $Group >> “$Testname”.csh
done

for otherargs in “${@:10}” ; do
echo “$otherargs \”
done >> “$Testname”.csh
echo " " >> “$Testname”.csh
chmod +x “$Testname”.csh
tcsh “$Testname”.csh

Possible to show the final 3dMVM script plus the data table you generated from the shell script?