forked from albertwcheng/RNASeqMappingScripts3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
isSanger.awk
executable file
·54 lines (41 loc) · 1.21 KB
/
isSanger.awk
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
# ord.awk --- do ord and chr
# Global identifiers:
# _ord_: numerical values indexed by characters
# _ord_init: function to initialize _ord_
BEGIN { _ord_init(); }
function _ord_init( low, high, i, t)
{
low = sprintf("%c", 7) # BEL is ascii 7
if (low == "\a") { # regular ascii
low = 0
high = 127
} else if (sprintf("%c", 128 + 7) == "\a") {
# ascii, mark parity
low = 128
high = 255
} else { # ebcdic(!)
low = 0
high = 255
}
for (i = low; i <= high; i++) {
t = sprintf("%c", i)
_ord_[t] = i
}
}
function ord(str, where)
{
# only first character is of interest
c = substr(str, where, 1)
return _ord_[c]
}
(FNR%4==0){
for(i=1;i<length($0);i++)
{
ordValue=ord($0,i)
if(ordValue<59 || ordValue>104 )
{
printf "Sanger:[%d=%s],%s\n",ordValue,substr($0,i,1),$0;
break;
}
}
}