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

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

# --- GEO supplementary files ---
wget -nc ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE222nnn/GSE222216/suppl/GSE222216_22Rv1_C145S_EV_WT_raw_gene_counts.xlsx -O GSE222216_22Rv1_C145S_EV_WT_raw_gene_counts.xlsx
wget -nc ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE222nnn/GSE222216/suppl/GSE222216_Double_KO_RNA_Seq.xlsx -O GSE222216_Double_KO_RNA_Seq.xlsx

# --- 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 SRR22985924
gz1="$(_compress_if_exists SRR22985924_1 || true)"
gz2="$(_compress_if_exists SRR22985924_2 || true)"
gzs="$(_compress_if_exists SRR22985924 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WTD-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WTD-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985925
gz1="$(_compress_if_exists SRR22985925_1 || true)"
gz2="$(_compress_if_exists SRR22985925_2 || true)"
gzs="$(_compress_if_exists SRR22985925 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WTD-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WTD-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985926
gz1="$(_compress_if_exists SRR22985926_1 || true)"
gz2="$(_compress_if_exists SRR22985926_2 || true)"
gzs="$(_compress_if_exists SRR22985926 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WTD-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WTD-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985927
gz1="$(_compress_if_exists SRR22985927_1 || true)"
gz2="$(_compress_if_exists SRR22985927_2 || true)"
gzs="$(_compress_if_exists SRR22985927 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WT10S-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WT10S-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985928
gz1="$(_compress_if_exists SRR22985928_1 || true)"
gz2="$(_compress_if_exists SRR22985928_2 || true)"
gzs="$(_compress_if_exists SRR22985928 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WT10S-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WT10S-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985929
gz1="$(_compress_if_exists SRR22985929_1 || true)"
gz2="$(_compress_if_exists SRR22985929_2 || true)"
gzs="$(_compress_if_exists SRR22985929 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WT10S-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WT10S-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985930
gz1="$(_compress_if_exists SRR22985930_1 || true)"
gz2="$(_compress_if_exists SRR22985930_2 || true)"
gzs="$(_compress_if_exists SRR22985930 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WT10R-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WT10R-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985931
gz1="$(_compress_if_exists SRR22985931_1 || true)"
gz2="$(_compress_if_exists SRR22985931_2 || true)"
gzs="$(_compress_if_exists SRR22985931 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WT10R-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WT10R-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985932
gz1="$(_compress_if_exists SRR22985932_1 || true)"
gz2="$(_compress_if_exists SRR22985932_2 || true)"
gzs="$(_compress_if_exists SRR22985932 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" WT10R-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" WT10R-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985933
gz1="$(_compress_if_exists SRR22985933_1 || true)"
gz2="$(_compress_if_exists SRR22985933_2 || true)"
gzs="$(_compress_if_exists SRR22985933 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EVD-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EVD-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985934
gz1="$(_compress_if_exists SRR22985934_1 || true)"
gz2="$(_compress_if_exists SRR22985934_2 || true)"
gzs="$(_compress_if_exists SRR22985934 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EVD-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EVD-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985935
gz1="$(_compress_if_exists SRR22985935_1 || true)"
gz2="$(_compress_if_exists SRR22985935_2 || true)"
gzs="$(_compress_if_exists SRR22985935 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EVD-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EVD-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985936
gz1="$(_compress_if_exists SRR22985936_1 || true)"
gz2="$(_compress_if_exists SRR22985936_2 || true)"
gzs="$(_compress_if_exists SRR22985936 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EV10S-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EV10S-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985937
gz1="$(_compress_if_exists SRR22985937_1 || true)"
gz2="$(_compress_if_exists SRR22985937_2 || true)"
gzs="$(_compress_if_exists SRR22985937 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EV10S-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EV10S-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985938
gz1="$(_compress_if_exists SRR22985938_1 || true)"
gz2="$(_compress_if_exists SRR22985938_2 || true)"
gzs="$(_compress_if_exists SRR22985938 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EV10S-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EV10S-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985939
gz1="$(_compress_if_exists SRR22985939_1 || true)"
gz2="$(_compress_if_exists SRR22985939_2 || true)"
gzs="$(_compress_if_exists SRR22985939 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EV10R-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EV10R-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985940
gz1="$(_compress_if_exists SRR22985940_1 || true)"
gz2="$(_compress_if_exists SRR22985940_2 || true)"
gzs="$(_compress_if_exists SRR22985940 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EV10R-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EV10R-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985941
gz1="$(_compress_if_exists SRR22985941_1 || true)"
gz2="$(_compress_if_exists SRR22985941_2 || true)"
gzs="$(_compress_if_exists SRR22985941 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" EV10R-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" EV10R-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985942
gz1="$(_compress_if_exists SRR22985942_1 || true)"
gz2="$(_compress_if_exists SRR22985942_2 || true)"
gzs="$(_compress_if_exists SRR22985942 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145SD-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145SD-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985943
gz1="$(_compress_if_exists SRR22985943_1 || true)"
gz2="$(_compress_if_exists SRR22985943_2 || true)"
gzs="$(_compress_if_exists SRR22985943 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145SD-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145SD-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985944
gz1="$(_compress_if_exists SRR22985944_1 || true)"
gz2="$(_compress_if_exists SRR22985944_2 || true)"
gzs="$(_compress_if_exists SRR22985944 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145SD-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145SD-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985945
gz1="$(_compress_if_exists SRR22985945_1 || true)"
gz2="$(_compress_if_exists SRR22985945_2 || true)"
gzs="$(_compress_if_exists SRR22985945 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145S10S-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145S10S-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985946
gz1="$(_compress_if_exists SRR22985946_1 || true)"
gz2="$(_compress_if_exists SRR22985946_2 || true)"
gzs="$(_compress_if_exists SRR22985946 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145S10S-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145S10S-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985947
gz1="$(_compress_if_exists SRR22985947_1 || true)"
gz2="$(_compress_if_exists SRR22985947_2 || true)"
gzs="$(_compress_if_exists SRR22985947 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145S10S-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145S10S-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985948
gz1="$(_compress_if_exists SRR22985948_1 || true)"
gz2="$(_compress_if_exists SRR22985948_2 || true)"
gzs="$(_compress_if_exists SRR22985948 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145S10R-3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145S10R-3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985949
gz1="$(_compress_if_exists SRR22985949_1 || true)"
gz2="$(_compress_if_exists SRR22985949_2 || true)"
gzs="$(_compress_if_exists SRR22985949 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145S10R-2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145S10R-2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985950
gz1="$(_compress_if_exists SRR22985950_1 || true)"
gz2="$(_compress_if_exists SRR22985950_2 || true)"
gzs="$(_compress_if_exists SRR22985950 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" C145S10R-1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" C145S10R-1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985951
gz1="$(_compress_if_exists SRR22985951_1 || true)"
gz2="$(_compress_if_exists SRR22985951_2 || true)"
gzs="$(_compress_if_exists SRR22985951 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgSFPQ3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgSFPQ3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985952
gz1="$(_compress_if_exists SRR22985952_1 || true)"
gz2="$(_compress_if_exists SRR22985952_2 || true)"
gzs="$(_compress_if_exists SRR22985952 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgSFPQ2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgSFPQ2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985953
gz1="$(_compress_if_exists SRR22985953_1 || true)"
gz2="$(_compress_if_exists SRR22985953_2 || true)"
gzs="$(_compress_if_exists SRR22985953 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgSFPQ1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgSFPQ1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985954
gz1="$(_compress_if_exists SRR22985954_1 || true)"
gz2="$(_compress_if_exists SRR22985954_2 || true)"
gzs="$(_compress_if_exists SRR22985954 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgPSPC13_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgPSPC13_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985955
gz1="$(_compress_if_exists SRR22985955_1 || true)"
gz2="$(_compress_if_exists SRR22985955_2 || true)"
gzs="$(_compress_if_exists SRR22985955 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgPSPC12_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgPSPC12_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985956
gz1="$(_compress_if_exists SRR22985956_1 || true)"
gz2="$(_compress_if_exists SRR22985956_2 || true)"
gzs="$(_compress_if_exists SRR22985956 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgPSPC11_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgPSPC11_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985957
gz1="$(_compress_if_exists SRR22985957_1 || true)"
gz2="$(_compress_if_exists SRR22985957_2 || true)"
gzs="$(_compress_if_exists SRR22985957 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgCtrl3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgCtrl3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985958
gz1="$(_compress_if_exists SRR22985958_1 || true)"
gz2="$(_compress_if_exists SRR22985958_2 || true)"
gzs="$(_compress_if_exists SRR22985958 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgCtrl2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgCtrl2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985959
gz1="$(_compress_if_exists SRR22985959_1 || true)"
gz2="$(_compress_if_exists SRR22985959_2 || true)"
gzs="$(_compress_if_exists SRR22985959 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgNONO-sgCtrl1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgNONO-sgCtrl1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985960
gz1="$(_compress_if_exists SRR22985960_1 || true)"
gz2="$(_compress_if_exists SRR22985960_2 || true)"
gzs="$(_compress_if_exists SRR22985960 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgSFPQ3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgSFPQ3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985961
gz1="$(_compress_if_exists SRR22985961_1 || true)"
gz2="$(_compress_if_exists SRR22985961_2 || true)"
gzs="$(_compress_if_exists SRR22985961 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgSFPQ1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgSFPQ1_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985962
gz1="$(_compress_if_exists SRR22985962_1 || true)"
gz2="$(_compress_if_exists SRR22985962_2 || true)"
gzs="$(_compress_if_exists SRR22985962 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgSFPQ12_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgSFPQ12_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985963
gz1="$(_compress_if_exists SRR22985963_1 || true)"
gz2="$(_compress_if_exists SRR22985963_2 || true)"
gzs="$(_compress_if_exists SRR22985963 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgPSPC13_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgPSPC13_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985964
gz1="$(_compress_if_exists SRR22985964_1 || true)"
gz2="$(_compress_if_exists SRR22985964_2 || true)"
gzs="$(_compress_if_exists SRR22985964 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgPSPC12_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgPSPC12_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985965
gz1="$(_compress_if_exists SRR22985965_1 || true)"
gz2="$(_compress_if_exists SRR22985965_2 || true)"
gzs="$(_compress_if_exists SRR22985965 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgPSPC11_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgPSPC11_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985966
gz1="$(_compress_if_exists SRR22985966_1 || true)"
gz2="$(_compress_if_exists SRR22985966_2 || true)"
gzs="$(_compress_if_exists SRR22985966 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgCtrl3_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgCtrl3_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985967
gz1="$(_compress_if_exists SRR22985967_1 || true)"
gz2="$(_compress_if_exists SRR22985967_2 || true)"
gzs="$(_compress_if_exists SRR22985967 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgCtrl2_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgCtrl2_R2_001.fastq.gz
fi

fasterq-dump --split-files SRR22985968
gz1="$(_compress_if_exists SRR22985968_1 || true)"
gz2="$(_compress_if_exists SRR22985968_2 || true)"
gzs="$(_compress_if_exists SRR22985968 || true)"
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz1" ]; then
  mv -f "$gz1" sgControl-sgCtrl1_R1_001.fastq.gz
fi
if [ "$RENAME_SRA_TO_ORIGINAL" = "1" ] && [ -n "$gz2" ]; then
  mv -f "$gz2" sgControl-sgCtrl1_R2_001.fastq.gz
fi


# Option B: Direct download (larger .sra files)
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985924/SRR22985924
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985925/SRR22985925
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985926/SRR22985926
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985927/SRR22985927
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985928/SRR22985928
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985929/SRR22985929
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985930/SRR22985930
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985931/SRR22985931
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985932/SRR22985932
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985933/SRR22985933
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985934/SRR22985934
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985935/SRR22985935
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985936/SRR22985936
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985937/SRR22985937
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985938/SRR22985938
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985939/SRR22985939
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985940/SRR22985940
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985941/SRR22985941
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985942/SRR22985942
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985943/SRR22985943
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985944/SRR22985944
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985945/SRR22985945
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985946/SRR22985946
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985947/SRR22985947
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985948/SRR22985948
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985949/SRR22985949
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985950/SRR22985950
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985951/SRR22985951
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985952/SRR22985952
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985953/SRR22985953
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985954/SRR22985954
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985955/SRR22985955
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985956/SRR22985956
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985957/SRR22985957
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985958/SRR22985958
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985959/SRR22985959
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985960/SRR22985960
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985961/SRR22985961
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985962/SRR22985962
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985963/SRR22985963
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985964/SRR22985964
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985965/SRR22985965
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985966/SRR22985966
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985967/SRR22985967
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985968/SRR22985968

# --- Additional data files ---
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985950/SRR22985950
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985949/SRR22985949
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985948/SRR22985948
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985947/SRR22985947
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985946/SRR22985946
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985945/SRR22985945
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985944/SRR22985944
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985943/SRR22985943
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985942/SRR22985942
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985941/SRR22985941
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985940/SRR22985940
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985939/SRR22985939
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985938/SRR22985938
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985937/SRR22985937
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985936/SRR22985936
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985935/SRR22985935
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985934/SRR22985934
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985933/SRR22985933
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985968/SRR22985968
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985967/SRR22985967
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985966/SRR22985966
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985965/SRR22985965
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985964/SRR22985964
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985963/SRR22985963
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985962/SRR22985962
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985961/SRR22985961
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985960/SRR22985960
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985959/SRR22985959
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985958/SRR22985958
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985957/SRR22985957
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985956/SRR22985956
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985955/SRR22985955
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985954/SRR22985954
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985953/SRR22985953
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985952/SRR22985952
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985951/SRR22985951
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985932/SRR22985932
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985931/SRR22985931
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985930/SRR22985930
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985929/SRR22985929
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985928/SRR22985928
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985927/SRR22985927
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985926/SRR22985926
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985925/SRR22985925
curl -L -O -C - https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR22985924/SRR22985924

echo "Download complete. Files saved to $OUTDIR"