#!/usr/local/bin/tcsh      
#
#automatic analysis of bisulphite generated methylation data
#
#please parse filename with sequences in FASTA-format as parameter
#the script calls the programms of the MethTool-package and
#generates the recommended directory- and file structure
#
#call conversion program, writes the statistic into a .log file 
#and the profile into a .tab file
#
echo "Converting files. Please wait."
convert_bisulfite.pl -f $1 >$1.log   
echo "Conversion done..."
#
#call analysis programs
#
EvalLog.pl  -d . -n MethTools_test
echo "PCR or Sequencing errors and total base number filed."
InfoScan.pl -d . -n MethTools_test
#
#clean up a bit
#
mkdir Seq1
mv -f *.seq1 Seq1
mkdir Seq2
mv -f *.seq2 Seq2
mkdir Stat
mv -f *.tab Stat
mv -f *.log Stat
mv -f *.inf Stat
mv -f *.err Stat
echo "Seq1,Seq2 and Stat folders generated and relatet files moved..."
#
#call graphic programs
#
Plot_CpGs_to_Gif.pl          -d Seq1 -n MethTools_test
Plot_5mCpG_density_to_Gif.pl -d Seq1 -n MethTools_test
#
#clean up the rest
#
mv -f Seq1/*.gif Stat
exit

