When executing the workflow using my ambient nextstrain conda environment, I get the following error:
$ nextstrain build --ambient . --configfile config/config.yaml --config data_provenances=gisaid variant_classification=nextstrain_clades geo_resolutions=global
...
# Relevant snakemake rule:
python -u ./scripts/run-mlr-model.py --config config/mlr-config.yaml --seq-path data/gisaid/nextstrain_clades/global/prepared_seq_counts.tsv --export-path results/gisaid/nextstrain_clades/global/mlr --pivot '22B (Omicron)' --data-name 2023-05-03 2>&1 | tee logs/gisaid/nextstrain_clades/global/mlr/2023-05-03.txt
# Fails with:
sample: 100%|██████████| 400/400 [00:31<00:00, 12.75it/s, 511 steps of size 7.34e-03. acc. prob=0.94]
Traceback (most recent call last):
File "/Users/corneliusromer/code/forecasts-ncov/./scripts/run-mlr-model.py", line 272, in <module>
multi_posterior = fit_models(
File "/Users/corneliusromer/code/forecasts-ncov/./scripts/run-mlr-model.py", line 151, in fit_models
posterior.save_posterior(f"{path}/models/{location}.json")
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/site-packages/evofr/posterior/posterior_handler.py", line 37, in save_posterior
json.dump(self.samples, file, cls=EvofrEncoder)
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/site-packages/evofr/posterior/posterior_helpers.py", line 163, in default
return json.JSONEncoder.default(self, obj)
File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ArrayImpl is not JSON serializable