Escape regexp metachars when using auspice_json_prefix as a wildcard constraint
Avoids accidentally treating the fixed string as a regex which could
lead to very weird Snakemake DAG issues when matching the "prefix"
wildcard.
# snakemake --profile nextstrain_profiles/nextstrain-gisaid all_regions
# to produce the final Auspice files!
+import re
import requests
import json
from workflow.lib.persistent_dict import PersistentDict, NoSuchEntryError
@@ -142,7 +143,7 @@ rule dated_json:
# hyphens but not special strings used for Nextstrain builds. Include
# the user-defined prefix as a constraint, so Snakemake does not parse
# parts of the actual build names as part of the prefix.
- prefix = config["auspice_json_prefix"],
+ prefix = re.escape(config["auspice_json_prefix"]),
build_name = r'(?:[-a-zA-Z0-9_](?!(tip-frequencies|\d{4}-\d{2}-\d{2})))+',
date = r"\d{4}-\d{2}-\d{2}"
conda: config["conda_environment"]
