# $1 is the number of folds

#rm outputToC.pl
#rm data.exg

results_dir='./artificialData/tomato/experiments/leave_one_out_Results'  #where to store results
rm -r ${results_dir}
mkdir ${results_dir}
for time_point1 in cnr_early cnr_mid cnr_late nor_early nor_mid nor_late rin_early rin_mid rin_late
do
mkdir ${results_dir}/${time_point1}
done

data_dir='./artificialData/tomato/experiments/example_folds'
#cur_dir=`pwd`


echo "$1-fold cross validation"

for time_point in cnr_early cnr_mid cnr_late nor_early nor_mid nor_late rin_early rin_mid rin_late
do
for (( i=1; i<=$1; i++ ))
do
#echo "debug1"
yap -L -- run.pl -- ${data_dir}/${time_point}/train$i.pl
#echo "debug2"
./pl2exg
./search
rm outputToC.pl
rm data.exg
yap -L -- test.pl -- ${data_dir}/${time_point}/test$i.pl > ${results_dir}/${time_point}/result$i.pl
cat ${results_dir}/${time_point}/result$i.pl >> ${results_dir}/${time_point}/allPredictionResult.pl
# echo " " > ${results_dir}/${time_point}/allPredictionResult.pl
done
done


