-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckphase_extract
More file actions
executable file
·209 lines (194 loc) · 9.69 KB
/
checkphase_extract
File metadata and controls
executable file
·209 lines (194 loc) · 9.69 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
#
# Copyright (C) 2018-2023 by Lars Wienbrandt,
# Institute of Clinical Molecular Biology, Kiel University
#
# This file is part of Checkphase.
#
# Checkphase is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Checkphase is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Checkphase. If not, see <https://www.gnu.org/licenses/>.
#
# extracts information from checkphase reports to tab-separated output (tsv))
if [[ $# == 0 ]]; then
echo "Usage: checkphase_extract <list of checkphase ouput files>"
echo "Reads checkphase information from provided files and generates a .tsv with the most important information."
exit 1
fi
# create a '\t' separated list from the command line arguments
sep='\\t'
FILES=$(printf "%s$sep" "$@")
FILES="${FILES%$sep}" # remove trailing separator
gawk 'BEGIN {
files="\t'$FILES'"
Nquery="Query samples"
Mcheck="Checked variants"
Mcheck_maf01="Checked MAF>=0.1"
Mcheck_maf001="Checked MAF>=0.01"
Mcheck_maf0001="Checked MAF>=0.001"
Mcheck_maf00001="Checked MAF>=0.0001"
Mtyped="Checked typed variants"
Totgterr="Total genotype errors"
Totgterr_maf01="Total genotype errors (MAF>=0.1)"
Totgterr_maf001="Total genotype errors (MAF>=0.01)"
Totgterr_maf0001="Total genotype errors (MAF>=0.001)"
Totgterr_maf00001="Total genotype errors (MAF>=0.0001)"
Avgterr="Average gt error rate"
Avgterr_maf01="Average gt error rate (MAF>=0.1)"
Avgterr_maf001="Average gt error rate (MAF>=0.01)"
Avgterr_maf0001="Average gt error rate (MAF>=0.001)"
Avgterr_maf00001="Average gt error rate (MAF>=0.0001)"
Corr2_compl="correlation r2 (complete)"
Corr2_compl_maf01="correlation r2 (complete, MAF>=0.1)"
Corr2_compl_maf001="correlation r2 (complete, MAF>=0.01)"
Corr2_compl_maf0001="correlation r2 (complete, MAF>=0.001)"
Corr2_compl_maf00001="correlation r2 (complete, MAF>=0.0001)"
Corr2_varav="correlation r2 (var av.)"
Corr2_varav_maf01="correlation r2 (var av., MAF>=0.1)"
Corr2_varav_maf001="correlation r2 (var av., MAF>=0.01)"
Corr2_varav_maf0001="correlation r2 (var av., MAF>=0.001)"
Corr2_varav_maf00001="correlation r2 (var av., MAF>=0.0001)"
Totgterr_soft="Total genotype errors (soft)"
Totgterr_soft_maf01="Total genotype errors (MAF>=0.1) (soft)"
Totgterr_soft_maf001="Total genotype errors (MAF>=0.01) (soft)"
Totgterr_soft_maf0001="Total genotype errors (MAF>=0.001) (soft)"
Totgterr_soft_maf00001="Total genotype errors (MAF>=0.0001) (soft)"
Avgterr_soft="Average gt error rate (soft)"
Avgterr_soft_maf01="Average gt error rate (MAF>=0.1) (soft)"
Avgterr_soft_maf001="Average gt error rate (MAF>=0.01) (soft)"
Avgterr_soft_maf0001="Average gt error rate (MAF>=0.001) (soft)"
Avgterr_soft_maf00001="Average gt error rate (MAF>=0.0001) (soft)"
Corr2_compl_soft="correlation r2 (complete) (soft)"
Corr2_compl_soft_maf01="correlation r2 (complete, MAF>=0.1) (soft)"
Corr2_compl_soft_maf001="correlation r2 (complete, MAF>=0.01) (soft)"
Corr2_compl_soft_maf0001="correlation r2 (complete, MAF>=0.001) (soft)"
Corr2_compl_soft_maf00001="correlation r2 (complete, MAF>=0.0001) (soft)"
Corr2_varav_soft="correlation r2 (var av.) (soft)"
Corr2_varav_soft_maf01="correlation r2 (var av., MAF>=0.1) (soft)"
Corr2_varav_soft_maf001="correlation r2 (var av., MAF>=0.01) (soft)"
Corr2_varav_soft_maf0001="correlation r2 (var av., MAF>=0.001) (soft)"
Corr2_varav_soft_maf00001="correlation r2 (var av., MAF>=0.0001) (soft)"
Totswerr="Total switch errors"
Avswerr="Average sw error rate"
Totswerr_typed="Total switch errors (typed)"
Avswerr_typed="Average sw error rate (typed)"
}
# number of query samples and checked variants
/Query samples:/{Nquery=(Nquery "\t" $5); next}
/Checked variants:/{Mcheck=(Mcheck "\t" $3); next}
/Checked MAF>=0.1:/{Mcheck_maf01=(Mcheck_maf01 "\t" $3); next}
/Checked MAF>=0.01:/{Mcheck_maf001=(Mcheck_maf001 "\t" $3); next}
/Checked MAF>=0.001:/{Mcheck_maf0001=(Mcheck_maf0001 "\t" $3); next}
/Checked MAF>=0.0001:/{Mcheck_maf00001=(Mcheck_maf00001 "\t" $3); next}
/Checked typed variants:/{Mtyped=(Mtyped "\t" $4); next}
# errors
/Total genotype errors:/{Totgterr=(Totgterr "\t" $4); next}
/Total genotype errors \(MAF>=0.1\):/{Totgterr_maf01=(Totgterr_maf01 "\t" $5); next}
/Total genotype errors \(MAF>=0.01\):/{Totgterr_maf001=(Totgterr_maf001 "\t" $5); next}
/Total genotype errors \(MAF>=0.001\):/{Totgterr_maf0001=(Totgterr_maf0001 "\t" $5); next}
/Total genotype errors \(MAF>=0.0001\):/{Totgterr_maf00001=(Totgterr_maf00001 "\t" $5); next}
/Total genotype errors \(soft\):/{Totgterr_soft=(Totgterr_soft "\t" $5); next}
/Total genotype errors \(MAF>=0.1\) \(soft\):/{Totgterr_soft_maf01=(Totgterr_soft_maf01 "\t" $6); next}
/Total genotype errors \(MAF>=0.01\) \(soft\):/{Totgterr_soft_maf001=(Totgterr_soft_maf001 "\t" $6); next}
/Total genotype errors \(MAF>=0.001\) \(soft\):/{Totgterr_soft_maf0001=(Totgterr_soft_maf0001 "\t" $6); next}
/Total genotype errors \(MAF>=0.0001\) \(soft\):/{Totgterr_soft_maf00001=(Totgterr_soft_maf00001 "\t" $6); next}
/Total switch errors:/{Totswerr=(Totswerr "\t" $4); next}
/Total switch errors \(typed\):/{Totswerr_typed=(Totswerr_typed "\t" $5); next}
# error rates
/Average gt error rate:/{Avgterr=(Avgterr "\t" $5); next}
/Average gt error rate \(MAF>=0.1\):/{Avgterr_maf01=(Avgterr_maf01 "\t" $6); next}
/Average gt error rate \(MAF>=0.01\):/{Avgterr_maf001=(Avgterr_maf001 "\t" $6); next}
/Average gt error rate \(MAF>=0.001\):/{Avgterr_maf0001=(Avgterr_maf0001 "\t" $6); next}
/Average gt error rate \(MAF>=0.0001\):/{Avgterr_maf00001=(Avgterr_maf00001 "\t" $6); next}
/Average gt error rate \(soft\):/{Avgterr_soft=(Avgterr_soft "\t" $6); next}
/Average gt error rate \(MAF>=0.1\) \(soft\):/{Avgterr_soft_maf01=(Avgterr_soft_maf01 "\t" $7); next}
/Average gt error rate \(MAF>=0.01\) \(soft\):/{Avgterr_soft_maf001=(Avgterr_soft_maf001 "\t" $7); next}
/Average gt error rate \(MAF>=0.001\) \(soft\):/{Avgterr_soft_maf0001=(Avgterr_soft_maf0001 "\t" $7); next}
/Average gt error rate \(MAF>=0.0001\) \(soft\):/{Avgterr_soft_maf00001=(Avgterr_soft_maf00001 "\t" $7); next}
/Average sw error rate:/{Avswerr=(Avswerr "\t" $5); next}
/Average sw error rate \(typed\):/{Avswerr_typed=(Avswerr_typed "\t" $6); next}
# r2
/correlation r2 \(complete\):/{Corr2_compl=(Corr2_compl "\t" $4); next}
/correlation r2 \(complete, MAF>=0.1\):/{Corr2_compl_maf01=(Corr2_compl_maf01 "\t" $5); next}
/correlation r2 \(complete, MAF>=0.01\):/{Corr2_compl_maf001=(Corr2_compl_maf001 "\t" $5); next}
/correlation r2 \(complete, MAF>=0.001\):/{Corr2_compl_maf0001=(Corr2_compl_maf0001 "\t" $5); next}
/correlation r2 \(complete, MAF>=0.0001\):/{Corr2_compl_maf00001=(Corr2_compl_maf00001 "\t" $5); next}
/correlation r2 \(var av.\):/{Corr2_varav=(Corr2_varav "\t" $5); next}
/correlation r2 \(var av., MAF>=0.1\):/{Corr2_varav_maf01=(Corr2_varav_maf01 "\t" $6); next}
/correlation r2 \(var av., MAF>=0.01\):/{Corr2_varav_maf001=(Corr2_varav_maf001 "\t" $6); next}
/correlation r2 \(var av., MAF>=0.001\):/{Corr2_varav_maf0001=(Corr2_varav_maf0001 "\t" $6); next}
/correlation r2 \(var av., MAF>=0.0001\):/{Corr2_varav_maf00001=(Corr2_varav_maf00001 "\t" $6); next}
/correlation r2 \(complete\) \(soft\):/{Corr2_compl_soft=(Corr2_compl_soft "\t" $5); next}
/correlation r2 \(complete, MAF>=0.1\) \(soft\):/{Corr2_compl_soft_maf01=(Corr2_compl_soft_maf01 "\t" $6); next}
/correlation r2 \(complete, MAF>=0.01\) \(soft\):/{Corr2_compl_soft_maf001=(Corr2_compl_soft_maf001 "\t" $6); next}
/correlation r2 \(complete, MAF>=0.001\) \(soft\):/{Corr2_compl_soft_maf0001=(Corr2_compl_soft_maf0001 "\t" $6); next}
/correlation r2 \(complete, MAF>=0.0001\) \(soft\):/{Corr2_compl_soft_maf00001=(Corr2_compl_soft_maf00001 "\t" $6); next}
/correlation r2 \(var av.\) \(soft\):/{Corr2_varav_soft=(Corr2_varav_soft "\t" $6); next}
/correlation r2 \(var av., MAF>=0.1\) \(soft\):/{Corr2_varav_soft_maf01=(Corr2_varav_soft_maf01 "\t" $7); next}
/correlation r2 \(var av., MAF>=0.01\) \(soft\):/{Corr2_varav_soft_maf001=(Corr2_varav_soft_maf001 "\t" $7); next}
/correlation r2 \(var av., MAF>=0.001\) \(soft\):/{Corr2_varav_soft_maf0001=(Corr2_varav_soft_maf0001 "\t" $7); next}
/correlation r2 \(var av., MAF>=0.0001\) \(soft\):/{Corr2_varav_soft_maf00001=(Corr2_varav_soft_maf00001 "\t" $7); next}
# print TSV output
END {
print files
print Nquery
print Mcheck
print Mcheck_maf01
print Mcheck_maf001
print Mcheck_maf0001
print Mcheck_maf00001
print Mtyped
print Totgterr
print Totgterr_maf01
print Totgterr_maf001
print Totgterr_maf0001
print Totgterr_maf00001
print Avgterr
print Avgterr_maf01
print Avgterr_maf001
print Avgterr_maf0001
print Avgterr_maf00001
print Corr2_compl
print Corr2_compl_maf01
print Corr2_compl_maf001
print Corr2_compl_maf0001
print Corr2_compl_maf00001
print Corr2_varav
print Corr2_varav_maf01
print Corr2_varav_maf001
print Corr2_varav_maf0001
print Corr2_varav_maf00001
print Totgterr_soft
print Totgterr_soft_maf01
print Totgterr_soft_maf001
print Totgterr_soft_maf0001
print Totgterr_soft_maf00001
print Avgterr_soft
print Avgterr_soft_maf01
print Avgterr_soft_maf001
print Avgterr_soft_maf0001
print Avgterr_soft_maf00001
print Corr2_compl_soft
print Corr2_compl_soft_maf01
print Corr2_compl_soft_maf001
print Corr2_compl_soft_maf0001
print Corr2_compl_soft_maf00001
print Corr2_varav_soft
print Corr2_varav_soft_maf01
print Corr2_varav_soft_maf001
print Corr2_varav_soft_maf0001
print Corr2_varav_soft_maf00001
print Totswerr
print Avswerr
print Totswerr_typed
print Avswerr_typed
}' $@