From faa9e797f1347a52bccac10c7393ce1930f38ea3 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Wed, 26 Jul 2023 11:44:06 -0700 Subject: [PATCH 1/3] Add deprecation warning for export v1 --- augur/export_v1.py | 5 +++++ tests/builds/zika.t | 2 ++ 2 files changed, 7 insertions(+) diff --git a/augur/export_v1.py b/augur/export_v1.py index 70de3124b..58088251e 100644 --- a/augur/export_v1.py +++ b/augur/export_v1.py @@ -4,6 +4,7 @@ import os, sys import re +from textwrap import dedent import time import numpy as np from Bio import Phylo @@ -345,6 +346,10 @@ def register_parser(parent_subparsers): def run(args): + print(dedent("""\ + DEPRECATION WARNING: augur export v1 is no longer maintained and will be removed in a future release. + Read more on how to migrate to export v2: """),file=sys.stderr) + T = Phylo.read(args.tree, 'newick') node_data = read_node_data(args.node_data) # args.node_data is an array of multiple files (or a single file) nodes = node_data["nodes"] # this is the per-node metadata produced by various augur modules diff --git a/tests/builds/zika.t b/tests/builds/zika.t index 745ab7453..c21486f73 100644 --- a/tests/builds/zika.t +++ b/tests/builds/zika.t @@ -164,6 +164,8 @@ Export JSON files as v1 auspice outputs. > --output-tree "$TMP/out/v1_zika_tree.json" \ > --output-meta "$TMP/out/v1_zika_meta.json" \ > --output-sequence "$TMP/out/v1_zika_seq.json" > /dev/null + DEPRECATION WARNING: augur export v1 is no longer maintained and will be removed in a future release. + Read more on how to migrate to export v2: $ ${AUGUR} validate export-v1 "$TMP/out/v1_zika_meta.json" "$TMP/out/v1_zika_tree.json" > /dev/null From fa759ee6753ca39f2f9c23424ed0642fdd4807ac Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Wed, 26 Jul 2023 11:34:46 -0700 Subject: [PATCH 2/3] export v1: Remove --metadata-id-columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was added to both export v1 and v2 as part of a larger change¹, but that change was incomplete and did not work as intended. It has been fixed for export v2². Since export v1 is no longer being maintained, remove the option instead of trying to fix it here as well. ¹ 42f6cb2c8e23f496e56a2e803bb222b5076c1db3 ² 9bf1b4ce4169b2a10ea974608188c2fdd918b9bc --- augur/export_v1.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/augur/export_v1.py b/augur/export_v1.py index 58088251e..c2d0990f3 100644 --- a/augur/export_v1.py +++ b/augur/export_v1.py @@ -12,7 +12,7 @@ from collections import defaultdict from .errors import AugurError from .argparse_ import ExtendAction -from .io.metadata import DEFAULT_DELIMITERS, DEFAULT_ID_COLUMNS, InvalidDelimiter, read_metadata +from .io.metadata import DEFAULT_DELIMITERS, InvalidDelimiter, read_metadata from .utils import read_node_data, write_json, read_config, read_lat_longs, read_colors def convert_tree_to_json_structure(node, metadata, div=0, strains=None): @@ -316,8 +316,6 @@ def add_core_args(parser): core.add_argument('--metadata', required=True, metavar="FILE", help="sequence metadata") core.add_argument('--metadata-delimiters', default=DEFAULT_DELIMITERS, nargs="+", help="delimiters to accept when reading a metadata file. Only one delimiter will be inferred.") - core.add_argument('--metadata-id-columns', default=DEFAULT_ID_COLUMNS, nargs="+", - help="names of possible metadata columns containing identifier information, ordered by priority. Only one ID column will be inferred.") core.add_argument('--node-data', required=True, nargs='+', action=ExtendAction, help="JSON files with meta data for each node") core.add_argument('--output-tree', help="JSON file name that is passed on to auspice (e.g., zika_tree.json).") core.add_argument('--output-meta', help="JSON file name that is passed on to auspice (e.g., zika_meta.json).") @@ -377,8 +375,7 @@ def run(args): try: meta_tsv = read_metadata( args.metadata, - delimiters=args.metadata_delimiters, - id_columns=args.metadata_id_columns) + delimiters=args.metadata_delimiters) except InvalidDelimiter: raise AugurError( f"Could not determine the delimiter of {args.metadata!r}. " From 9384b323aa57fafeac6ddaee4ade7c0779bf140a Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:59:08 -0700 Subject: [PATCH 3/3] Update changelog --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b15f28e66..1fd217d6e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,9 +5,12 @@ ### Bug fixes * export v2: Previously, when `strain` was not used as the metadata ID column, node attributes might have gone missing from the final Auspice JSON. This has been fixed. [#1260][], [#1262][] (@victorlin, @joverlee521) +* export v1: Added a deprecation warning for this command. [#1265][] (@victorlin) +* export v1: The recently introduced flag `--metadata-id-columns` did not work properly due to the same `export v2` bug that was fixed in this release. Instead of fixing it in `export v1`, drop the broken feature since this command is no longer being maintained. [#1265][] (@victorlin) [#1260]: https://github.com/nextstrain/augur/issues/1260 [#1262]: https://github.com/nextstrain/augur/issues/1262 +[#1265]: https://github.com/nextstrain/augur/pull/1265 ## 22.1.0 (10 July 2023)