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

Send filter warnings to stderr #862

Merged
merged 1 commit into from
Mar 11, 2022
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
4 changes: 2 additions & 2 deletions augur/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def construct_filters(args, sequence_index):
is_vcf = filename_is_vcf(args.sequences)

if is_vcf: #doesn't make sense for VCF, ignore.
print("WARNING: Cannot use min_length for VCF files. Ignoring...")
print("WARNING: Cannot use min_length for VCF files. Ignoring...", file=sys.stderr)
else:
exclude_by.append((
filter_by_sequence_length,
Expand Down Expand Up @@ -1744,7 +1744,7 @@ def calculate_sequences_per_group(target_max_value, counts_per_group, allow_prob
)
except TooManyGroupsError as error:
if allow_probabilistic:
print(f"WARNING: {error}")
print(f"WARNING: {error}", file=sys.stderr)
sequences_per_group = _calculate_fractional_sequences_per_group(
target_max_value,
counts_per_group,
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/filter.t
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Explicitly use probabilistic subsampling to handle the case when there are more
> --subsample-seed 314159 \
> --probabilistic-sampling \
> --output-strains "$TMP/filtered_strains_probabilistic.txt" > /dev/null
WARNING: Asked to provide at most 5 sequences, but there are 8 groups.

Using the default probabilistic subsampling, should work the same as the previous case.

Expand All @@ -113,6 +114,7 @@ Using the default probabilistic subsampling, should work the same as the previou
> --subsample-max-sequences 5 \
> --subsample-seed 314159 \
> --output-strains "$TMP/filtered_strains_default.txt" > /dev/null
WARNING: Asked to provide at most 5 sequences, but there are 8 groups.

By setting the subsample seed above, we should get the same results for both runs.

Expand Down Expand Up @@ -394,6 +396,7 @@ Strains with ambiguous years or months should be dropped and logged.
> --subsample-max-sequences 5 \
> --output-strains "$TMP/filtered_strains.txt" \
> --output-log "$TMP/filtered_log.tsv" > /dev/null
WARNING: Asked to provide at most 5 sequences, but there are 6 groups.
$ grep "SG_018" "$TMP/filtered_log.tsv" | cut -f 1-2
SG_018\tskip_group_by_with_ambiguous_month (esc)
$ grep "COL/FLR_00024/2015" "$TMP/filtered_log.tsv" | cut -f 1-2
Expand Down