-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-OLC.bash
executable file
·88 lines (72 loc) · 1.88 KB
/
run-OLC.bash
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
#!/bin/bash
###############################################################################
# run-OLC.bash
# Shell for launching CD-HIT-EST and CAP3 OLC
# February 4, 2014
# NCGR: www.ncgr.org
###############################################################################
if [ $# -lt 1 ];then
cat << _TEXT
usage:$0 <-f "fasta file(s)"> [-c "cap3 args"] [-d "cd-hit-est args"]
For multiple fasta files, or when using *, please use
"" around file list. If not using the perl wrapper, please
provide all arguments in quotations.
_TEXT
exit 1
fi
fcheck=0
dcheck=0
i=0
while getopts ":f:c:d:" fl; do
case $fl in
f)
files=$OPTARG
for c in $files;do
if [ ! -f $c ];then
echo "could not locate file \"$c\", please provide a complete path"
exit 1
else
if [ $i -eq 0 ];then
input=$c
let i+=1
else
input="$input $c"
fi
fi
done
fcheck=1
;;
c)
c3args=$OPTARG
;;
d)
ceargs=$OPTARG
dcheck=1
;;
\?)
echo "$fl is not a valid option"
exit 1
;;
:)
echo "$fl requires an argument"
exit 1
;;
esac
done
if [ $fcheck -eq 0 ];then
echo "-f required, see usage"
exit 1
fi
mkdir -p overlap
cd overlap
if [ -f pool_uncondensed.fna ];then rm pool_uncondensed.fna pool_final.fna;fi
cat $input | awk '{if(/^>/){a++;gsub(">","");print ">"a" "$0}else{print}}' > pool_uncondensed.fna
if [ $dcheck -eq 0 ];then
mv -f pool_uncondensed.fna pool_final.fna
else
echo "$ceargs"
cd-hit-est -i pool_uncondensed.fna -o pool_final.fna -M 0 $ceargs
fi
echo $c3args
cap3 pool_final.fna $c3args
cat pool_final.fna.cap.contigs pool_final.fna.cap.singlets > cap3_final.fna