Skip to content

Commit a9593c4

Browse files
committed
Check for YAML config; create it if it doesn't exist.
1 parent d41a1cb commit a9593c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lovd/config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import yaml
1313

14+
1415
# ─── helper functions ───────────────────────────────────────────────────────────── ✦ ─
1516
#
1617
def load_acquisition_config() -> yaml.YAMLObject:
@@ -30,6 +31,16 @@ def load_acquisition_config() -> yaml.YAMLObject:
3031
if targets_path.exists():
3132
with open(targets_path, "r") as f:
3233
return yaml.safe_load(f)
34+
else:
35+
fp = Path("acquisition.yaml")
36+
fp.touch()
37+
with open(fp, "w") as f:
38+
data = {
39+
"target_gene_symbols": ["COL5A1", "MTHFR"],
40+
"email": "user@example.com",
41+
"user_agent": "My-Organization/1.0 (Purpose)"
42+
}
43+
yaml.safe_dump(data, f)
3344

3445
raise FileNotFoundError("`acquisition.yaml` not found in any parent directory.")
3546

0 commit comments

Comments
 (0)