Files
SimurgArray/scripts/fetch_data.sh
T
kemal 368c97b9aa P0: project setup (packaging, CI, licences, data/oracle scripts)
- pyproject (uv/hatch, ruff, mypy strict, pytest markers), MIT LICENSE,
  THIRD_PARTY_NOTICES with verbatim BSD-2 (BeadArrayFiles) and MIT (gtc2vcf)
- CI workflow for Gitea/GitHub Actions: lint, type check, unit tests
- fetch_data.sh p0 now fetches the GSA v4 PGx demo IDATs (the GDA "Demo 36"
  bundle is a GenomeStudio project), unpacks archives, fixes pipefail bug
- make_oracle_gtcs.sh builds bcftools + gtc2vcf and writes oracle GTCs
- plan §17: corrected P0 dataset table
2026-09-27 16:56:39 +01:00

80 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Download SimurgArray datasets into data/<tier>/ and record sha256 checksums.
# Vendor files are for personal research use only; never commit them.
# Usage: bash scripts/fetch_data.sh p0|p1|p2
set -euo pipefail
cd "$(dirname "$0")/.."
tier="${1:?usage: fetch_data.sh p0|p1|p2}"
mkdir -p "data/$tier"
sums="data/CHECKSUMS.sha256"; touch "$sums"
get() { # get <url> <dest-dir>
local url="$1" dir="$2" f
f="$dir/$(basename "${url%%\?*}")"
if [[ -s "$f" ]]; then echo "have $f"; else
if command -v aria2c >/dev/null; then aria2c -x8 -s8 -c -d "$dir" "$url"
else wget -c -P "$dir" "$url"; fi
fi
grep -q " $f\$" "$sums" || sha256sum "$f" >> "$sums"
}
unpack() { # unzip/untar every archive under <dir> next to itself (idempotent)
find "$1" -name '*.zip' -o -name '*.tar.gz' | sort | while read -r a; do
out="${a%.zip}"; out="${out%.tar.gz}"
[[ -d "$out" ]] && continue
mkdir -p "$out"
case "$a" in *.zip) unzip -q -o "$a" -d "$out";; *.tar.gz) tar -xzf "$a" -C "$out";; esac
done
}
GDA=https://webdata.illumina.com/downloads/productfiles/global-diversity-array
G1K=https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/supporting/hd_genotype_chip
case "$tier" in
p0)
# GSA v4 PGx demo: 36 samples, real IDATs + BPM/CSV/EGT (primary small fixture)
SUP=https://support.illumina.com/content/dam/illumina-support/documents/documentation/chemistry_documentation/infinium_assays/infinium-gsa-pgx
d=data/p0/gsa_v4_pgx; mkdir -p "$d"
for f in idats_Demo_36.zip GSA-PGx-48v4-0_20079540_E2_bpm.zip GSA-PGx-48v4-0_20079540_E2_csv.zip \
GSA-PGx-48v4-0_20079540_E2_ClusterFile.zip SampleSheetTemplate_GSAv4PGx_2beadchips.csv; do
get "$SUP/$f" "$d"
done
# GDA v1 manifest/cluster files (note: the "Demo 36" bundle is a GenomeStudio project, not IDATs)
d=data/p0/gda_v1; mkdir -p "$d"
get "$GDA/infinium-global-diversity-array-8-v1-0-D1-manifest-file-bpm.zip" "$d"
get "$GDA/infinium-global-diversity-array-8-v1-0-D1-manifest-file-csv.zip" "$d"
get "$GDA/infinium-global-diversity-array-8-v1-0-D1-cluster-file.zip" "$d"
get "https://support.illumina.com/content/dam/illumina-support/documents/downloads/productfiles/global-diversity-array/infinium-global-diversity-array-8-v1-0_D1_SampleSheet_Demo_36.csv" "$d"
# Bioconductor IDAT fixtures (Artistic-2.0, redistributable) — fetched as source tarballs, no R needed
d=data/p0/bioc; mkdir -p "$d"
for pkg in IlluminaDataTestFiles hapmap370k; do
url=$(curl -sL "https://bioconductor.org/packages/release/data/experiment/html/$pkg.html" \
| grep -oE "\.\./src/contrib/${pkg}_[0-9.]+\.tar\.gz" | head -1 || true)
[[ -n "$url" ]] && get "https://bioconductor.org/packages/release/data/experiment/${url#../}" "$d" \
|| echo "!! could not resolve $pkg tarball"
done
unpack data/p0
;;
p1)
d=data/p1/1kg_omni_broad; mkdir -p "$d"
for f in HumanOmni2.5-4v1-Multi_B.bpm HumanOmni2.5-4v1_B.csv; do get "$G1K/broad_intensities/$f" "$d" || true; done
echo "Listing broad_intensities/ (pick EGT + the 107 GB Omni25_idats_gtcs_2141_samples.tgz):"
curl -s "$G1K/broad_intensities/" | grep -o 'href="[^"]*"' | cut -d'"' -f2 | grep -v '^?' || true
echo "Then: bash scripts/fetch_data.sh p1-big (downloads the 107 GB archive)"
d=data/p1/1kg_omni_sanger; mkdir -p "$d"
echo "Sanger set index:"; curl -s "$G1K/sanger_intensities/" | grep -o 'href="[^"]*"' | cut -d'"' -f2 | grep -v '^?' || true
d=data/p1/gse165845; mkdir -p "$d"
get "https://ftp.ncbi.nlm.nih.gov/geo/series/GSE165nnn/GSE165845/suppl/GSE165845_RAW.tar" "$d"
;;
p1-big)
get "$G1K/broad_intensities/Omni25_idats_gtcs_2141_samples.tgz" data/p1/1kg_omni_broad
;;
p2)
d=data/p2; mkdir -p "$d/gse96909" "$d/gda_pgx480"
get "https://ftp.ncbi.nlm.nih.gov/geo/series/GSE96nnn/GSE96909/suppl/GSE96909_RAW.tar" "$d/gse96909"
get "https://s3.amazonaws.com/webdata.illumina.com/downloads/productfiles/global-diversity-array-pgx/GDAPGx_Demo_idats.zip" "$d/gda_pgx480"
;;
*) echo "unknown tier $tier"; exit 2;;
esac
echo "checksums in $sums"