-
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.
filter: Read a subset of metadata columns
Before these changes, all columns were read into memory even if they were not used for actual filtering. The only reason was because metadata-based outputs were created from the in-memory representation of metadata. An earlier commit switched to creating those outputs by doing another pass of the original metadata. That means there is no longer a need to have all columns in memory.
- Loading branch information
Showing
7 changed files
with
136 additions
and
22 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
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
46 changes: 46 additions & 0 deletions
46
tests/functional/filter/cram/filter-query-incomplete-columns.t
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,46 @@ | ||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Create metadata file for testing. | ||
|
||
$ cat >metadata.tsv <<~~ | ||
> strain coverage category | ||
> SEQ_1 0.94 A | ||
> SEQ_2 0.95 B | ||
> SEQ_3 0.96 C | ||
> SEQ_4 | ||
> ~~ | ||
|
||
--query-columns must be all-or-nothing. | ||
|
||
Automatic inference works. | ||
|
||
$ ${AUGUR} filter \ | ||
> --metadata metadata.tsv \ | ||
> --query "coverage >= 0.95 & category == 'B'" \ | ||
> --output-strains filtered_strains.txt | ||
3 strains were dropped during filtering | ||
3 of these were filtered out by the query: "coverage >= 0.95 & category == 'B'" | ||
1 strains passed all filters | ||
|
||
An incomplete --query-columns does not work. | ||
|
||
$ ${AUGUR} filter \ | ||
> --metadata metadata.tsv \ | ||
> --query "coverage >= 0.95 & category == 'B'" \ | ||
> --query-columns coverage:float \ | ||
> --output-strains filtered_strains.txt | ||
ERROR: Query contains an invalid variable. Either (1) a queried column is missing from the metadata, or (2) you are using --query-columns but did not specify all columns. | ||
[2] | ||
|
||
It works again when all columns are specified. | ||
|
||
$ ${AUGUR} filter \ | ||
> --metadata metadata.tsv \ | ||
> --query "coverage >= 0.95 & category == 'B'" \ | ||
> --query-columns coverage:float category:str \ | ||
> --output-strains filtered_strains.txt | ||
3 strains were dropped during filtering | ||
3 of these were filtered out by the query: "coverage >= 0.95 & category == 'B'" | ||
1 strains passed all filters |
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