-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_orf_prokka.sh
executable file
·51 lines (40 loc) · 1.24 KB
/
generate_orf_prokka.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
44
45
46
47
48
49
#/bin/sh
# extract orf locations from prokka
# $1: prokka gff output
# chr
cat $1 \
| sed '/^##FASTA$/,$d' \
| sed '/^#/ d' \
| awk '{print $1}' > data/circos/prokka/${1##*/}_chr.tmp
# start
cat $1 \
| sed '/^##FASTA$/,$d' \
| sed '/^#/ d' \
| awk '{print $4}' > data/circos/prokka/${1##*/}_start.tmp
# end
cat $1 \
| sed '/^##FASTA$/,$d' \
| sed '/^#/ d' \
| awk '{print $5}' > data/circos/prokka/${1##*/}_end.tmp
# strand
cat $1 \
| sed '/^##FASTA$/,$d' \
| sed '/^#/ d' \
| awk '{print $7}' > data/circos/prokka/${1##*/}_strand.tmp
# annoation
cat $1 \
| sed '/^##FASTA$/,$d' \
| sed '/^#/ d' \
| awk '{print $11}' \
| awk -F';' '{print $3}' \
| awk -F'=' '{print $2}' > data/circos/prokka/${1##*/}_annotation.tmp
# replace empty lines
sed -i.bak "s/^\s*$/O/g" data/circos/prokka/${1##*/}_annotation.tmp
sed -i.bak "s/^hypothetical/o/g" data/circos/prokka/${1##*/}_annotation.tmp
# merge per file
paste data/circos/prokka/${1##*/}_chr.tmp \
data/circos/prokka/${1##*/}_start.tmp \
data/circos/prokka/${1##*/}_end.tmp \
data/circos/prokka/${1##*/}_annotation.tmp \
| sed -e "s/[[:space:]]\+/ /g" > data/circos/prokka/${1##*/}_orf.txt
cat data/circos/prokka/${1##*/}_orf.txt >> data/circos/prokka/prokka_orf.txt