#!/usr/bin/env bash # Migrate existing chr1 results from the old flat layout to the new per-chrom layout. # Idempotent — safe to run twice; will only move files that exist at the old path. # # Old layout: New layout: # results/h1_representation/ results/h1_representation/chr1/ # model.pt model.pt # gm12878_emb.npy gm12878_emb.npy # imr90_emb.npy imr90_emb.npy # metrics.json metrics.json # evaluation.json evaluation.json # figures/ figures/ # compartments/ (unchanged - stays at top level, filenames per-chrom) # # Usage: bash scripts/migrate_chr1_layout.sh set -euo pipefail REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO" move_if_exists() { local src="$1" dst="$2" if [ -e "$src" ]; then mkdir -p "$(dirname "$dst")" echo " $src -> $dst" mv "$src" "$dst" fi } echo "=== Migrating H1 chr1 results ===" mkdir -p results/h1_representation/chr1 for f in model.pt gm12878_emb.npy imr90_emb.npy metrics.json evaluation.json; do move_if_exists "results/h1_representation/$f" "results/h1_representation/chr1/$f" done move_if_exists "results/h1_representation/figures" "results/h1_representation/chr1/figures" echo "" echo "=== Migrating H2 chr1 results ===" mkdir -p results/h2_rewiring/chr1 for f in model.pt control_emb.npy treated_emb.npy \ drift_full.npy drift_short.npy drift_long.npy \ anchor_mask.npy anchor_mode.npy null_distribution.npy \ drift_stats.json metrics.json; do move_if_exists "results/h2_rewiring/$f" "results/h2_rewiring/chr1/$f" done move_if_exists "results/h2_rewiring/figures" "results/h2_rewiring/chr1/figures" echo "" echo "=== Migrating H3 chr1 results ===" mkdir -p results/h3_longrange/chr1 for d in local_only longrange_only full_const local_const longrange_const; do move_if_exists "results/h3_longrange/$d" "results/h3_longrange/chr1/$d" done for f in ablation_comparison.json cross_ablation.json; do move_if_exists "results/h3_longrange/$f" "results/h3_longrange/chr1/$f" done move_if_exists "results/h3_longrange/figures" "results/h3_longrange/chr1/figures" echo "" echo "=== Migration complete ===" echo "Compartments stay at results/h1_representation/compartments/ (per-chrom in filename)"