#!/bin/bash -euo pipefail # Load sample_type_map into associative array (skip header) declare -A type_map while IFS=, read -r sid stype; do type_map["$sid"]="$stype" done < <(tail -n +2 sample_type_map.csv) echo "sample,sample_type,fastq_1,fastq_2,strandedness" > samplesheet.csv while IFS=$'\t' read -r sample_id r1 r2; do [ -z "$sample_id" ] && continue st="${type_map[$sample_id]:-}" if [ -z "$st" ]; then echo "ERROR: no sample_type found for '$sample_id' in sample_type_map.csv" >&2 exit 1 fi echo "${sample_id},${st},${r1},${r2},reverse" >> samplesheet.csv done < fastq_paths.tsv cat <<-END_VERSIONS > versions.yml "NFCORE_RNAFUSION:DEMUX_FROM_RUNDIR:DEMULTIPLEX:SAMPLESHEET_FROM_MERGED": bash: $(bash --version | head -1 | awk '{print $4}') END_VERSIONS