#!/usr/bin/env bash
# Bulk download script for GSE77629
# Generated from Yeo Lab Publications Database
# Total files: 83

OUTDIR="GSE77629"
mkdir -p "$OUTDIR"
cd "$OUTDIR"

# --- GEO supplementary files ---
wget -nc "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE77nnn/GSE77629/suppl/GSE77629_RAW.tar" -O "GSE77629_RAW.tar"

# --- SRA run files ---
# Tip: use 'fasterq-dump' from SRA Toolkit for FASTQ conversion
#      with optional renaming to original submitted FASTQ names.
# Set to 1 to rename SRR outputs (e.g. SRR_1.fastq.gz -> sample_R1.fastq.gz)
RENAME_SRA_TO_ORIGINAL=1

_compress_if_exists() {
  local stem="$1"
  if [ -f "${stem}.fastq" ]; then
    gzip -f "${stem}.fastq"
    echo "${stem}.fastq.gz"
    return 0
  fi
  if [ -f "${stem}.fq" ]; then
    gzip -f "${stem}.fq"
    echo "${stem}.fq.gz"
    return 0
  fi
  return 1
}

# Option A: Download via SRA Toolkit (recommended)
fasterq-dump --split-files "SRR3147598"
gz1="$(_compress_if_exists 'SRR3147598_1' || true)"
gz2="$(_compress_if_exists 'SRR3147598_2' || true)"
gzs="$(_compress_if_exists 'SRR3147598' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_CLIP_RBFOX2_1120_GAATTCGT-TAATCTTA_R1.A04_293XT_CLIP_RBFOX2_1120_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_CLIP_RBFOX2_1120_GAATTCGT-TAATCTTA_R2.A04_293XT_CLIP_RBFOX2_1120_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147599"
gz1="$(_compress_if_exists 'SRR3147599_1' || true)"
gz2="$(_compress_if_exists 'SRR3147599_2' || true)"
gzs="$(_compress_if_exists 'SRR3147599' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_CLIP_RBFOX2_1120_GAATTCGT-TAATCTTA_R1.F05_293XT_CLIP_RBFOX2_1120_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_CLIP_RBFOX2_1120_GAATTCGT-TAATCTTA_R2.F05_293XT_CLIP_RBFOX2_1120_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147600"
gz1="$(_compress_if_exists 'SRR3147600_1' || true)"
gz2="$(_compress_if_exists 'SRR3147600_2' || true)"
gzs="$(_compress_if_exists 'SRR3147600' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_Input_1120_GAATTCGT-GGCTCTGA_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_Input_1120_GAATTCGT-GGCTCTGA_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147601"
gz1="$(_compress_if_exists 'SRR3147601_1' || true)"
gz2="$(_compress_if_exists 'SRR3147601_2' || true)"
gzs="$(_compress_if_exists 'SRR3147601' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_CLIP_RBFOX2_0204_GAGATTCC-TAATCTTA_R1.A03_293XT_CLIP_RBFOX2_0204_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_CLIP_RBFOX2_0204_GAGATTCC-TAATCTTA_R2.A03_293XT_CLIP_RBFOX2_0204_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147602"
gz1="$(_compress_if_exists 'SRR3147602_1' || true)"
gz2="$(_compress_if_exists 'SRR3147602_2' || true)"
gzs="$(_compress_if_exists 'SRR3147602' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_CLIP_RBFOX2_0204_GAGATTCC-TAATCTTA_R1.G07_293XT_CLIP_RBFOX2_0204_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_CLIP_RBFOX2_0204_GAGATTCC-TAATCTTA_R2.G07_293XT_CLIP_RBFOX2_0204_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147603"
gz1="$(_compress_if_exists 'SRR3147603_1' || true)"
gz2="$(_compress_if_exists 'SRR3147603_2' || true)"
gzs="$(_compress_if_exists 'SRR3147603' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_Input_0204_ATTCAGAA-TAATCTTA_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_Input_0204_ATTCAGAA-TAATCTTA_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147604"
gz1="$(_compress_if_exists 'SRR3147604_1' || true)"
gz2="$(_compress_if_exists 'SRR3147604_2' || true)"
gzs="$(_compress_if_exists 'SRR3147604' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_CLIP_IgG_1120_ATTCAGAA-GGCTCTGA_R1.A04_293XT_CLIP_IgG_1120_Input.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_CLIP_IgG_1120_ATTCAGAA-GGCTCTGA_R2.A04_293XT_CLIP_IgG_1120_Input.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147605"
gz1="$(_compress_if_exists 'SRR3147605_1' || true)"
gz2="$(_compress_if_exists 'SRR3147605_2' || true)"
gzs="$(_compress_if_exists 'SRR3147605' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_CLIP_IgG_1120_ATTCAGAA-GGCTCTGA_R1.F05_293XT_CLIP_IgG_1120_Input.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_CLIP_IgG_1120_ATTCAGAA-GGCTCTGA_R2.F05_293XT_CLIP_IgG_1120_Input.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147606"
gz1="$(_compress_if_exists 'SRR3147606_1' || true)"
gz2="$(_compress_if_exists 'SRR3147606_2' || true)"
gzs="$(_compress_if_exists 'SRR3147606' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "293XT_Input_IgG1120_GAGATTCC-GGCTCTGA_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "293XT_Input_IgG1120_GAGATTCC-GGCTCTGA_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147607"
gz1="$(_compress_if_exists 'SRR3147607_1' || true)"
gz2="$(_compress_if_exists 'SRR3147607_2' || true)"
gzs="$(_compress_if_exists 'SRR3147607' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.A04_EVN_041315_CLIP12_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.A04_EVN_041315_CLIP12_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147608"
gz1="$(_compress_if_exists 'SRR3147608_1' || true)"
gz2="$(_compress_if_exists 'SRR3147608_2' || true)"
gzs="$(_compress_if_exists 'SRR3147608' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.F05_EVN_041315_CLIP12_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.F05_EVN_041315_CLIP12_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147609"
gz1="$(_compress_if_exists 'SRR3147609_1' || true)"
gz2="$(_compress_if_exists 'SRR3147609_2' || true)"
gzs="$(_compress_if_exists 'SRR3147609' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_INPUT_12_ATTACTCG-ATAGAGGC_L007_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_INPUT_12_ATTACTCG-ATAGAGGC_L007_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147610"
gz1="$(_compress_if_exists 'SRR3147610_1' || true)"
gz2="$(_compress_if_exists 'SRR3147610_2' || true)"
gzs="$(_compress_if_exists 'SRR3147610' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.A03_EVN_041315_CLIP13_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.A03_EVN_041315_CLIP13_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147611"
gz1="$(_compress_if_exists 'SRR3147611_1' || true)"
gz2="$(_compress_if_exists 'SRR3147611_2' || true)"
gzs="$(_compress_if_exists 'SRR3147611' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.G07_EVN_041315_CLIP13_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.G07_EVN_041315_CLIP13_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147612"
gz1="$(_compress_if_exists 'SRR3147612_1' || true)"
gz2="$(_compress_if_exists 'SRR3147612_2' || true)"
gzs="$(_compress_if_exists 'SRR3147612' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_INPUT_13_TCCGGAGA-ATAGAGGC_L007_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_INPUT_13_TCCGGAGA-ATAGAGGC_L007_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147613"
gz1="$(_compress_if_exists 'SRR3147613_1' || true)"
gz2="$(_compress_if_exists 'SRR3147613_2' || true)"
gzs="$(_compress_if_exists 'SRR3147613' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.A01_EVN_041315_CLIP14_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.A01_EVN_041315_CLIP14_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147614"
gz1="$(_compress_if_exists 'SRR3147614_1' || true)"
gz2="$(_compress_if_exists 'SRR3147614_2' || true)"
gzs="$(_compress_if_exists 'SRR3147614' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.B06_EVN_041315_CLIP14_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.B06_EVN_041315_CLIP14_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147615"
gz1="$(_compress_if_exists 'SRR3147615_1' || true)"
gz2="$(_compress_if_exists 'SRR3147615_2' || true)"
gzs="$(_compress_if_exists 'SRR3147615' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_INPUT_14_CGCTCATT-TATAGCCT_L007_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_INPUT_14_CGCTCATT-TATAGCCT_L007_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147616"
gz1="$(_compress_if_exists 'SRR3147616_1' || true)"
gz2="$(_compress_if_exists 'SRR3147616_2' || true)"
gzs="$(_compress_if_exists 'SRR3147616' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.C01_EVN_041315_CLIP15_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.C01_EVN_041315_CLIP15_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147617"
gz1="$(_compress_if_exists 'SRR3147617_1' || true)"
gz2="$(_compress_if_exists 'SRR3147617_2' || true)"
gzs="$(_compress_if_exists 'SRR3147617' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R1.D08fixed_EVN_041315_CLIP15_SLBP.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_SLBP_pool4_ATTACTCG-CCTATCCT_L007_R2.D08fixed_EVN_041315_CLIP15_SLBP.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147618"
gz1="$(_compress_if_exists 'SRR3147618_1' || true)"
gz2="$(_compress_if_exists 'SRR3147618_2' || true)"
gzs="$(_compress_if_exists 'SRR3147618' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_INPUT_15_GAGATTCC-TATAGCCT_L007_R1.unassigned.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_INPUT_15_GAGATTCC-TATAGCCT_L007_R2.unassigned.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147619"
gz1="$(_compress_if_exists 'SRR3147619_1' || true)"
gz2="$(_compress_if_exists 'SRR3147619_2' || true)"
gzs="$(_compress_if_exists 'SRR3147619' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool3_TCCGGAGA-GGCTCTGA_L007_R1.A01_EVN_041315_CLIP10_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool3_TCCGGAGA-GGCTCTGA_L007_R2.A01_EVN_041315_CLIP10_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147620"
gz1="$(_compress_if_exists 'SRR3147620_1' || true)"
gz2="$(_compress_if_exists 'SRR3147620_2' || true)"
gzs="$(_compress_if_exists 'SRR3147620' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool3_TCCGGAGA-GGCTCTGA_L007_R1.B06_EVN_041315_CLIP10_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool3_TCCGGAGA-GGCTCTGA_L007_R2.B06_EVN_041315_CLIP10_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147621"
gz1="$(_compress_if_exists 'SRR3147621_1' || true)"
gz2="$(_compress_if_exists 'SRR3147621_2' || true)"
gzs="$(_compress_if_exists 'SRR3147621' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R1.A01_EVN_041315_CLIP8_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R2.A01_EVN_041315_CLIP8_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147622"
gz1="$(_compress_if_exists 'SRR3147622_1' || true)"
gz2="$(_compress_if_exists 'SRR3147622_2' || true)"
gzs="$(_compress_if_exists 'SRR3147622' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R1.B06_EVN_041315_CLIP8_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R2.B06_EVN_041315_CLIP8_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147623"
gz1="$(_compress_if_exists 'SRR3147623_1' || true)"
gz2="$(_compress_if_exists 'SRR3147623_2' || true)"
gzs="$(_compress_if_exists 'SRR3147623' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool1_TCCGGAGA-CCTATCCT_L007_R1.A04_EVN_041315_CLIP1_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool1_TCCGGAGA-CCTATCCT_L007_R2.A04_EVN_041315_CLIP1_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147624"
gz1="$(_compress_if_exists 'SRR3147624_1' || true)"
gz2="$(_compress_if_exists 'SRR3147624_2' || true)"
gzs="$(_compress_if_exists 'SRR3147624' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool1_TCCGGAGA-CCTATCCT_L007_R1.F05_EVN_041315_CLIP1_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool1_TCCGGAGA-CCTATCCT_L007_R2.F05_EVN_041315_CLIP1_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147625"
gz1="$(_compress_if_exists 'SRR3147625_1' || true)"
gz2="$(_compress_if_exists 'SRR3147625_2' || true)"
gzs="$(_compress_if_exists 'SRR3147625' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R1.A04_EVN_041315_CLIP5_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R2.A04_EVN_041315_CLIP5_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147626"
gz1="$(_compress_if_exists 'SRR3147626_1' || true)"
gz2="$(_compress_if_exists 'SRR3147626_2' || true)"
gzs="$(_compress_if_exists 'SRR3147626' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R1.F05_EVN_041315_CLIP5_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R2.F05_EVN_041315_CLIP5_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147627"
gz1="$(_compress_if_exists 'SRR3147627_1' || true)"
gz2="$(_compress_if_exists 'SRR3147627_2' || true)"
gzs="$(_compress_if_exists 'SRR3147627' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R1.A03_EVN_041315_CLIP6_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R2.A03_EVN_041315_CLIP6_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147628"
gz1="$(_compress_if_exists 'SRR3147628_1' || true)"
gz2="$(_compress_if_exists 'SRR3147628_2' || true)"
gzs="$(_compress_if_exists 'SRR3147628' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R1.G07_EVN_041315_CLIP6_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "EVN_RBFOX2_pool2_ATTACTCG-GGCTCTGA_L007_R2.G07_EVN_041315_CLIP6_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147629"
gz1="$(_compress_if_exists 'SRR3147629_1' || true)"
gz2="$(_compress_if_exists 'SRR3147629_2' || true)"
gzs="$(_compress_if_exists 'SRR3147629' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool2_S2_R1.B06_RBFOX2_293XT_1to200_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool2_S2_R2.B06_RBFOX2_293XT_1to200_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147630"
gz1="$(_compress_if_exists 'SRR3147630_1' || true)"
gz2="$(_compress_if_exists 'SRR3147630_2' || true)"
gzs="$(_compress_if_exists 'SRR3147630' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool2_S2_R1.F05_RBFOX2_293XT_1to200_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool2_S2_R2.F05_RBFOX2_293XT_1to200_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147631"
gz1="$(_compress_if_exists 'SRR3147631_1' || true)"
gz2="$(_compress_if_exists 'SRR3147631_2' || true)"
gzs="$(_compress_if_exists 'SRR3147631' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool2_S2_R1.A01_RBFOX2_293XT_1to100_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool2_S2_R2.A01_RBFOX2_293XT_1to100_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147632"
gz1="$(_compress_if_exists 'SRR3147632_1' || true)"
gz2="$(_compress_if_exists 'SRR3147632_2' || true)"
gzs="$(_compress_if_exists 'SRR3147632' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool2_S2_R1.A03_RBFOX2_293XT_1to100_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool2_S2_R2.A03_RBFOX2_293XT_1to100_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147633"
gz1="$(_compress_if_exists 'SRR3147633_1' || true)"
gz2="$(_compress_if_exists 'SRR3147633_2' || true)"
gzs="$(_compress_if_exists 'SRR3147633' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool1_S1_R1.C01_RBFOX2_293XT_1to50_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool1_S1_R2.C01_RBFOX2_293XT_1to50_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147634"
gz1="$(_compress_if_exists 'SRR3147634_1' || true)"
gz2="$(_compress_if_exists 'SRR3147634_2' || true)"
gzs="$(_compress_if_exists 'SRR3147634' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool1_S1_R1.D08fixed_RBFOX2_293XT_1to50_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool1_S1_R2.D08fixed_RBFOX2_293XT_1to50_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147635"
gz1="$(_compress_if_exists 'SRR3147635_1' || true)"
gz2="$(_compress_if_exists 'SRR3147635_2' || true)"
gzs="$(_compress_if_exists 'SRR3147635' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool1_S1_R1.B06_RBFOX2_293XT_1to25_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool1_S1_R2.B06_RBFOX2_293XT_1to25_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147636"
gz1="$(_compress_if_exists 'SRR3147636_1' || true)"
gz2="$(_compress_if_exists 'SRR3147636_2' || true)"
gzs="$(_compress_if_exists 'SRR3147636' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool1_S1_R1.F05_RBFOX2_293XT_1to25_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool1_S1_R2.F05_RBFOX2_293XT_1to25_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147637"
gz1="$(_compress_if_exists 'SRR3147637_1' || true)"
gz2="$(_compress_if_exists 'SRR3147637_2' || true)"
gzs="$(_compress_if_exists 'SRR3147637' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool1_S1_R1.A01_RBFOX2_293XT_1to12_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool1_S1_R2.A01_RBFOX2_293XT_1to12_gel_RBFOX2.randomer.fastq.gz"
fi

fasterq-dump --split-files "SRR3147638"
gz1="$(_compress_if_exists 'SRR3147638_1' || true)"
gz2="$(_compress_if_exists 'SRR3147638_2' || true)"
gzs="$(_compress_if_exists 'SRR3147638' || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" "FOX2gel-pool1_S1_R1.A04_RBFOX2_293XT_1to12_gel_RBFOX2.randomer.fastq.gz"
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" "FOX2gel-pool1_S1_R2.A04_RBFOX2_293XT_1to12_gel_RBFOX2.randomer.fastq.gz"
fi


# Option B: Direct download (larger .sra files)
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147598/SRR3147598"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147599/SRR3147599"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147600/SRR3147600"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147601/SRR3147601"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147602/SRR3147602"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147603/SRR3147603"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147604/SRR3147604"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147605/SRR3147605"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147606/SRR3147606"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147607/SRR3147607"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147608/SRR3147608"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147609/SRR3147609"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147610/SRR3147610"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147611/SRR3147611"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147612/SRR3147612"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147613/SRR3147613"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147614/SRR3147614"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147615/SRR3147615"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147616/SRR3147616"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147617/SRR3147617"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147618/SRR3147618"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147619/SRR3147619"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147620/SRR3147620"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147621/SRR3147621"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147622/SRR3147622"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147623/SRR3147623"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147624/SRR3147624"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147625/SRR3147625"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147626/SRR3147626"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147627/SRR3147627"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147628/SRR3147628"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147629/SRR3147629"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147630/SRR3147630"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147631/SRR3147631"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147632/SRR3147632"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147633/SRR3147633"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147634/SRR3147634"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147635/SRR3147635"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147636/SRR3147636"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147637/SRR3147637"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147638/SRR3147638"

# --- Additional data files ---
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147604/SRR3147604"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147605/SRR3147605"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147601/SRR3147601"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147602/SRR3147602"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147598/SRR3147598"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147599/SRR3147599"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147603/SRR3147603"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147600/SRR3147600"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147606/SRR3147606"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147609/SRR3147609"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147612/SRR3147612"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147615/SRR3147615"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147618/SRR3147618"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147623/SRR3147623"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147624/SRR3147624"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147621/SRR3147621"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147627/SRR3147627"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147625/SRR3147625"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147622/SRR3147622"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147626/SRR3147626"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147628/SRR3147628"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147619/SRR3147619"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147620/SRR3147620"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147613/SRR3147613"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147610/SRR3147610"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147607/SRR3147607"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147614/SRR3147614"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147616/SRR3147616"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147617/SRR3147617"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147608/SRR3147608"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147611/SRR3147611"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147637/SRR3147637"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147638/SRR3147638"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147635/SRR3147635"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147633/SRR3147633"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147634/SRR3147634"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147636/SRR3147636"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147631/SRR3147631"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147632/SRR3147632"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147629/SRR3147629"
curl -L -O -C - "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR3147630/SRR3147630"

echo "Download complete. Files saved to $OUTDIR"