Skip to content
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

filter: Fix support for numerical IDs with both metadata and sequences #1256

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@

* parse: Fix a bug where `--fix-dates` was always applied, with a default of `--fix-dates=monthfirst`. Now, running without `--fix-dates` will leave dates as-is. [#1247][] (@victorlin)
* `augur.io.open_file`: Previously, the docs described a type restriction on `path_or_buffer` but it was not enforced. It has been updated to allow all I/O classes, and is enforced at run-time. [#1250][] (@victorlin)
* filter: Fix a bug where data files consisting of only numerical strain names would not work when both `--metadata` and `--sequences` are passed. [#1256][] (@victorlin)

[#1146]: https://github.com/nextstrain/augur/pull/1146
[#1240]: https://github.com/nextstrain/augur/pull/1240
[#1247]: https://github.com/nextstrain/augur/issues/1247
[#1250]: https://github.com/nextstrain/augur/pull/1250
[#1256]: https://github.com/nextstrain/augur/pull/1256

## 22.0.3 (14 June 2023)

Expand Down
1 change: 1 addition & 0 deletions augur/filter/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def run(args):
sequence_index_path,
sep=SEQUENCE_INDEX_DELIMITER,
index_col=SEQUENCE_INDEX_ID_COLUMN,
dtype={SEQUENCE_INDEX_ID_COLUMN: "string"},
)

# Remove temporary index file, if it exists.
Expand Down
32 changes: 32 additions & 0 deletions tests/functional/filter/cram/filter-numerical-ids.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Setup

$ source "$TESTDIR"/_setup.sh

Create a pair of files with numerical strain IDs.

$ cat >metadata.tsv <<~~
> strain col1
> 1 A
> 2 B
> 3 C
> ~~
$ cat >sequences.fasta <<~~
> >1
> AAAA
> >2
> AAAA
> >3
> AAAA
> ~~

Test that nothing is filtered out due to missing sequence data.

$ ${AUGUR} filter \
> --metadata metadata.tsv \
> --sequences sequences.fasta \
> --output-strains filtered_strains.txt \
> > /dev/null 2>&1
$ sort filtered_strains.txt
1
2
3
Loading