Skip to content

Commit

Permalink
Remove the requirement for a database field [#1511]
Browse files Browse the repository at this point in the history
Per discussion on #1508 and #1511, the field standardization across
records (cf #1510) makes the need to verify a `database` field less
important — essentially, if there's a `geo_loc_name` field (or a field
with the name given in the `--location-field` argument), parse it.
Otherwise, warn that it's not found.
  • Loading branch information
genehack committed Jul 2, 2024
1 parent 4264701 commit f1f05da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
18 changes: 4 additions & 14 deletions augur/curate/parse_genbank_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,8 @@ def run(
records: List[dict],
) -> Generator[dict, None, None]:
for record in records:
database = record.get("database", "")
if database in {"GenBank", "RefSeq"}:
parse_location(
record,
args.location_field,
)
else:
if database:
error_msg = f"""Database value of {database} not supported for `transform-genbank-location`; must be "GenBank" or "RefSeq"."""
else:
error_msg = "Record must contain `database` field to use `transform-genbank-location.`"

print_err(error_msg)

parse_location(
record,
args.location_field,
)
yield record
14 changes: 0 additions & 14 deletions tests/functional/curate/cram/parse-genbank-location/errors.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@ Setup

$ export AUGUR="${AUGUR:-$TESTDIR/../../../../../bin/augur}"

Records without a `database` field result in the expected warning

$ echo '{"geo_loc_name":"Canada:Vancouver"}' \
> | ${AUGUR} curate parse-genbank-location
Record must contain `database` field to use `transform-genbank-location.`
{"geo_loc_name": "Canada:Vancouver"}

Records with a `database` field with an unsupported value result in the expected warning

$ echo '{"geo_loc_name":"Canada:Vancouver", "database":"database"}' \
> | ${AUGUR} curate parse-genbank-location
Database value of database not supported for `transform-genbank-location`; must be "GenBank" or "RefSeq".
{"geo_loc_name": "Canada:Vancouver", "database": "database"}

Records without a `location` field result in the expected warning

$ echo '{"database":"GenBank"}' \
Expand Down

0 comments on commit f1f05da

Please sign in to comment.