Skip to content

Commit

Permalink
Merge pull request #1555 from nextstrain/fix-titer-sub-tree-annotations
Browse files Browse the repository at this point in the history
Fix titer substitution model tree annotations
  • Loading branch information
huddlej authored Jul 24, 2024
2 parents be94e50 + 4846fbb commit bc5ea54
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
* traits, export v2: `augur traits` now reports all confidence values above 0.1% rather than limiting them to the top 4 results. There is no change in the eventual Auspice dataset as `augur export v2` will still only consider the top 4. [#1512][] (@jameshadfield)
* curate: Excel (`.xlsx` and `.xls`) and OpenOffice (`.ods`) spreadsheet files are now also supported as metadata inputs (`--metadata`). The first sheet in the workbook is read as tabular data. [#1550][] (@tsibley)

### Bug Fixes

* titers sub: Fixes a bug where antigenic weights were assigned to branches for substitutions in the incorrect order of `<derived allele><position><ancestral allele>` instead of `<ancestral allele><position><derived allele>`. [#1555][] (@huddlej)

[#1512]: https://github.com/nextstrain/augur/pull/1512
[#1550]: https://github.com/nextstrain/augur/pull/1550
[#1555]: https://github.com/nextstrain/augur/pull/1555


## 25.1.1 (15 July 2024)
Expand Down
2 changes: 1 addition & 1 deletion augur/titer_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ def annotate_tree(self, tree):
for node in tree.find_clades():
for child in node.clades:
# Get mutations between the current node and its parent.
mutations = self.get_mutations(child.name, node.name)
mutations = self.get_mutations(node.name, child.name)

# Calculate titer drop on the branch to the current node.
child.dTiterSub = 0
Expand Down
8 changes: 8 additions & 0 deletions tests/functional/titers/cram/titers-sub-with-tree.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ Test titer substitution model with alignment and tree inputs.
--- 272 total measurements
$ grep cTiterSub $TMP/titers-sub.json | wc -l
\s*120 (re)

Verify that the titer drops assigned per branch correspond to the expected values for this dataset.
In this example, we know that the HA1 amino acid sequence for A/Fujian/445/2003 carries a S193N substitution and that the titer model assigns a weight of 0.6 to that substitution.
The titer model assigns a higher weight of 1.22 to the opposite substitution N193S.
When we search for that sequence's per-branch titer drop, we should get the smaller value below.

$ python3 -c 'import json, sys; print(json.load(sys.stdin)["nodes"]["A/Fujian/445/2003"]["dTiterSub"])' < $TMP/titers-sub.json
0.60* (glob)

0 comments on commit bc5ea54

Please sign in to comment.