Remove output files. Useful when terminating midway through a loop of metadata chunks.

Convert a dictionary of kwargs to a JSON string for downstream reporting.

This structured string can be converted back into a Python data structure later for more sophisticated reporting by specific kwargs.

This function excludes data types from arguments like pandas DataFrames and also converts floating point numbers to a fixed precision for better readability and reproducibility.


kwargs (dict) – Dictionary of kwargs passed to a given filter function.


String representation of the kwargs for reporting.

Return type:



>>> 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])
'[["min_length", 27000]]'
>>> exclude_by = [(filter_by_date, {"max_date": numeric_date("2020-04-01"), "min_date": numeric_date("2020-03-01")})]
>>> filter_kwargs_to_str(exclude_by[0][1])
'[["max_date", 2020.25], ["min_date", 2020.17]]'