set -e

#for res in {1000,5000,10000,25000} 
#for res in {5000,10000,25000}
for res in {1000,5000}
do
#	for i in {"AalbS2","AatrE3","AmerR4","AsteI2","AcolNg"}; 
#        for i in {"AmerR4","AcolNg"};
	for i in {"AmerR4",}
	do	
        	hic=$HOME/hic_out/Anopheles/ActualData/hic/${i}_V4/${i}A_V4.1000.hic;
		echo ${res} ${hic};
        	name=$(basename $hic); 
		if test -f "${name}_${res}.h5"; then
			echo "${name}_${res}.h5 exist, skipping..."
			continue
		fi

        	hicConvertFormat -m $hic -o ${name}.cool --inputFormat hic --outputFormat cool --resolutions $res; \
        	hicConvertFormat -m ${name}_${res}.cool -o ${name}_${res}.corr.cool --inputFormat cool --outputFormat cool --correction_name KR; \
        	hicConvertFormat -m ${name}_${res}.corr.cool -o ${name}_${res}.h5 --inputFormat cool --outputFormat h5;
	done
done
