Skip to content

Commit

Permalink
Update doctest references
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Jul 28, 2022
1 parent 4f369b3 commit a3fd02c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions augur/filter/include_exclude_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def filter_by_exclude(metadata, exclude_file):
Strains that pass the filter
>>> import os
>>> from tempfile import NamedTemporaryFile
>>> metadata = pd.DataFrame([{"region": "Africa"}, {"region": "Europe"}], index=["strain1", "strain2"])
>>> with NamedTemporaryFile(delete=False) as exclude_file:
... characters_written = exclude_file.write(b'strain1')
Expand Down Expand Up @@ -409,6 +411,8 @@ def force_include_strains(metadata, include_file):
Strains that pass the filter
>>> import os
>>> from tempfile import NamedTemporaryFile
>>> metadata = pd.DataFrame([{"region": "Africa"}, {"region": "Europe"}], index=["strain1", "strain2"])
>>> with NamedTemporaryFile(delete=False) as include_file:
... characters_written = include_file.write(b'strain1')
Expand Down
2 changes: 2 additions & 0 deletions augur/filter/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def filter_kwargs_to_str(kwargs):
String representation of the kwargs for reporting.
>>> from augur.dates import numeric_date
>>> from augur.filter.include_exclude_rules import filter_by_sequence_length, filter_by_date
>>> sequence_index = pd.DataFrame([{"strain": "strain1", "ACGT": 28000}, {"strain": "strain2", "ACGT": 26000}, {"strain": "strain3", "ACGT": 5000}]).set_index("strain")
>>> exclude_by = [(filter_by_sequence_length, {"sequence_index": sequence_index, "min_length": 27000})]
>>> filter_kwargs_to_str(exclude_by[0][1])
Expand Down
4 changes: 2 additions & 2 deletions augur/filter/subsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_groups_for_subsampling(strains, metadata, group_by=None):
>>> get_groups_for_subsampling(strains, metadata, group_by)
Traceback (most recent call last):
...
augur.filter.FilterException: The specified group-by categories (['missing_column']) were not found.
augur.filter.errors.FilterException: The specified group-by categories (['missing_column']) were not found.
If we try to group by some columns that exist and some that don't, we allow
grouping to continue and print a warning message to stderr.
Expand Down Expand Up @@ -406,7 +406,7 @@ def _calculate_sequences_per_group(
>>> _calculate_sequences_per_group(1, [4, 2])
Traceback (most recent call last):
...
augur.filter.TooManyGroupsError: Asked to provide at most 1 sequences, but there are 2 groups.
augur.filter.subsample.TooManyGroupsError: Asked to provide at most 1 sequences, but there are 2 groups.
"""

if len(sequence_lengths) > target_max_value:
Expand Down

0 comments on commit a3fd02c

Please sign in to comment.