#!/usr/bin/env bash

set -euxo pipefail

RESOLUTIONS=(50000) # 1000 2000 5000 10000 25000 50000 100000 250000 500000 1000000 2500000 5000000 10000000)
SAMPLES=$(cat samples.txt)
OUTPUT_DIR='results/expected'
ANNOTATION_DIR='results/annotation'

which cooltools || echo cooltools not installed
mkdir -p $OUTPUT_DIR

for binsize in ${RESOLUTIONS[@]}; do
	for path in $SAMPLES; do
		cooler_basename=$(basename "$path")
		cooltools expected-cis -p 32 "$path::resolutions/$binsize" > "$OUTPUT_DIR/${cooler_basename%%.*}.$binsize.expected.cis.tsv"
		cooltools expected-cis --view "$ANNOTATION_DIR/hg38.chromarms.bed" -p 32 "$path::resolutions/$binsize" > "$OUTPUT_DIR/${cooler_basename%%.*}.$binsize.expected.cisarm.tsv"
		cooltools expected-trans -p 32 "$path::resolutions/$binsize" > "$OUTPUT_DIR/${cooler_basename%%.*}.$binsize.expected.trans.tsv"
	done
done
