#!/bin/bash -euo pipefail # Find the kallisto abundance.h5 file # KALLISTO_QUANT outputs a directory (659_cRB-T1-TRNA-1_B23WHTKLT4_1) containing abundance.h5 H5_FILE="" # Try the staged path directly (should be a directory) if [ -d "659_cRB-T1-TRNA-1_B23WHTKLT4_1" ]; then # Look for abundance.h5 inside the directory if [ -f "659_cRB-T1-TRNA-1_B23WHTKLT4_1/abundance.h5" ]; then H5_FILE="659_cRB-T1-TRNA-1_B23WHTKLT4_1/abundance.h5" fi # Try common patterns elif [ -f "659_cRB-T1-TRNA-1_B23WHTKLT4_1/abundance.h5" ]; then H5_FILE="659_cRB-T1-TRNA-1_B23WHTKLT4_1/abundance.h5" # Search for the file else H5_FILE=$(find . -name "abundance.h5" -type f | head -n 1) fi # Validate file exists if [ -z "$H5_FILE" ] || [ ! -f "$H5_FILE" ]; then echo "Error: Could not find Kallisto abundance.h5 file" >&2 echo "Searched for: 659_cRB-T1-TRNA-1_B23WHTKLT4_1/abundance.h5, 659_cRB-T1-TRNA-1_B23WHTKLT4_1/abundance.h5, or abundance.h5" >&2 echo "In directory: $(pwd)" >&2 echo "Contents:" >&2 ls -laR . >&2 exit 1 fi echo "Processing Kallisto file: $H5_FILE" >&2 # Convert Kallisto abundance.h5 to MultiQC embedded TSV format (with expression QC columns from sample_qc) kallisto_to_multiqc.py \ "$H5_FILE" \ "659_cRB-T1-TRNA-1_B23WHTKLT4_1_kallisto_mqc.tsv" \ --sample-id "659_cRB-T1-TRNA-1_B23WHTKLT4_1" \ --sample-qc 659_cRB-T1-TRNA-1_B23WHTKLT4_1.sample_qc.tsv # Create versions file cat <<-END_VERSIONS > versions.yml "NFCORE_RNAFUSION:RNAFUSION:KALLISTO_TO_MULTIQC": python: $(python3 --version | sed 's/Python //g') kallisto_to_multiqc: 1.0.0 END_VERSIONS