-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_gbk_cleaner.sh
59 lines (16 loc) · 1.18 KB
/
edit_gbk_cleaner.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
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
grep "ORF" pseudo17978X4_NODE_1_length_432508_cov_27.928043.fasta.gbk_pseudos.gff | sed -n -e 's/^.*old_locus_tag=//p' > orf_file.txt
for tag in $(cat orf_file.txt); do
awk -v i="$tag" ' {if(/locus_tag="i"/) sub(/gene=.*/,"gene=pseudogene",prev); print prev} {prev=$0} END{print prev}' 17978X4_NODE_1_length_432508_cov_27.928043.fasta.gbk > 17978X4_NODE_1_length_432508_cov_27.928043_pseudos.gbk;
done
for i in $orf; do
awk -v i=$i 'NR>1{if(/locus_tag="/$i) sub(/gene=.*/,"gene=pseudogene",prev); print prev} {prev=$0} END{print prev}' ${gbkfile} > ${gbkfile}_pseudos.gbk
done
sed -i 's/pseudogene/"pseudogene"/g' ${gbkfile}_pseudos.gbk
frag=`grep "fragmentation" ${pseudofile} | sed -n -e 's/^.*old_locus_tag=//p' | awk -F "," '{print $1}'`
for i in $frag; do
awk 'NR>1{if/locus_tag=$i/) sub(/gene=.*/,"gene=pseudogene",prev); print prev} {prev=$0} END{print prev}' ${gbkfile} > ${gbkfile}_pseudos.gbk
done
sed -i 's/pseudogene/"pseudogene"/g' ${gbkfile}_pseudos.gbk
#something I'm trying to get the for loop working with awk statement
awk '{for (a = 1; a<=NF; a++) {if(/locus_tag=/$a) sub(/gene=.*/,"gene=pseudogene",prev); print prev} {prev=$0} }'