Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Augur] Expose Augur versions #686

Merged
merged 15 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
39ece66
Add iqtree model extraction to augur_tree task and update workflow ou…
Michal-Babins Nov 8, 2024
d181a17
Refactor augur_tree task to correctly derive FASTA basename and direc…
Michal-Babins Nov 8, 2024
2ac0c0d
Add iqtree model used field to augur workflow documentation
Michal-Babins Nov 12, 2024
a9a4e65
Handle empty substitution model case in augur_tree task
Michal-Babins Nov 12, 2024
064d677
Ensure iqtree_model_used is a non-nullable String in augur_tree task …
Michal-Babins Nov 12, 2024
8e8f1f2
Update augur workflow documentation to include model options for subs…
Michal-Babins Nov 14, 2024
548ca26
Add augur_iqtree_model_used variable to documentation for clarity
Michal-Babins Nov 14, 2024
a55fbbb
added wildcard so we can parse the model name out of log file is a BE…
kapsakcj Nov 26, 2024
d7737af
added "set --euo pipefail" to augur tree task, also added 2 output st…
kapsakcj Dec 2, 2024
86be573
added string output mafft_version to augur_align task; also added set…
kapsakcj Dec 3, 2024
d8ccef5
augur_tree task: added version capture for 3 tree building methods an…
kapsakcj Dec 4, 2024
7c13734
Merge remote-tracking branch 'origin/main' into mb-augur-automodel-ou…
Michal-Babins Dec 9, 2024
e476731
docs: add version variables for fasttree, iqtree, and raxml in augur …
Michal-Babins Dec 10, 2024
4606885
docs: add mafft version variable to augur workflow documentation
Michal-Babins Dec 10, 2024
34ead16
docs: update descriptions for tree method version variables in augur …
Michal-Babins Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/workflows/phylogenetic_construction/augur.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
6 changes: 6 additions & 0 deletions tasks/phylogenetic_inference/augur/task_augur_align.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've got an extra echo here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see you're using them as line breaks in the output log

echo "mafft version:"
mafft --version 2>&1 | tee MAFFT_VERSION

# run augur align
augur align \
Expand All @@ -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
Expand Down
30 changes: 29 additions & 1 deletion tasks/phylogenetic_inference/augur/task_augur_tree.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand All @@ -34,19 +56,25 @@ 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
echo "$MODEL" > FINAL_MODEL.txt
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 {
Expand Down
4 changes: 4 additions & 0 deletions workflows/phylogenetics/wf_augur.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading