Debian Codegraph @

debian/sh-replacement-scripts/exact-tandems

raw
1 #!/bin/sh -e
2 #
3 # Find exact tandem repeats in specified file involving an
4 # exact duplicate of at least the specified length
5
6 usage () {
7 echo "Usage: `basename $0` <file> <min-match-len>"
8 return 67 # EX_USAGE
9 }
10
11 if [ $# -ne 2 ] ; then
12 echo "You provided $# arguments instead of 2."
13 usage
14 fi
15
16 filename="$1"
17 matchlen="$2"
18
19 bindir=/usr/bin
20 scriptdir=/usr/lib/mummer
21
22 if [ ! -e "$filename" ] ; then
23 echo "File $filename does not exist."
24 usage
25 fi
26
27 echo "Finding matches"
28 $bindir/repeat-match -t -n $matchlen "$filename" | tail +3 > $$.tmp.matches
29 # This is default behavior when shell started with -e
30 # if ($status != 0) exit -1
31
32 echo "Tandem repeats"
33 sort -k1n -k2n $$.tmp.matches | awk -f $
34 $scriptdir/tandem-repeat.awk
35 rm -f $$.tmp.matches