#!/usr/bin/env bash

set -euxo pipefail

BINSIZE=50000
COOLERS=(
/net/projects/hic-atlas/atlas/day00_ESC_pool.hg38.mapq_30.100.mcool
/net/projects/hic-atlas/atlas/day02_mesoderm_pool.hg38.mapq_30.100.mcool
/net/projects/hic-atlas/atlas/day05_cardiacMesoderm_pool.hg38.mapq_30.100.mcool
/net/projects/hic-atlas/atlas/day07_cardiacProgenitor_pool.hg38.mapq_30.100.mcool
/net/projects/hic-atlas/atlas/day15_primativeCardiomyocyte_pool.hg38.mapq_30.100.mcool
/net/projects/hic-atlas/atlas/day80_ventricularCardiomyocyte_pool.hg38.mapq_30.100.mcool
)
OUTPUT_DIR='results/eig'
ANNOTATION_DIR='results/annotation'

which cooltools || echo cooltools not installed
mkdir -p $OUTPUT_DIR
for f in "${COOLERS[@]}"; do
    cooler_basename=$(basename "$f")
    cooltools eigs-trans \
        --n-eigs 6 \
        --phasing-track "$ANNOTATION_DIR/hg38.bins.gc.$BINSIZE.tsv" \
        -o "$OUTPUT_DIR/${cooler_basename%%.*}.$BINSIZE.eigs.trs" \
        "$f::resolutions/$BINSIZE"
done