#!/bin/bash

echo "Converting preprocessed alignment parameter files to .eps files"

# root dir
rootdir=/home/goetz/multal/alcompar

# variables pointing to the scripts for gnuplot
global1=$rootdir/gnuplots/scripts/alparam/glo
global2=$rootdir/gnuplots/scripts/alparam/glo2

# dir containing the data
datadir=$rootdir/BAliBASE

# dir containing the output files
outdir=$rootdir/gnuplots

# function doing the real work:
# first parameter: dir name
# second parameter: output file name

run_gnuplot() {
    cd $datadir/$1
    echo "set output \"$outdir/$2.eps\"" | gnuplot $global1 - $global2
    cd -
}

# run conversion for each dir:
run_gnuplot ref1/test1 alp11
run_gnuplot ref1/test2 alp12
run_gnuplot ref1/test3 alp13
run_gnuplot ref2/test alp2
run_gnuplot ref3/test alp3
run_gnuplot ref4/test alp4
run_gnuplot ref5/test alp5
run_gnuplot ref6/test alp6
run_gnuplot ref6/test_1a alp61a
run_gnuplot ref6/test_1b alp61b
run_gnuplot ref6/test_2a alp62a
run_gnuplot ref6/test_2b alp62b
run_gnuplot ref6/test_2c alp62c
run_gnuplot ref6/test_3 alp63
run_gnuplot ref6/test_4 alp64
run_gnuplot ref7/test alp7
run_gnuplot ref8/test alp8

echo "Done."
