File Info

Filename
.command.sh
Full Path
s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/a3/a9313af80fb9dd9c9916805145f6d7/.command.sh
Size
1.4 KB
Attempt
#!/bin/bash -euo pipefail
# Find the preseq lc_extrap.txt file
EXTRAP_FILE=""

# Try the staged path directly
if [ -f "aih-tih-sc-06a169-R1_A23WJ53LT4_1.lc_extrap.txt" ]; then
    EXTRAP_FILE="aih-tih-sc-06a169-R1_A23WJ53LT4_1.lc_extrap.txt"
# Search for the file
else
    EXTRAP_FILE=$(find . -name "aih-tih-sc-06a169-R1_A23WJ53LT4_1*.lc_extrap.txt" -type f | head -n 1)
    if [ -z "$EXTRAP_FILE" ] || [ ! -f "$EXTRAP_FILE" ]; then
        EXTRAP_FILE=$(find . -name "*.lc_extrap.txt" -type f | head -n 1)
    fi
fi

# Validate file exists
if [ -z "$EXTRAP_FILE" ] || [ ! -f "$EXTRAP_FILE" ]; then
    echo "Error: Could not find Preseq lc_extrap.txt file" >&2
    echo "Searched for: aih-tih-sc-06a169-R1_A23WJ53LT4_1.lc_extrap.txt, aih-tih-sc-06a169-R1_A23WJ53LT4_1*.lc_extrap.txt, or *.lc_extrap.txt" >&2
    echo "In directory: $(pwd)" >&2
    echo "Contents:" >&2
    ls -laR . >&2
    exit 1
fi

echo "Processing Preseq file: $EXTRAP_FILE" >&2

# Convert Preseq lc_extrap.txt to MultiQC embedded TSV format
preseq_to_multiqc.py \
    "$EXTRAP_FILE" \
    "aih-tih-sc-06a169-R1_A23WJ53LT4_1_preseq_mqc.tsv" \
    --sample-id "aih-tih-sc-06a169-R1_A23WJ53LT4_1"

# Create versions file
cat <<-END_VERSIONS > versions.yml
"NFCORE_RNAFUSION:RNAFUSION:QC_WORKFLOW:PRESEQ_TO_MULTIQC":
    python: $(python3 --version | sed 's/Python //g')
    preseq_to_multiqc: 1.0.0
END_VERSIONS