Skip to content

Commit 834a010

Browse files
committed
Finish off task tests, they now pass!
1 parent d3ce2ee commit 834a010

File tree

4 files changed

+28
-60
lines changed

4 files changed

+28
-60
lines changed

v03_pipeline/lib/misc/lookup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ def join_lookup_hts(
146146
),
147147
)
148148
.when(
149-
hl.is_missing(ht_project_i), ht.project_stats.extend(ht.project_stats_1),
149+
hl.is_missing(ht_project_i),
150+
ht.project_stats.extend(ht.project_stats_1),
150151
)
151152
.when(
152153
hl.is_missing(ht.project_stats),

v03_pipeline/lib/tasks/update_lookup_table.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,21 @@ def initialize_table(self) -> hl.Table:
7070
[],
7171
hl.tstruct(
7272
**key_type,
73-
**{
74-
field: hl.tstruct()
75-
for field in self.dataset_type.sample_lookup_table_fields_and_genotype_filter_fns
76-
},
73+
project_stats=hl.tarray(
74+
hl.tarray(
75+
hl.tstruct(
76+
**{
77+
field: hl.tint32
78+
for field in self.dataset_type.lookup_table_fields_and_genotype_filter_fns
79+
}
80+
),
81+
),
82+
),
7783
),
7884
key=key_type.fields,
7985
globals=hl.Struct(
86+
project_guids=hl.empty_array(hl.tstr),
87+
project_families=hl.empty_dict(hl.tstr, hl.tarray(hl.tstr)),
8088
updates=hl.empty_set(hl.tstruct(callset=hl.tstr, project_guid=hl.tstr)),
8189
),
8290
)

v03_pipeline/lib/tasks/update_lookup_table_test.py

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ def test_update_sample_lookup_table_task(self) -> None:
3030
self.assertTrue(uslt_task.output().exists())
3131
self.assertTrue(uslt_task.complete())
3232
ht = hl.read_table(uslt_task.output().path)
33-
print(ht.globals.collect())
3433
self.assertEqual(
3534
ht.globals.collect(),
3635
[
3736
hl.Struct(
37+
project_guids=['R0113_test_project'],
38+
project_families={'R0113_test_project': ['abc_1']},
3839
updates={
3940
hl.Struct(callset=TEST_VCF, project_guid='R0113_test_project'),
4041
},
@@ -51,11 +52,7 @@ def test_update_sample_lookup_table_task(self) -> None:
5152
reference_genome='GRCh38',
5253
),
5354
alleles=['A', 'C'],
54-
ref_samples=hl.Struct(
55-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
56-
),
57-
het_samples=hl.Struct(R0113_test_project=set()),
58-
hom_samples=hl.Struct(R0113_test_project=set()),
55+
project_stats=[[hl.Struct(ref_samples=3, het_samples=0, hom_samples=0)]],
5956
),
6057
hl.Struct(
6158
locus=hl.Locus(
@@ -64,11 +61,7 @@ def test_update_sample_lookup_table_task(self) -> None:
6461
reference_genome='GRCh38',
6562
),
6663
alleles=['C', 'T'],
67-
ref_samples=hl.Struct(
68-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
69-
),
70-
het_samples=hl.Struct(R0113_test_project=set()),
71-
hom_samples=hl.Struct(R0113_test_project=set()),
64+
project_stats=[[hl.Struct(ref_samples=3, het_samples=0, hom_samples=0)]],
7265
),
7366
hl.Struct(
7467
locus=hl.Locus(
@@ -77,11 +70,7 @@ def test_update_sample_lookup_table_task(self) -> None:
7770
reference_genome='GRCh38',
7871
),
7972
alleles=['A', 'G'],
80-
ref_samples=hl.Struct(R0113_test_project=set()),
81-
het_samples=hl.Struct(R0113_test_project=set()),
82-
hom_samples=hl.Struct(
83-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
84-
),
73+
project_stats=[[hl.Struct(ref_samples=0, het_samples=0, hom_samples=3)]],
8574
),
8675
hl.Struct(
8776
locus=hl.Locus(
@@ -90,11 +79,7 @@ def test_update_sample_lookup_table_task(self) -> None:
9079
reference_genome='GRCh38',
9180
),
9281
alleles=['G', 'C'],
93-
ref_samples=hl.Struct(R0113_test_project={'HG00732_1'}),
94-
het_samples=hl.Struct(
95-
R0113_test_project={'HG00731_1', 'HG00733_1'},
96-
),
97-
hom_samples=hl.Struct(R0113_test_project=set()),
82+
project_stats=[[hl.Struct(ref_samples=1, het_samples=2, hom_samples=0)]],
9883
),
9984
hl.Struct(
10085
locus=hl.Locus(
@@ -103,11 +88,7 @@ def test_update_sample_lookup_table_task(self) -> None:
10388
reference_genome='GRCh38',
10489
),
10590
alleles=['C', 'T'],
106-
ref_samples=hl.Struct(
107-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
108-
),
109-
het_samples=hl.Struct(R0113_test_project=set()),
110-
hom_samples=hl.Struct(R0113_test_project=set()),
91+
project_stats=[[hl.Struct(ref_samples=3, het_samples=0, hom_samples=0)]],
11192
),
11293
hl.Struct(
11394
locus=hl.Locus(
@@ -116,11 +97,7 @@ def test_update_sample_lookup_table_task(self) -> None:
11697
reference_genome='GRCh38',
11798
),
11899
alleles=['C', 'T'],
119-
ref_samples=hl.Struct(
120-
R0113_test_project={'HG00731_1', 'HG00733_1'},
121-
),
122-
het_samples=hl.Struct(R0113_test_project={'HG00732_1'}),
123-
hom_samples=hl.Struct(R0113_test_project=set()),
100+
project_stats=[[hl.Struct(ref_samples=2, het_samples=1, hom_samples=0)]],
124101
),
125102
hl.Struct(
126103
locus=hl.Locus(
@@ -129,9 +106,7 @@ def test_update_sample_lookup_table_task(self) -> None:
129106
reference_genome='GRCh38',
130107
),
131108
alleles=['G', 'A'],
132-
ref_samples=hl.Struct(R0113_test_project={'HG00732_1'}),
133-
het_samples=hl.Struct(R0113_test_project={'HG00733_1'}),
134-
hom_samples=hl.Struct(R0113_test_project={'HG00731_1'}),
109+
project_stats=[[hl.Struct(ref_samples=1, het_samples=1, hom_samples=1)]],
135110
),
136111
hl.Struct(
137112
locus=hl.Locus(
@@ -140,11 +115,7 @@ def test_update_sample_lookup_table_task(self) -> None:
140115
reference_genome='GRCh38',
141116
),
142117
alleles=['G', 'A'],
143-
ref_samples=hl.Struct(
144-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
145-
),
146-
het_samples=hl.Struct(R0113_test_project=set()),
147-
hom_samples=hl.Struct(R0113_test_project=set()),
118+
project_stats=[[hl.Struct(ref_samples=3, het_samples=0, hom_samples=0)]],
148119
),
149120
hl.Struct(
150121
locus=hl.Locus(
@@ -153,11 +124,7 @@ def test_update_sample_lookup_table_task(self) -> None:
153124
reference_genome='GRCh38',
154125
),
155126
alleles=['G', 'A'],
156-
ref_samples=hl.Struct(
157-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
158-
),
159-
het_samples=hl.Struct(R0113_test_project=set()),
160-
hom_samples=hl.Struct(R0113_test_project=set()),
127+
project_stats=[[hl.Struct(ref_samples=3, het_samples=0, hom_samples=0)]],
161128
),
162129
hl.Struct(
163130
locus=hl.Locus(
@@ -166,11 +133,7 @@ def test_update_sample_lookup_table_task(self) -> None:
166133
reference_genome='GRCh38',
167134
),
168135
alleles=['C', 'T'],
169-
ref_samples=hl.Struct(
170-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
171-
),
172-
het_samples=hl.Struct(R0113_test_project=set()),
173-
hom_samples=hl.Struct(R0113_test_project=set()),
136+
project_stats=[[hl.Struct(ref_samples=3, het_samples=0, hom_samples=0)]],
174137
),
175138
hl.Struct(
176139
locus=hl.Locus(
@@ -179,11 +142,7 @@ def test_update_sample_lookup_table_task(self) -> None:
179142
reference_genome='GRCh38',
180143
),
181144
alleles=['A', 'G'],
182-
ref_samples=hl.Struct(R0113_test_project=set()),
183-
het_samples=hl.Struct(R0113_test_project=set()),
184-
hom_samples=hl.Struct(
185-
R0113_test_project={'HG00733_1', 'HG00732_1', 'HG00731_1'},
186-
),
145+
project_stats=[[hl.Struct(ref_samples=0, het_samples=0, hom_samples=3)]],
187146
),
188147
],
189148
)

v03_pipeline/lib/tasks/update_variant_annotations_table_with_new_samples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from v03_pipeline.lib.model import Env, ReferenceDatasetCollection
1111
from v03_pipeline.lib.paths import (
1212
remapped_and_subsetted_callset_path,
13-
sample_lookup_table_path,
13+
lookup_table_path,
1414
)
1515
from v03_pipeline.lib.reference_data.gencode.mapping_gene_ids import load_gencode
1616
from v03_pipeline.lib.tasks.base.base_variant_annotations_table import (

0 commit comments

Comments
 (0)