Files
reproduce_setup/pgx-main/download_files.sh
2025-08-18 12:06:58 +02:00

29 lines
706 B
Bash

#!/bin/bash
bam_s3_bucket="quantgene-wes-archive"
upload_s3=true
file=${1--}
# --------------------- Download files from S3 -----------------------
while IFS= read vcf_s3; do
temp=($(echo $vcf_s3 | tr "/" "\n"))
vcf_s3_bucket="${temp[1]}"
flowcell="${temp[2]}"
run="${temp[3]}"
sample="${temp[4]::-4}"
vcf_s3_prefix="s3://${vcf_s3_bucket}/${flowcell}/${run}"
bam_s3_prefix="s3://${bam_s3_bucket}/${run}"
bam_s3="${bam_s3_prefix}/${sample}.deduped.bam"
aws s3 cp $vcf_s3 data/
aws s3 cp $bam_s3 data/
done < <(cat -- "$file")
# ------------------------ Index BAM files ---------------------------
for f in data/*.bam; do
echo "Indexing: "$f
samtools index $f $f".bai"
done