-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnahln_amr_updates.sh
executable file
·185 lines (155 loc) · 5.17 KB
/
nahln_amr_updates.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
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
#!/usr/bin/env bash
currentdir=`pwd`
DATE=`date +%Y-%m-%d`
ecoli=`ls EC* | wc -l`
mannh=`ls MH* | wc -l`
staph=`ls SIG* | wc -l`
#Run ecoli samples through extra steps
if [[ $ecoli -gt 0 ]]; then
for f in EC*; do
cd $currentdir
echo $f
cd ./$f
abricate --db ecoh *.fasta >> ${f}_ecoh.txt
abricate --db ecoli_vf *.fasta >> ${f}_ecoli_vf.txt
abricate --db vfdb *.fasta >> ${f}_vfdb.txt
rm -r *Seq*
done
cd $currentdir
mkdir copy_to_stats
find . -name *-ncbi.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-resfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-amrfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-plasmidfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *_ecoh.txt -exec cp {} ./copy_to_stats/ \;
find . -name *_ecoli_vf.txt -exec cp {} ./copy_to_stats/ \;
find . -name *_vfdb.txt -exec cp {} ./copy_to_stats/ \;
find . -name abricate*.xlsx -exec cp {} ./copy_to_stats/ \;
find . -name amrfinder*.xlsx -exec cp {} ./copy_to_stats/ \;
cd ./copy_to_stats/
ncbifile=`echo $DATE"_EC_ncbi_concat.txt"`
for i in *-ncbi.tab; do
sed '1d' ${i} >> $ncbifile
done
rm *-ncbi.tab
resfinderfile=`echo $DATE"_EC_resfinder_concat.txt"`
for i in *-resfinder.tab; do
sed '1d' ${i} >> $resfinderfile
done
rm *-resfinder.tab
plasmidfinderfile=`echo $DATE"_EC_plasmidfinder_concat.txt"`
for i in *-plasmidfinder.tab; do
sed '1d' ${i} >> $plasmidfinderfile
done
rm *-plasmidfinder.tab
amrfinderfile=`echo $DATE"_EC_amrfinder_concat.txt"`
for i in *-amrfinder.tab; do
sed '1d' ${i} >> $amrfinderfile
done
rm *-amrfinder.tab
ecohfile=`echo $DATE"_EC_ecoh_concat.txt"`
for i in *_ecoh.txt; do
sed '1d' ${i} >> $ecohfile
done
rm *_ecoh.txt
ecolivffile=`echo $DATE"_EC_ecolivf_concat.txt"`
for i in *_ecoli_vf.txt; do
sed '1d' ${i} >> $ecolivffile
done
rm *_ecoli_vf.txt
vfdbfile=`echo $DATE"_EC_vfdb_concat.txt"`
for i in *_vfdb.txt; do
sed '1d' ${i} >> $vfdbfile
done
rm *_vfdb.txt
fi
#Run Mannheimia through extra steps
if [[ $mannh -gt 0 ]]; then
for f in MH*; do
cd $currentdir
echo $f
cd ./$f
abricate --db vfdb *.fasta >> ${f}_vfdb.txt
rm -r *Seq*
done
cd $currentdir
mkdir copy_to_stats
find . -name *-ncbi.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-resfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-amrfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-plasmidfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *_vfdb.txt -exec cp {} ./copy_to_stats/ \;
find . -name abricate*.xlsx -exec cp {} ./copy_to_stats/ \;
find . -name amrfinder*.xlsx -exec cp {} ./copy_to_stats/ \;
cd ./copy_to_stats/
ncbifile=`echo $DATE"_MH_ncbi_concat.txt"`
for i in *-ncbi.tab; do
sed '1d' ${i} >> $ncbifile
done
rm *-ncbi.tab
resfinderfile=`echo $DATE"_MH_resfinder_concat.txt"`
for i in *-resfinder.tab; do
sed '1d' ${i} >> $resfinderfile
done
rm *-resfinder.tab
plasmidfinderfile=`echo $DATE"_MH_plasmidfinder_concat.txt"`
for i in *-plasmidfinder.tab; do
sed '1d' ${i} >> $plasmidfinderfile
done
rm *-plasmidfinder.tab
amrfinderfile=`echo $DATE"_MH_amrfinder_concat.txt"`
for i in *-amrfinder.tab; do
sed '1d' ${i} >> $amrfinderfile
done
rm *-amrfinder.tab
vfdbfile=`echo $DATE"_MH_vfdb_concat.txt"`
for i in *_vfdb.txt; do
sed '1d' ${i} >> $vfdbfile
done
rm *_vfdb.txt
fi
#Run SIG through extra steps
if [[ $staph -gt 0 ]]; then
for f in SIG*; do
cd $currentdir
echo $f
cd ./$f
abricate --db vfdb *.fasta >> ${f}_vfdb.txt
rm -r *Seq*
done
cd $currentdir
mkdir copy_to_stats
find . -name *-ncbi.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-resfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-amrfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *-plasmidfinder.tab -exec cp {} ./copy_to_stats/ \;
find . -name *_vfdb.txt -exec cp {} ./copy_to_stats/ \;
find . -name abricate*.xlsx -exec cp {} ./copy_to_stats/ \;
find . -name amrfinder*.xlsx -exec cp {} ./copy_to_stats/ \;
cd ./copy_to_stats/
ncbifile=`echo $DATE"_SIG_ncbi_concat.txt"`
for i in *-ncbi.tab; do
sed '1d' ${i} >> $ncbifile
done
rm *-ncbi.tab
resfinderfile=`echo $DATE"_SIG_resfinder_concat.txt"`
for i in *-resfinder.tab; do
sed '1d' ${i} >> $resfinderfile
done
rm *-resfinder.tab
plasmidfinderfile=`echo $DATE"_SIG_plasmidfinder_concat.txt"`
for i in *-plasmidfinder.tab; do
sed '1d' ${i} >> $plasmidfinderfile
done
rm *-plasmidfinder.tab
amrfinderfile=`echo $DATE"_SIG_amrfinder_concat.txt"`
for i in *-amrfinder.tab; do
sed '1d' ${i} >> $amrfinderfile
done
rm *-amrfinder.tab
vfdbfile=`echo $DATE"_SIG_vfdb_concat.txt"`
for i in *_vfdb.txt; do
sed '1d' ${i} >> $vfdbfile
done
rm *_vfdb.txt
fi