diff --git a/docs/workflows/phylogenetic_construction/augur.md b/docs/workflows/phylogenetic_construction/augur.md index c9d144997..88adb3c9f 100644 --- a/docs/workflows/phylogenetic_construction/augur.md +++ b/docs/workflows/phylogenetic_construction/augur.md @@ -284,9 +284,13 @@ The Nextstrain team hosts documentation surrounding the Augur workflow → Auspi | **Variable** | **Type** | **Description** | | --- | --- | --- | | aligned_fastas | File | A FASTA file of the aligned genomes | -| augur_iqtree_model_used | String | The iqtree model used during augur tree | +| augur_fasttree_version | String | The fasttree version used, blank if other tree method used | +| augur_iqtree_model_used | String | The iqtree model used during augur tree, blank if iqtree not used | +| augur_iqtree_version | String | The iqtree version used during augur tree (defualt), blank if other tree method used | +| augur_mafft_version | String | The mafft version used in augur align | | augur_phb_analysis_date | String | The date the analysis was run | | augur_phb_version | String | The version of the Public Health Bioinformatics (PHB) repository used | +| augur_raxml_version | String | The version of raxml used during augur tree, blank if other tree method used | | augur_version | String | Version of Augur used | | auspice_input_json | File | JSON file used as input to Auspice | | combined_assemblies | File | Concatenated FASTA file containing all samples | diff --git a/tasks/phylogenetic_inference/augur/task_augur_align.wdl b/tasks/phylogenetic_inference/augur/task_augur_align.wdl index 30065c8b2..e8cdca2a0 100644 --- a/tasks/phylogenetic_inference/augur/task_augur_align.wdl +++ b/tasks/phylogenetic_inference/augur/task_augur_align.wdl @@ -12,8 +12,13 @@ task augur_align { String docker = "us-docker.pkg.dev/general-theiagen/biocontainers/augur:22.0.2--pyhdfd78af_0" } command <<< + set -euo pipefail + # capture version information augur version > VERSION + echo + echo "mafft version:" + mafft --version 2>&1 | tee MAFFT_VERSION # run augur align augur align \ @@ -26,6 +31,7 @@ task augur_align { output { File aligned_fasta = "alignment.fasta" String augur_version = read_string("VERSION") + String mafft_version = read_string("MAFFT_VERSION") } runtime { docker: docker diff --git a/tasks/phylogenetic_inference/augur/task_augur_tree.wdl b/tasks/phylogenetic_inference/augur/task_augur_tree.wdl index 22bd469e7..a9a6b7b20 100644 --- a/tasks/phylogenetic_inference/augur/task_augur_tree.wdl +++ b/tasks/phylogenetic_inference/augur/task_augur_tree.wdl @@ -16,8 +16,30 @@ task augur_tree { String docker = "us-docker.pkg.dev/general-theiagen/biocontainers/augur:22.0.2--pyhdfd78af_0" } command <<< + set -euo pipefail + # capture version information augur version > VERSION + echo + + # touch the version files to ensure they exist (so that read_string output function doesn't fail) + touch IQTREE_VERSION FASTTREE_VERSION RAXML_VERSION + + # capture version information only for the method selected by user OR default of iqtree + if [ "~{method}" == "iqtree" ]; then + echo "iqtree version:" + iqtree --version | grep version | sed 's/.*version/version/;s/ for Linux.*//' | tee IQTREE_VERSION + elif [ "~{method}" == "fasttree" ]; then + echo "fasttree version:" + # fasttree prints to STDERR, so we need to redirect it to STDOUT, then grep for line with version info, then cut to extract version number (and nothing else) + fasttree -help 2>&1 | grep -m 1 "FastTree" | cut -d ' ' -f 2 | tee FASTTREE_VERSION + elif [ "~{method}" == "raxml" ]; then + echo "raxml version:" + raxmlHPC -v | grep RAxML | sed -e 's/.*RAxML version //' -e 's/released.*//' | tee RAXML_VERSION + fi + + echo + echo "Running augur tree now..." AUGUR_RECURSION_LIMIT=10000 augur tree \ --alignment "~{aligned_fasta}" \ @@ -34,7 +56,7 @@ task augur_tree { if [ "~{substitution_model}" == "auto" ]; then FASTA_BASENAME=$(basename ~{aligned_fasta} .fasta) FASTA_DIR=$(dirname ~{aligned_fasta}) - MODEL=$(grep "Best-fit model:" ${FASTA_DIR}/${FASTA_BASENAME}-delim.iqtree.log | sed 's|Best-fit model: ||g;s|chosen.*||' | tr -d '\n\r') + MODEL=$(grep "Best-fit model:" ${FASTA_DIR}/*${FASTA_BASENAME}-delim.iqtree.log | sed 's|Best-fit model: ||g;s|chosen.*||' | tr -d '\n\r') else MODEL="~{substitution_model}" fi @@ -42,11 +64,17 @@ task augur_tree { else echo "" > FINAL_MODEL.txt fi + + echo + echo "DEBUG: FINAL_MODEL.txt is: $(cat FINAL_MODEL.txt)" >>> output { File aligned_tree = "~{build_name}_~{method}.nwk" String augur_version = read_string("VERSION") + String iqtree_version = read_string("IQTREE_VERSION") + String fasttree_version = read_string("FASTTREE_VERSION") + String raxml_version = read_string("RAXML_VERSION") String iqtree_model_used = read_string("FINAL_MODEL.txt") } runtime { diff --git a/workflows/phylogenetics/wf_augur.wdl b/workflows/phylogenetics/wf_augur.wdl index bb003b705..7c76b02b1 100644 --- a/workflows/phylogenetics/wf_augur.wdl +++ b/workflows/phylogenetics/wf_augur.wdl @@ -200,10 +200,14 @@ workflow augur { String augur_version = augur_tree.augur_version # augur outputs + String? augur_mafft_version = augur_align.mafft_version File? auspice_input_json = augur_export.auspice_json File? time_tree = augur_refine.refined_tree File distance_tree = augur_tree.aligned_tree String augur_iqtree_model_used = augur_tree.iqtree_model_used + String augur_iqtree_version = augur_tree.iqtree_version + String augur_fasttree_version = augur_tree.fasttree_version + String augur_raxml_version = augur_tree.raxml_version File aligned_fastas = select_first([augur_align.aligned_fasta, alignment_fasta]) File combined_assemblies = filter_sequences_by_length.filtered_fasta File? metadata_merged = tsv_join.out_tsv