#!/bin/bash -euo pipefail
mkdir -p merged/Reports
first=true
for f in ds*/*; do
if [ "$first" = true ]; then
cat "$f" > merged/Reports/Demultiplex_Stats.csv
first=false
else
tail -n+2 "$f" >> merged/Reports/Demultiplex_Stats.csv
fi
done
if ls tu*/* 1>/dev/null 2>&1; then
first=true
for f in tu*/*; do
if [ "$first" = true ]; then
cat "$f" > merged/Reports/Top_Unknown_Barcodes.csv
first=false
else
tail -n+2 "$f" >> merged/Reports/Top_Unknown_Barcodes.csv
fi
done
fi
sample_sheet_qc.py \
merged \
--fail-threshold 10.0 --warning-threshold 5.0 --non-ntc-threshold 1000000 --ntc-threshold 2000000 \
--output-dir . \
--create-pass-file
cat <<-END_VERSIONS > versions.yml
"NFCORE_RNAFUSION:DEMUX_FROM_RUNDIR:DEMULTIPLEX:SAMPLESHEET_CHECK":
sample_sheet_qc: 1.1.0
END_VERSIONS