#!/bin/bash -euo pipefail # The file is staged by Nextflow from pattern */*_full_basic_stats.tsv # BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv should point to the staged file path # First try the direct path, then search for it TSV_FILE="" # Try the staged path directly if [ -f "BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv" ]; then TSV_FILE="BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv" # Try the expected subdirectory structure elif [ -f "BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1/BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv" ]; then TSV_FILE="BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1/BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv" # Search for the file else TSV_FILE=$(find . -name "BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv" -type f | head -n 1) if [ -z "$TSV_FILE" ] || [ ! -f "$TSV_FILE" ]; then TSV_FILE=$(find . -name "*_full_basic_stats.tsv" -type f | head -n 1) fi fi # Validate file exists if [ -z "$TSV_FILE" ] || [ ! -f "$TSV_FILE" ]; then echo "Error: Could not find SeqTools TSV file" >&2 echo "Searched for: BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv, BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1/BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_full_basic_stats.tsv, or *_full_basic_stats.tsv" >&2 echo "In directory: $(pwd)" >&2 echo "Contents:" >&2 ls -laR . >&2 exit 1 fi echo "Processing SeqTools file: $TSV_FILE" >&2 # Convert SeqTools TSV to MultiQC embedded TSV format # Note: We don't use -region 'chr20' here as ext.args is configured for SEQTOOL_QC, not this conversion script seqtool_to_multiqc.py \ "$TSV_FILE" \ "BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1_seqtool_mqc.tsv" \ --sample-id "BreastNP_FFPE_L03_RNA_01_B23LG7FLT4_1" # Create versions file cat <<-END_VERSIONS > versions.yml "NFCORE_RNAFUSION:RNAFUSION:QC_WORKFLOW:SEQTOOL_TO_MULTIQC": python: $(python3 --version | sed 's/Python //g') seqtool_to_multiqc: 1.0.0 END_VERSIONS