-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
export v2: Add
--metadata-columns
option
Allows users to specify additional metadata columns to export as node attributes that are not specified as coloring options via the existing `--color-by-metadata` option or the Auspice config JSON. This allows the metadata columns to be visible in the tree in Auspice without polluting the color-by options.
- Loading branch information
1 parent
9317485
commit 6b1dbf6
Showing
4 changed files
with
170 additions
and
2 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
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,16 @@ | ||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Run export with tree and metadata with additional columns. | ||
|
||
$ ${AUGUR} export v2 \ | ||
> --tree "$TESTDIR/../data/tree.nwk" \ | ||
> --metadata "$TESTDIR/../data/dataset1_metadata_with_additional_columns.tsv" \ | ||
> --metadata-columns "field_A" "field_B" \ | ||
> --maintainers "Nextstrain Team" \ | ||
> --output dataset.json > /dev/null | ||
|
||
$ python3 "$TESTDIR/../../../../scripts/diff_jsons.py" "$TESTDIR/../data/dataset-with-additional-metadata-columns.json" dataset.json \ | ||
> --exclude-paths "root['meta']['updated']" "root['meta']['maintainers']" | ||
{} |
121 changes: 121 additions & 0 deletions
121
tests/functional/export_v2/data/dataset-with-additional-metadata-columns.json
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,121 @@ | ||
{ | ||
"version": "v2", | ||
"meta": { | ||
"updated": "2024-01-05", | ||
"maintainers": [ | ||
{ | ||
"name": "Nextstrain Team" | ||
} | ||
], | ||
"colorings": [], | ||
"filters": [], | ||
"panels": [ | ||
"tree" | ||
] | ||
}, | ||
"tree": { | ||
"name": "ROOT", | ||
"node_attrs": { | ||
"div": 0 | ||
}, | ||
"branch_attrs": {}, | ||
"children": [ | ||
{ | ||
"name": "tipA", | ||
"node_attrs": { | ||
"div": 1.0, | ||
"field_A": { | ||
"value": "AA" | ||
}, | ||
"field_B": { | ||
"value": "AAA" | ||
} | ||
}, | ||
"branch_attrs": {} | ||
}, | ||
{ | ||
"name": "internalBC", | ||
"node_attrs": { | ||
"div": 2.0 | ||
}, | ||
"branch_attrs": {}, | ||
"children": [ | ||
{ | ||
"name": "tipB", | ||
"node_attrs": { | ||
"div": 3.0, | ||
"field_A": { | ||
"value": "BB" | ||
}, | ||
"field_B": { | ||
"value": "BBB" | ||
} | ||
}, | ||
"branch_attrs": {} | ||
}, | ||
{ | ||
"name": "tipC", | ||
"node_attrs": { | ||
"div": 3.0, | ||
"field_A": { | ||
"value": "CC" | ||
}, | ||
"field_B": { | ||
"value": "CCC" | ||
} | ||
}, | ||
"branch_attrs": {} | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "internalDEF", | ||
"node_attrs": { | ||
"div": 5.0 | ||
}, | ||
"branch_attrs": {}, | ||
"children": [ | ||
{ | ||
"name": "tipD", | ||
"node_attrs": { | ||
"div": 8.0, | ||
"field_A": { | ||
"value": "DD" | ||
}, | ||
"field_B": { | ||
"value": "DDD" | ||
} | ||
}, | ||
"branch_attrs": {} | ||
}, | ||
{ | ||
"name": "tipE", | ||
"node_attrs": { | ||
"div": 9.0, | ||
"field_A": { | ||
"value": "EE" | ||
}, | ||
"field_B": { | ||
"value": "EEE" | ||
} | ||
}, | ||
"branch_attrs": {} | ||
}, | ||
{ | ||
"name": "tipF", | ||
"node_attrs": { | ||
"div": 6.0, | ||
"field_A": { | ||
"value": "FF" | ||
}, | ||
"field_B": { | ||
"value": "FFF" | ||
} | ||
}, | ||
"branch_attrs": {} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/functional/export_v2/data/dataset1_metadata_with_additional_columns.tsv
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,7 @@ | ||
strain field_A field_B | ||
tipA AA AAA | ||
tipB BB BBB | ||
tipC CC CCC | ||
tipD DD DDD | ||
tipE EE EEE | ||
tipF FF FFF |