if [ $# -ne 9 ]; then
	echo Usage $0 [sample-file] [age-file] [age-rand-file] [corr-dir-name] [cent-type] [corr-type] [corr-short-dir] [corr-long-dir] [intermediate-dir]
	exit
fi

allSampleFile=$1
ageFile=$2
ageRandFile=$3
corrDirName=$4
centralityType=$5
correlationType=$6
corrShortDir=$7
corrLongDir=$8
intermediateDir=$9

if [ $correlationType -eq 1 ]; then
	correlationTypeInit="p"
elif [ $correlationType -eq 2 ]; then
	correlationTypeInit="s"
else
	echo Wrong correlation type
	exit
fi

./bin/corr-age-cent-pre $allSampleFile $corrDirName $correlationType $corrShortDir $corrLongDir $centralityType
./bin/corr-age-cent-post $ageFile $corrShortDir/${correlationTypeInit}corr-short-$centralityType $corrLongDir/${correlationTypeInit}corr-long-$centralityType $ageRandFile $correlationType $intermediateDir/corr-$centralityType.tmp
paste $corrShortDir/${correlationTypeInit}corr-short-$centralityType $intermediateDir/corr-$centralityType.tmp > $intermediateDir/full-$centralityType.tmp
mv $intermediateDir/full-$centralityType.tmp $corrShortDir/${correlationTypeInit}corr-short-$centralityType
rm $intermediateDir/corr-$centralityType.tmp
