-
Notifications
You must be signed in to change notification settings - Fork 3
/
centroid_groupAnalyze.bash
executable file
·118 lines (83 loc) · 3.18 KB
/
centroid_groupAnalyze.bash
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
source common.bash
declare -i Gb_customStorescu=0
declare -i Gi_verbose=0
G_ANALYSISDIR=../groupCurvAnalysis/aparc.annot
# Defaults
G_LOBE=pos # pos or neg
G_HEMI=rh # rh or lh
G_CURV=H # BE C H K1 K2 K S
G_GROUP=1 # 1 or 2
G_SYNOPSIS="
NAME
$G_SELF
SYNOPSIS
$G_SELF \\
[-v <verbosity>] \\
[-a <expDir>] \\
[-l <lobe>] \\
[-h <hemi>] \\
[-c <curvatureFunc>] \\
[-g <group>]
DESCRIPTION
'centroid_groupAnalyze.bash' examines the centroid text files for
given curvature function and prints the distance between
group centroids.
PRECONDITIONS
o common.bash script source.
ARGUMENTS
-v <level> (Optional)
Verbosity level. A value of '10' is a good choice here.
-e <analysisTopDir>
Top level directory containing group data.
-l <lobe> (optional, default = $G_LOBE)
The positive or negative lobe of the centroid analysis to examine.
-h <hemi> (optional, default = $G_HEMI)
The hemisphere to process.
-c <curvatureFunc> (optional, default = $G_CURV)
The curvature function to process.
-g <group> (optional, default = $G_GROUP)
The group id to analyze.
"
# Actions
A_dirAccess="attempting to access a directory"
# Error messages
EM_dirAccess="I couldn't access the directory. Does it exist? Do you have access rights?"
# Error codes
EC_dirAccess="50"
while getopts a:l:h:c:g:v: option ; do
case "$option"
in
a) G_ANALYSISDIR=$OPTARG ;;
l) G_LOBE=$OPTARG ;;
h) G_HEMI=$OPTARG ;;
c) G_CURV=$OPTARG ;;
g) G_GROUP=$OPTARG ;;
v) Gi_verbose=$OPTARG ;;
\?) synopsis_show
exit 0;;
esac
done
topDir=$pwd
verbosity_check
statusPrint "Checking base dir"
dirExist_check $G_ANALYSISDIR || fatal dirAccess
cd $G_ANALYSISDIR >/dev/null
G_ANALYSISDIR=$(pwd)
STATS=$(find . -iname "${G_LOBE}-centroids-analyze-${G_HEMI}.${G_CURV}.*txt" \
-exec cat {} \; |\
grep " $G_GROUP" |\
awk '{printf("%17.5f %17.5f\n", $6, $7)}' |\
stats_print.awk)
MEANstd=$(echo "$STATS" | grep Mean | awk '{print $2}')
MEANrms=$(echo "$STATS" | grep Mean | awk '{print $3}')
STDstd=$(echo "$STATS" | grep Std | awk '{print $2}')
STDrms=$(echo "$STATS" | grep Std | awk '{print $3}')
printf "%17s%17s%17s%17s%17s\n" "Curv-Group" "mean(std_length)" "std(std_length)" "mean(rms)" "std(rms)"
printf "%17s" "$G_CURV-$G_GROUP"
printf "%17.5f" $MEANstd
printf "%17.5f" $STDstd
printf "%17.5f" $MEANrms
printf "%17.5f" $STDrms
printf "\n"
cd $topDir