#!/bin/env bash

set -euxo pipefail

BINSIZE=50000
FASTA_PATH='/net/common/genomes/ncbi/GRCh38.analysisSet/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna'
OUTPUT_DIR='results/annotation'

which cooltools || echo cooltools not installed
mkdir -p $OUTPUT_DIR
cooltools genome fetch-chromsizes hg38 | tail -n+2 > $OUTPUT_DIR/hg38.chrom.sizes  # bug in fetch-chromsizes printing: includes header
cooltools genome binnify $OUTPUT_DIR/hg38.chrom.sizes $BINSIZE > /tmp/hg38.bins.tsv
cooltools genome gc /tmp/hg38.bins.tsv $FASTA_PATH > $OUTPUT_DIR/hg38.bins.gc.$BINSIZE.tsv
