#Template to generate suffixSearch.sh
#Arg 1: path to vmatch distribution
echo "#!/bin/sh"
echo minStart=\$2
echo "# If maxStart is equal to 0, do not take it into account"
echo maxStart=\$6
echo muteOnly=\$5
echo motifFileName=\$4
echo if [ \$1 -eq 0 ]
echo then
echo "$1vmatch -q \$motifFileName  -complete -absolute -nodist -noevalue -noscore -noidentity  \$3  | gawk  'BEGIN {min='\$minStart';max='\$maxStart'} \$2 ~ /[[:digit:]]+/ { if(\$2>=min && (\$2<=max || max==0)) { print \$2; print \$1; print \"0\"; } }'"
echo else
echo if [ \$muteOnly -eq 1 ]
echo then
echo "$1vmatch -q \$motifFileName -h \$1 -complete -absolute  -noevalue -noscore -noidentity  \$3  | gawk  'BEGIN {min='\$minStart';max='\$maxStart'} \$2 ~ /[[:digit:]]+/ { if(\$2>=min && (\$2<=max || max==0)) { print \$2; print \$1; if(\$6==0) { print \"0\";} else {print (\$6*-1);}  } }'"
echo else
echo "$1vmatch -q \$motifFileName -e \$1 -complete -absolute  -noevalue -noscore -noidentity  \$3  | awk  'BEGIN {min='\$minStart';max='\$maxStart'} \$2 ~ /[[:digit:]]+/ { if(\$2>=min && (\$2<=max || max==0)) { print \$2; print \$1; print \$6; } }' "
echo fi
echo fi
