#!/bin/sh -e # # Find exact tandem repeats in specified file involving an # exact duplicate of at least the specified length usage () { echo "Usage: `basename $0` " return 67 # EX_USAGE } if [ $# -ne 2 ] ; then echo "You provided $# arguments instead of 2." usage fi filename="$1" matchlen="$2" bindir=/usr/bin scriptdir=/usr/lib/mummer if [ ! -e "$filename" ] ; then echo "File $filename does not exist." usage fi echo "Finding matches" $bindir/repeat-match -t -n $matchlen "$filename" | tail +3 > $$.tmp.matches # This is default behavior when shell started with -e # if ($status != 0) exit -1 echo "Tandem repeats" sort -k1n -k2n $$.tmp.matches | awk -f $ $scriptdir/tandem-repeat.awk rm -f $$.tmp.matches