#!/bin/sh
#evaluate similarity between output patterns
# exp4: inputfile len mis outfile

min_len=0
err_ratio=0.1
input=$1
ratio=98
  awk '{print $1 "\n"}' < $1 > __tmp__
#  echo sachica qpiGcZlEdD -S 'N' -v 0.98 -E $err_ratio __tmp__ $2 $3 __tmp2__
  ../sachica/sachica qpiGcZlEdD -S 'N' -v 0.98 -E $err_ratio __tmp__ $2 $3 __tmp2__
  sed 's/,/ /g' < __tmp2__ > __tmp3__
  awk '{print $1 " " $2}' < __tmp3__ | sort -n | uniq > __tmp4__
  ../grhfil Ue2 __tmp4__ __tmp7__
  n=`wc __tmp7__ | awk '{print $2}'`
  l=`wc __tmp7__ | awk '{print $1}'`
  ../grhfil d -o 3 -p __tmp6__ __tmp7__ __tmp5__
  ll=`wc __tmp5__ | awk '{print $1}'`
# echo expr $n / $l
  a=`expr $n "*" 100`
  aa=`expr $a / $l`
  b=`expr $ll "*" 100`
  echo $l ", ave " `expr $aa / $l` ", deg>2 " `expr $b / $l`

