Skip to content

Instantly share code, notes, and snippets.

@tsibley
Last active January 11, 2023 23:36
Show Gist options
  • Save tsibley/ed37648ed12947849b47e1f0dae596b9 to your computer and use it in GitHub Desktop.
Save tsibley/ed37648ed12947849b47e1f0dae596b9 to your computer and use it in GitHub Desktop.
rule tree:
message: "Building tree"
input:
alignment = rules.align.output.alignment
output:
tree = "results/tree_raw.nwk"
shell:
"""
# Remove any prior RAxML outputs which didn't get cleaned up
rm -v RAxML_*.* 2>/dev/null || true
augur tree \
--alignment {input.alignment} \
--output {output.tree} \
--method raxml \
--tree-builder-args '-m GTRCAT -p $RANDOM -f a -x $RANDOM -N 1000' \
--override-default-args \
|| (
echo "WARNING: augur tree failed because of known issues with bootstrapping <https://github.com/nextstrain/augur/pull/1127>; trying to copy tree manually" >&2
cp -v RAxML_bipartitions.* {output.tree}
rm -v RAxML_*.*
)
"""
diff --git a/Snakefile b/Snakefile
index a60e8e9..cefc567 100644
--- a/Snakefile
+++ b/Snakefile
@@ -86,12 +86,20 @@ rule tree:
tree = "results/tree_raw.nwk"
shell:
"""
+ # Remove any prior RAxML outputs which didn't get cleaned up
+ rm -v RAxML_*.* 2>/dev/null || true
+
augur tree \
--alignment {input.alignment} \
--output {output.tree} \
--method raxml \
--tree-builder-args '-m GTRCAT -p $RANDOM -f a -x $RANDOM -N 1000' \
- --override-default-args
+ --override-default-args \
+ || (
+ echo "WARNING: augur tree failed because of known issues with bootstrapping <https://github.com/nextstrain/augur/pull/1127>; trying to copy tree manually" >&2
+ cp -v RAxML_bipartitions.* {output.tree}
+ rm -v RAxML_*.*
+ )
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment