diff --git a/augur/support/filter/io.py b/augur/support/filter/io.py index ab761a54c..9b139bbca 100644 --- a/augur/support/filter/io.py +++ b/augur/support/filter/io.py @@ -41,7 +41,8 @@ def filter_kwargs_to_str(kwargs): str : String representation of the kwargs for reporting. - + >>> from augur.dates import numeric_date + >>> from augur.support.filter.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]) diff --git a/augur/support/filter/rules.py b/augur/support/filter/rules.py index d1f2cdb7f..9f06f001d 100644 --- a/augur/support/filter/rules.py +++ b/augur/support/filter/rules.py @@ -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') @@ -409,6 +411,8 @@ def include(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') diff --git a/augur/support/filter/subsample.py b/augur/support/filter/subsample.py index 70b7f8267..0bfe30f32 100644 --- a/augur/support/filter/subsample.py +++ b/augur/support/filter/subsample.py @@ -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.support.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. @@ -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.support.filter.subsample.TooManyGroupsError: Asked to provide at most 1 sequences, but there are 2 groups. """ if len(sequence_lengths) > target_max_value: