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

Export ancestral AA sequences for tree's root node #1317

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
### Features

* Support treetime 0.11.* [#1310][] (@corneliusroemer)
* Allow minimal export using only a (newick) tree in `augur export v2`. [#1299][] (@jameshadfield)
* export: Allow minimal export using only a (newick) tree in `augur export v2`. [#1299][] (@jameshadfield)
* A number of schema updates and improvements [#1299][] (@jameshadfield)
* We now require all nodes to have `node_attrs` on them with one of `div` or `num_date` present
* Some never-used properties are removed from the schemas, including a pattern for defining nucleotide INDELs which was never used by augur or auspice.
* Tip label defaults are now settable within the auspice-config JSON
* Empty colorings definitions are allowed (the tree will be grey in Auspice)

[#1310]: https://github.com/nextstrain/augur/pull/1310
### Bug fixes

* ancestral: Export amino acid sequences inferred for the root node of the tree in the node data JSON output for compatibility with `augur translate` output. [#1317][] (@huddlej)

[#1299]: https://github.com/nextstrain/augur/pull/1299
[#1310]: https://github.com/nextstrain/augur/pull/1310
[#1317]: https://github.com/nextstrain/augur/pull/1317

## 23.0.0 (5 September 2023)

Expand Down
8 changes: 8 additions & 0 deletions augur/ancestral.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ def run(args):
for key, node in anc_seqs['nodes'].items():
if 'aa_muts' not in node: node['aa_muts'] = {}
node['aa_muts'][gene] = aa_result['mutations']['nodes'][key]['muts']

# Add amino acid sequences to the root node of the tree.
if key == T.root.name:
if "aa_sequences" not in node:
node["aa_sequences"] = {}

node["aa_sequences"][gene] = aa_result['tt'].sequence(T.root, as_string=True, reconstructed=True)

anc_seqs['reference'][gene] = aa_result['root_seq']
# FIXME: Note that this is calculating the end of the CDS as 3*length of translation
# this is equivalent to the annotation for single segment CDS, but not for cds
Expand Down
7 changes: 7 additions & 0 deletions tests/functional/ancestral/cram/infer-amino-acid-sequences.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Check that the reference length was correctly exported as the nuc annotation
"PRO": {
"nuc": {
Check that amino acid sequences exist for the root node of the tree.
$ grep -A 2 "aa_sequences" "$CRAMTMP/$TESTFILE/ancestral_mutations.json"
"aa_sequences": {
"ENV": .* (re)
"PRO": .* (re)
Check that internal nodes have ancestral amino acid sequences.
$ grep "NODE" "$CRAMTMP/$TESTFILE/ancestral_aa_sequences_ENV.fasta" | wc -l
Expand Down
Loading