@@ -71,53 +71,52 @@ def update_table(self, ht: hl.Table) -> hl.Table:
71
71
72
72
# Union with the new variants table and annotate with the lookup table.
73
73
ht = ht .union (new_variants_ht , unify = True )
74
- if self .dataset_type .variant_frequency_annotation_fns :
75
- callset_ht = get_callset_ht (
74
+ callset_ht = get_callset_ht (
75
+ self .reference_genome ,
76
+ self .dataset_type ,
77
+ self .callset_path ,
78
+ self .project_guids ,
79
+ )
80
+ lookup_ht = None
81
+ if self .dataset_type .has_lookup_table :
82
+ lookup_ht = hl .read_table (
83
+ lookup_table_path (
84
+ self .reference_genome ,
85
+ self .dataset_type ,
86
+ ),
87
+ )
88
+ # Variants may have fallen out of the callset and
89
+ # have been removed from the lookup table during modification.
90
+ # Ensure we don't proceed with those variants.
91
+ ht = ht .semi_join (lookup_ht )
92
+ elif self .dataset_type .gt_stats_from_hl_call_stats :
93
+ callset_mt = get_callset_mt (
76
94
self .reference_genome ,
77
95
self .dataset_type ,
78
96
self .callset_path ,
79
97
self .project_guids ,
80
98
)
81
- lookup_ht = None
82
- if self .dataset_type .has_lookup_table :
83
- lookup_ht = hl .read_table (
84
- lookup_table_path (
85
- self .reference_genome ,
86
- self .dataset_type ,
87
- ),
88
- )
89
- # Variants may have fallen out of the callset and
90
- # have been removed from the lookup table during modification.
91
- # Ensure we don't proceed with those variants.
92
- ht = ht .semi_join (lookup_ht )
93
- elif self .dataset_type .gt_stats_from_hl_call_stats :
94
- callset_mt = get_callset_mt (
95
- self .reference_genome ,
96
- self .dataset_type ,
97
- self .callset_path ,
98
- self .project_guids ,
99
- )
100
- callset_mt = callset_mt .annotate_rows (
101
- gt_stats = hl .agg .call_stats (callset_mt .GT , callset_mt .alleles ),
102
- )
103
- callset_ht = callset_mt .rows ()
104
-
105
- # new_variants_ht consists of variants present in the new callset, fully annotated,
106
- # but NOT present in the existing annotations table.
107
- # callset_variants_ht consists of variants present in the new callset, fully annotated,
108
- # and either present or not present in the existing annotations table.
109
- callset_variants_ht = ht .semi_join (callset_ht )
110
- non_callset_variants_ht = ht .anti_join (callset_ht )
111
- callset_variants_ht = callset_variants_ht .annotate (
112
- ** get_fields (
113
- callset_variants_ht ,
114
- self .dataset_type .variant_frequency_annotation_fns ,
115
- lookup_ht = lookup_ht ,
116
- callset_ht = callset_ht ,
117
- ** self .param_kwargs ,
118
- ),
99
+ callset_mt = callset_mt .annotate_rows (
100
+ gt_stats = hl .agg .call_stats (callset_mt .GT , callset_mt .alleles ),
119
101
)
120
- ht = non_callset_variants_ht .union (callset_variants_ht , unify = True )
102
+ callset_ht = callset_mt .rows ()
103
+
104
+ # new_variants_ht consists of variants present in the new callset, fully annotated,
105
+ # but NOT present in the existing annotations table.
106
+ # callset_variants_ht consists of variants present in the new callset, fully annotated,
107
+ # and either present or not present in the existing annotations table.
108
+ callset_variants_ht = ht .semi_join (callset_ht )
109
+ non_callset_variants_ht = ht .anti_join (callset_ht )
110
+ callset_variants_ht = callset_variants_ht .annotate (
111
+ ** get_fields (
112
+ callset_variants_ht ,
113
+ self .dataset_type .variant_frequency_annotation_fns ,
114
+ lookup_ht = lookup_ht ,
115
+ callset_ht = callset_ht ,
116
+ ** self .param_kwargs ,
117
+ ),
118
+ )
119
+ ht = non_callset_variants_ht .union (callset_variants_ht , unify = True )
121
120
new_variants_ht_globals = new_variants_ht .index_globals ()
122
121
return ht .select_globals (
123
122
versions = new_variants_ht_globals .versions ,
0 commit comments