-
Notifications
You must be signed in to change notification settings - Fork 128
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
WIP [refine] unique internal node names #1451
Draft
jameshadfield
wants to merge
3
commits into
james/export-multitree
Choose a base branch
from
james/unique-node-names
base: james/export-multitree
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,10 @@ | ||
$ source "$TESTDIR"/_setup.sh | ||
|
||
$ echo "(tipA:1,(tipA:1,tipA:1)internalBC:2,(tipD:3,tipE:4,tipF:1)internalDEF:5)ROOT:0;" > tree1.nwk | ||
|
||
$ ${AUGUR} export v2 \ | ||
> --tree tree1.nwk \ | ||
> --output minimal.json | ||
ERROR: 1 node names occur multiple times in the tree: 'tipA' | ||
[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
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,18 @@ | ||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Test a tree with unlabelled internal nodes. | ||
In Augur v24.3.0 and earlier these would work _sometimes_ depending | ||
on what code paths were hit, but in most real-life cases would raise | ||
an uncaught error. We now check for these when we parse the tree. | ||
|
||
$ echo "(tipA:1,(tipB:1,tipC:1):2,(tipD:3,tipE:4,tipF:1):5):0;" > tree1.nwk | ||
|
||
$ ${AUGUR} export v2 \ | ||
> --tree tree1.nwk \ | ||
> --metadata "$TESTDIR/../data/dataset1_metadata_with_name.tsv" \ | ||
> --node-data "$TESTDIR/../data/div_node-data.json" \ | ||
> --output test1.json | ||
ERROR: Tree contains unnamed nodes.+ (re) | ||
[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,53 @@ | ||
|
||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Create a small second tree (which has different names/labels than 'tree.nwk') | ||
$ cat > tree2.nwk <<~~ | ||
> (tipG:1,(tipH:1,tipI:1)internalHI:2)SECOND_ROOT:0; | ||
> ~~ | ||
|
||
Minimal export -- no node data, no metadata etc etc | ||
$ ${AUGUR} export v2 \ | ||
> --tree "$TESTDIR/../data/tree.nwk" tree2.nwk \ | ||
> --output minimal.json &> /dev/null | ||
|
||
More realistic export - with node_data for all nodes and metadata for some of them | ||
|
||
$ cat > metadata.tsv <<~~ | ||
> strain something | ||
> tipA foo | ||
> tipB foo | ||
> tipC foo | ||
> tipG bar | ||
> tipH bar | ||
> ~~ | ||
|
||
|
||
$ cat > node-data.json <<~~ | ||
> { | ||
> "nodes": { | ||
> "ROOT": {"mutation_length": 0}, | ||
> "tipA": {"mutation_length": 1}, | ||
> "internalBC": {"mutation_length": 2}, | ||
> "tipB": {"mutation_length": 1}, | ||
> "tipC": {"mutation_length": 1}, | ||
> "internalDEF": {"mutation_length": 5}, | ||
> "tipD": {"mutation_length": 3}, | ||
> "tipE": {"mutation_length": 4}, | ||
> "tipF": {"mutation_length": 1}, | ||
> "SECOND_ROOT": {"mutation_length": 0}, | ||
> "tipG": {"mutation_length": 1}, | ||
> "internalHI": {"mutation_length": 2}, | ||
> "tipH": {"mutation_length": 1}, | ||
> "tipI": {"mutation_length": 1} | ||
> } | ||
> } | ||
> ~~ | ||
|
||
$ ${AUGUR} export v2 \ | ||
> --tree "$TESTDIR/../data/tree.nwk" tree2.nwk \ | ||
> --metadata metadata.tsv --color-by-metadata something \ | ||
> --node-data node-data.json \ | ||
> --output output.json &> /dev/null |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hashing of the terminals of the tree feels arbitrary and not driven by the actual properties of the hash, esp. given the truncation of it. For example, two trees with the same terminals but different structures will collide. Why not simply produce unique ids for each node instead? (I still think we should do that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This functionality is motivated by multi-trees where terminal node names cannot be shared across trees.