if [ $# -ne 1 ]; then
  echo "The number of parameter is: $#" 1>&2
  echo "Need to type 1 parameter: celltype or antigen" 1>&2
  exit 1
fi

type=$1

if [ $1 = "celltype" ]; then
  file_size=4362
else
  file_size=6953
fi
echo "${file_size}"

i=1
while [ "$i" -le 5 ]; do
  j=9
  while [ "$j" -ge 5 ]; do
    perc_size=$(expr ${file_size} \* ${j} / 10)
    head -n ${perc_size} shuf${i}_c10_unclassified_training_${type}_intl2_feature.txt > shuf${i}_0${j}_c10_unclassified_training_${type}_intl2_feature.txt
    cut -f1 shuf${i}_0${j}_c10_unclassified_training_${type}_intl2_feature.txt > shuf${i}_0${j}_c10_unclassified_training_${type}_intl2.txt
    cut -f2- shuf${i}_0${j}_c10_unclassified_training_${type}_intl2_feature.txt > shuf${i}_0${j}_c10_unclassified_training_${type}_feature.txt
    j=`expr $j - 1`
  done
  i=`expr $i + 1`
done
