-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92d08b5
commit 701d6ee
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Attempt to root on a strain which is not in the tree is an error | ||
$ ${AUGUR} refine \ | ||
> --tree "$TESTDIR/../data/tree_raw.nwk" --metadata "$TESTDIR/../data/metadata.tsv" --alignment "$TESTDIR/../data/aligned.fasta" \ | ||
> --output-tree tree.nwk --output-node-data branch_lengths.json \ | ||
> --root not-in-tree > /dev/null | ||
ERROR: Rooting with the provided strain name(s) failed. | ||
This is probably because the following names supplied to '--root' were not found in the tree: | ||
- 'not-in-tree' | ||
|
||
[2] | ||
|
||
Check that rooting on multiple (valid) sequences + '--remove-outgroup' is an error | ||
$ ${AUGUR} refine \ | ||
> --tree "$TESTDIR/../data/tree_raw.nwk" --metadata "$TESTDIR/../data/metadata.tsv" --alignment "$TESTDIR/../data/aligned.fasta" \ | ||
> --output-tree tree.nwk --output-node-data branch_lengths.json \ | ||
> --root 'Colombia/2016/ZC204Se' 'VEN/UF_1/2016' --remove-outgroup > /dev/null | ||
ERROR: --remove-outgroup is not valid when rooting on multiple strains | ||
[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Check that rooting on an outgroup strain actually works | ||
$ ${AUGUR} refine \ | ||
> --tree "$TESTDIR/../data/tree_raw.nwk" --metadata "$TESTDIR/../data/metadata.tsv" --alignment "$TESTDIR/../data/aligned.fasta" \ | ||
> --output-tree tree1.nwk --output-node-data branch_lengths1.json \ | ||
> --root 'Colombia/2016/ZC204Se' > /dev/null | ||
|
||
$ python3 "$TESTDIR/../report-root.py" tree1.nwk | ||
Tree root has a single terminal child 'Colombia/2016/ZC204Se' | ||
|
||
Check that rooting on an outgroup strain with '--remove-outgroup' does remove it | ||
$ ${AUGUR} refine \ | ||
> --tree "$TESTDIR/../data/tree_raw.nwk" --metadata "$TESTDIR/../data/metadata.tsv" --alignment "$TESTDIR/../data/aligned.fasta" \ | ||
> --output-tree tree2.nwk --output-node-data branch_lengths2.json \ | ||
> --root 'Colombia/2016/ZC204Se' --remove-outgroup > /dev/null | ||
|
||
$ grep 'Colombia/2016/ZC204Se' tree2.nwk | ||
[1] | ||
|
||
$ python3 "$TESTDIR/../report-root.py" tree2.nwk | ||
No children of the root were terminal nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import sys | ||
from augur.utils import read_tree | ||
|
||
T = read_tree(sys.argv[1]) | ||
root_child_tips = [c for c in T.root.clades if c.is_terminal()] | ||
if len(root_child_tips)==0: | ||
print("No children of the root were terminal nodes") | ||
elif len(root_child_tips)>1: | ||
print("Multiple children of the root were terminal nodes") | ||
else: | ||
print(f"Tree root has a single terminal child {root_child_tips[0].name!r}") |