Skip to content

tweak logic to prefer filter #810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions v03_pipeline/lib/misc/family_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ def remove_family_guids(
family_guids: hl.SetExpression,
) -> hl.Table:
# Remove families from the existing project table structure (both the entries arrays and the globals are mutated)
family_indexes_to_keep = hl.array(
family_indexes_to_keep = hl.set(
hl.enumerate(ht.globals.family_guids)
.filter(lambda item: ~family_guids.contains(item[1]))
.map(lambda item: item[0]),
)
ht = ht.annotate(
family_entries=family_indexes_to_keep.map(lambda i: ht.family_entries[i]),
family_entries=(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

experimenting shows this not mattering too much

hl.enumerate(ht.family_entries)
.filter(lambda item: family_indexes_to_keep.contains(item[0]))
.map(lambda item: item[1])
),
)
return ht.annotate_globals(
family_guids=ht.family_guids.filter(
Expand Down
14 changes: 7 additions & 7 deletions v03_pipeline/lib/misc/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,22 @@ def remove_project(
existing_project_guids = hl.eval(ht.globals.project_guids)
if project_guid not in existing_project_guids:
return ht
project_indexes_to_keep = (
project_indexes_to_keep = hl.set(
hl.enumerate(existing_project_guids)
.filter(lambda item: item[1] != project_guid)
.map(lambda item: item[0])
.map(lambda item: item[0]),
)
ht = ht.annotate(
project_stats=(
project_indexes_to_keep.map(
lambda i: ht.project_stats[i],
)
hl.enumerate(ht.project_stats)
.filter(lambda item: project_indexes_to_keep.contains(item[0]))
.map(lambda item: item[1])
),
)
ht = ht.filter(hl.any(ht.project_stats.map(hl.is_defined)))
return ht.annotate_globals(
project_guids=project_indexes_to_keep.map(
lambda i: ht.project_guids[i],
project_guids=ht.project_guids.filter(
lambda p: p != project_guid,
),
project_families=hl.dict(
ht.project_families.items().filter(lambda item: item[0] != project_guid),
Expand Down
Loading