Skip to content

Commit 57edcc6

Browse files
committed
this is cleaner!
1 parent 5d61a4e commit 57edcc6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

v03_pipeline/lib/misc/family_entries.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ def compute_callset_family_entries_ht(
5555

5656

5757
def globalize_ids(ht: hl.Table) -> hl.Table:
58-
row = ht.take(1)
59-
has_family_entries = row and len(row[0].family_entries) > 0
58+
row = ht.take(1)[0] if ht.count() > 0 else None
59+
has_family_entries = row and len(row.family_entries) > 0
6060
ht = ht.annotate_globals(
6161
family_guids=(
62-
[fe[0].family_guid for fe in row[0].family_entries]
62+
[fe[0].family_guid for fe in row.family_entries]
6363
if has_family_entries
6464
else hl.empty_array(hl.tstr)
6565
),
6666
family_samples=(
67-
{fe[0].family_guid: [e.s for e in fe] for fe in row[0].family_entries}
67+
{fe[0].family_guid: [e.s for e in fe] for fe in row.family_entries}
6868
if has_family_entries
6969
else hl.empty_dict(hl.tstr, hl.tarray(hl.tstr))
7070
),
@@ -141,7 +141,7 @@ def join_family_entries_hts(ht: hl.Table, callset_ht: hl.Table) -> hl.Table:
141141
.default(ht.family_entries.extend(ht.family_entries_1))
142142
),
143143
)
144-
# NB: transume because we want to drop the *_1 fields, but preserve other globals
144+
# NB: transmute because we want to drop the *_1 fields, but preserve other globals
145145
return ht.transmute_globals(
146146
family_guids=ht.family_guids.extend(ht.family_guids_1),
147147
family_samples=hl.dict(

v03_pipeline/lib/misc/lookup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def compute_callset_lookup_ht(
4242

4343

4444
def globalize_ids(ht: hl.Table, project_guid: str) -> hl.Table:
45-
row = ht.take(1)
46-
has_project_stats = row and len(row[0].project_stats) > 0
45+
row = ht.take(1)[0] if ht.count() > 0 else None
46+
has_project_stats = row and len(row.project_stats) > 0
4747
ht = ht.annotate_globals(
4848
project_guids=[project_guid],
4949
project_families=(

0 commit comments

Comments
 (0)