#!/bin/bash

echo "Getting statistical data about alignments and converting to gnuplot"
echo " input format ..."

# root dir
rootdir=/home/goetz/multal

# dir containting the reference data
refdir=$rootdir/alcompar/BAliBASE

# filter script for converting data to gnuplots
convexec=$rootdir/filter/data2gnuplot

# filter script for creating a label file
createlabels=$rootdir/filter/createlabels

# program for getting data
mscore=$rootdir/mscore/mscore

# now run trough all files and do the conversion:

for name in `find . -type d -name "*test*"`; do
	cd $refdir/$name
	pwd
	rm -f statdata;
	for file in *.msf; do
	    $mscore -a $file >> statdata;
	done;

	# convert statdata to 3 output files: number of sequences and 
	# lengths: shortest, longest sequences
	$convexec outputorder < statdata;
	
	# create a label file for each dir
	$createlabels < outputorder > labels.gnuplot
done;

echo "done."