aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorzsloan2024-04-29 04:18:30 +0000
committerzsloan2024-04-29 04:18:58 +0000
commit515f80661d44427fe32914c5071905794a20b67b (patch)
treedaf383e6a609c57a1a688a3e8b32214bf76d7d7e /gn3
parentb1a39116c2f388ed4a78287c9cd613b12c87c498 (diff)
downloadgenenetwork3-515f80661d44427fe32914c5071905794a20b67b.tar.gz
Prevent error when group isn't in parents/f1s JSON file
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/datasets.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index 9a05890..fbeb756 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -26,10 +26,10 @@ def retrieve_sample_list(group: str, inc_par: bool = True, inc_f1: bool = True):
)
if par_f1_path.is_file():
with open(par_f1_path, encoding="utf-8") as par_f1_file:
- par_f1s = json.load(par_f1_file)[group]
- if inc_par:
+ par_f1s = json.load(par_f1_file).get(group, {})
+ if inc_par and par_f1s:
samplelist += [par_f1s['paternal']['strain'], par_f1s['maternal']['strain']]
- if inc_f1:
+ if inc_f1 and par_f1s:
samplelist += [f1['strain'] for f1 in par_f1s['f1s']]
genofile_path = Path(