From e3df8f6b74a41b1781e6741a0cd7a939020f43f0 Mon Sep 17 00:00:00 2001 From: fraser-combe Date: Thu, 14 Nov 2024 14:42:37 -0600 Subject: [PATCH] updating demux --- tasks/basecalling/task_dorado_basecall.wdl | 17 ++++++++++------- tasks/basecalling/task_dorado_demux.wdl | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tasks/basecalling/task_dorado_basecall.wdl b/tasks/basecalling/task_dorado_basecall.wdl index 111c55e01..6536e90c7 100644 --- a/tasks/basecalling/task_dorado_basecall.wdl +++ b/tasks/basecalling/task_dorado_basecall.wdl @@ -18,6 +18,16 @@ task basecall { dorado --version > DORADO_VERSION 2>&1 echo "Captured Dorado version:" $(cat DORADO_VERSION) + # Define the model to use, substituting "sup" with the full model name if given + resolved_model="~{dorado_model}" + if [ "$resolved_model" = "sup" ]; then + resolved_model="dna_r10.4.1_e8.2_400bps_sup@v5.0.0" + fi + + # Log the resolved model name + echo "Using Dorado model: $resolved_model" + echo "$resolved_model" > "DORADO_MODEL" + # Define a log file path to capture output log_file="dorado_basecall.log" @@ -47,13 +57,6 @@ task basecall { generated_sam=$(find "$sam_output" -name "*.sam" | head -n 1) mv "$generated_sam" "$sam_file" - # Extract the detailed model name from the log file or set a default if extraction fails - model_name=$(grep -oP '(?<=downloading )[^ ]+' "$log_file" | head -n 1 || echo "unknown_model") - - # Write the model name to DORADO_MODEL, or default to "unknown_model" - echo "Extracted Dorado model name: $model_name" | tee -a "$log_file" - echo "$model_name" > "DORADO_MODEL" - echo "Basecalling completed for ~{input_file}. SAM file renamed to: $sam_file" | tee -a "$log_file" >>> diff --git a/tasks/basecalling/task_dorado_demux.wdl b/tasks/basecalling/task_dorado_demux.wdl index 8eb1493fe..4df7f1420 100644 --- a/tasks/basecalling/task_dorado_demux.wdl +++ b/tasks/basecalling/task_dorado_demux.wdl @@ -25,8 +25,11 @@ task dorado_demux { fastq_file_name="~{fastq_file_name}" kit_name="~{kit_name}" + # Start the main log file for the entire task + exec > >(tee -a dorado_demux.log) 2>&1 echo "### Starting Dorado demux ###" date + echo "Input BAM files:" for bam_file in ~{sep=" " bam_files}; do echo "$bam_file"; done