#!/bin/bash

if [ "$1" == "clean" ]
then
    echo "Cleaning the folder."
    # rm -rf BLAT_*.txt
    # rm -rf BLAT_*.png
    # rm -rf BLAT.pdb
    # rm -rf BLAT.fasta
    rm -rf BLAT*
    rm -f default.conf caracTest.dat
    rm -rf bin*.fasta
    rm -rf ../data/blat-af2.pdb.dssp ../data/blat-af2.pdb.dssp.new
elif [ "$1" == "jetoff" ]
then
    # If you have your own JET2 score file, you can turn off JET2 as follows:
    # In ../tests folder, you can find a sample JET2 file called BLAT_jet.res 
    echo "Running ESGEMME with a user-provided alignment file."
    echo "Using a previously produced prot_jet.res file to check reproducibility!"

    esgemme ../data/aliBLAT.fasta -r input -f ../data/aliBLAT.fasta --jetfile ../data/BLAT_jet.res

elif [ "$1" == "withpdb" ]
then

    #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
    echo "Using blat-af2.pdb for the structural feature calculations!"
    echo "Entire mutational map of the protein will be calculated!"
    esgemme ../data/aliBLAT.fasta -r input -f ../data/aliBLAT.fasta \
	   --pdbfile ../data/blat-af2.pdb --normweightmode max

elif [ "$1" == "withpdb-withmutfile" ]
then

    #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
    echo "Using blat-af2.pdb for the structural feature calculations!"
    echo "Only effects of mutations specified in the Stiffler_2015_BLAT_ECOLX.mut file will be calculated!"
    esgemme ../data/aliBLAT.fasta -r input -f ../data/aliBLAT.fasta  \
	   --pdbfile ../data/blat-af2.pdb --normweightmode max \
	   -m ../data/Stiffler_2015_BLAT_ECOLX.mut

elif [ "$1" == "sstjetormax" ]
then

    #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
    echo "Using blat-af2.pdb for the secondary structure based calculations!"
    echo "Only effects of mutations specified in the Stiffler_2015_BLAT_ECOLX.mut file will be calculated!"
    esgemme ../data/aliBLAT.fasta -r input -f ../data/aliBLAT.fasta \
	   --pdbfile ../data/blat-af2.pdb --normweightmode sstjetormax \
	   -m ../data/Stiffler_2015_BLAT_ECOLX.mut
    demust compare -i ../data/BLAT_ECOLX_Stiffler_2015_experimental.dat --itype singleline -j BLAT_normPred_evolCombi.txt --jtype singleline
elif [ "$1" == "tjetormax" ]
then

    #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
    echo "Using blat-af2.pdb for the secondary structure based calculations!"
    echo "Only effects of mutations specified in the Stiffler_2015_BLAT_ECOLX.mut file will be calculated!"
    esgemme ../data/aliBLAT.fasta -r input -f ../data/aliBLAT.fasta \
	   --pdbfile ../data/blat-af2.pdb --normweightmode tjetormax \
	   -m ../data/Stiffler_2015_BLAT_ECOLX.mut
    demust compare -i ../data/BLAT_ECOLX_Stiffler_2015_experimental.dat --itype singleline -j BLAT_normPred_evolCombi.txt --jtype singleline

else
    echo "Running EGEMME with a user-provided alignment file."
    echo "Since a pdb file is not provided, only evolutionary information will be used!"
    esgemme ../data/aliBLAT.fasta -r input -f ../data/aliBLAT.fasta
    
fi
