-
Notifications
You must be signed in to change notification settings - Fork 15
/
minimus2_OCA.sh
executable file
·50 lines (48 loc) · 1.34 KB
/
minimus2_OCA.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
#!/bin/sh
if [ $# -lt 1 ]
then echo "Error: no arguments have been specified"
echo "usage <path1/sample1.fasta.gz> [path2/sample2.fasta] [-nomerge]"
exit
fi
ffn1=$1
d1=$(dirname $(readlink -e ${ffn1}))
f1=$(basename ${ffn1})
y1=$(basename ${f1} .gz)
y1=$(basename ${y1} .gzip)
y1=$(basename ${y1} .fasta)
y1=$(basename ${y1} .fa)
mergeName=${y1}_mm2
refCount=$(zgrep -c '^>' ${d1}/${f1})
d2=""
f2=""
if [ $# -gt 1 ]
then ffn2=$2
d2=$(dirname $(readlink -e ${ffn2}))
f2=$(basename ${ffn2})
y2=$(basename ${f2} .gz)
y2=$(basename ${y2} .gzip)
y2=$(basename ${y2} .fasta)
y2=$(basename ${y2} .fa)
mergeName=${y1}_${y2}_mm2
if [ $3 != "-nomerge" ]
then echo "-- merging ${y2} into ${y1} --"
else echo "-- carrying out all-vs-all overlap on ${y1} + ${y2} --"
fi
else echo "-- carrying out all-vs-all overlap on ${y1} --"
fi
mkdir -p ${d1}/${mergeName}
cd ${d1}/${mergeName}
zcat -f ${d1}/${f1} > ${mergeName}.seq
if [ $# -gt 1 ]
then zcat -f ${d2}/${f2} >> ${mergeName}.seq
fi
echo "currently in $(pwd)"
~/bin/amos/toAmos -s ${mergeName}.seq -o ${mergeName}.afg
if [ $# -gt 2 ]
then if [ $3 = "-nomerge" ]
then ~/bin/amos/minimus2 ${mergeName}
else ~/bin/amos/minimus2 ${mergeName} -D REFCOUNT=${refCount}
fi
else ~/bin/amos/minimus2 ${mergeName} -D REFCOUNT=${refCount}
fi
echo "-- DONE --"