Skip to content

Commit 0f8bcb5

Browse files
committed
Done?
1 parent f69e782 commit 0f8bcb5

File tree

2 files changed

+53
-54
lines changed

2 files changed

+53
-54
lines changed

v03_pipeline/lib/annotations/fields_test.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,38 @@ def test_get_formatting_fields(self, mock_vep: Mock) -> None:
9393
expected_fields,
9494
)
9595

96-
def test_get_sample_lookup_table_fields(
96+
def test_get_lookup_table_fields(
9797
self,
9898
) -> None:
99-
sample_lookup_ht = hl.Table.parallelize(
99+
lookup_ht = hl.Table.parallelize(
100100
[
101101
{
102102
'locus': hl.Locus('chr1', 1, ReferenceGenome.GRCh38.value),
103103
'alleles': ['A', 'C'],
104-
'ref_samples': hl.Struct(project_1={'a', 'c'}),
105-
'het_samples': hl.Struct(project_1={'b', 'd'}),
106-
'hom_samples': hl.Struct(project_1={'e', 'f'}),
104+
'project_stats': [
105+
[
106+
hl.Struct(
107+
ref_samples=2,
108+
het_samples=2,
109+
hom_samples=2,
110+
),
111+
],
112+
],
107113
},
108114
],
109115
hl.tstruct(
110116
locus=hl.tlocus(ReferenceGenome.GRCh38.value),
111117
alleles=hl.tarray(hl.tstr),
112-
ref_samples=hl.tstruct(project_1=hl.tset(hl.tstr)),
113-
het_samples=hl.tstruct(project_1=hl.tset(hl.tstr)),
114-
hom_samples=hl.tstruct(project_1=hl.tset(hl.tstr)),
118+
project_stats=hl.tarray(
119+
hl.tarray(
120+
hl.tstruct(
121+
**{
122+
field: hl.tint32
123+
for field in DatasetType.SNV_INDEL.lookup_table_fields_and_genotype_filter_fns
124+
},
125+
),
126+
),
127+
),
115128
),
116129
key=('locus', 'alleles'),
117130
globals=hl.Struct(
@@ -130,8 +143,8 @@ def test_get_sample_lookup_table_fields(
130143
list(
131144
get_fields(
132145
ht,
133-
DatasetType.SNV_INDEL.sample_lookup_table_annotation_fns,
134-
sample_lookup_ht=sample_lookup_ht,
146+
DatasetType.SNV_INDEL.lookup_table_annotation_fns,
147+
lookup_ht=lookup_ht,
135148
dataset_type=DatasetType.SNV_INDEL,
136149
reference_genome=ReferenceGenome.GRCh38,
137150
).keys(),

v03_pipeline/lib/annotations/snv_indel_test.py

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hail as hl
44

55
from v03_pipeline.lib.annotations.snv_indel import gt_stats
6+
from v03_pipeline.lib.model import DatasetType
67

78

89
class SNVTest(unittest.TestCase):
@@ -25,57 +26,42 @@ def test_allele_count_annotations(self) -> None:
2526
[
2627
{
2728
'id': 0,
28-
'ref_samples': hl.Struct(
29-
project_1={'a', 'c'},
30-
project_2=set(),
31-
R0607_gregor_training_project_=set(),
32-
),
33-
'het_samples': hl.Struct(
34-
project_1={'b', 'd'},
35-
project_2=set(),
36-
R0607_gregor_training_project_=set(),
37-
),
38-
'hom_samples': hl.Struct(
39-
project_1={'e', 'f'},
40-
project_2=set(),
41-
R0607_gregor_training_project_={'l', 'm'},
42-
),
29+
'project_stats': [
30+
[
31+
hl.Struct(
32+
ref_samples=2,
33+
het_samples=2,
34+
hom_samples=2,
35+
),
36+
],
37+
[],
38+
],
4339
},
4440
{
4541
'id': 1,
46-
'ref_samples': hl.Struct(
47-
project_1={'a', 'b', 'c', 'd', 'e', 'f'},
48-
project_2=set(),
49-
R0607_gregor_training_project_={'l', 'm'},
50-
),
51-
'het_samples': hl.Struct(
52-
project_1=set(),
53-
project_2=set(),
54-
R0607_gregor_training_project_=set(),
55-
),
56-
'hom_samples': hl.Struct(
57-
project_1=set(),
58-
project_2=set(),
59-
R0607_gregor_training_project_=set(),
60-
),
42+
'project_stats': [
43+
[
44+
hl.Struct(
45+
ref_samples=6,
46+
het_samples=0,
47+
hom_samples=0,
48+
),
49+
],
50+
[],
51+
],
6152
},
6253
],
6354
hl.tstruct(
6455
id=hl.tint32,
65-
ref_samples=hl.tstruct(
66-
project_1=hl.tset(hl.tstr),
67-
project_2=hl.tset(hl.tstr),
68-
R0607_gregor_training_project_=hl.tset(hl.tstr),
69-
),
70-
het_samples=hl.tstruct(
71-
project_1=hl.tset(hl.tstr),
72-
project_2=hl.tset(hl.tstr),
73-
R0607_gregor_training_project_=hl.tset(hl.tstr),
74-
),
75-
hom_samples=hl.tstruct(
76-
project_1=hl.tset(hl.tstr),
77-
project_2=hl.tset(hl.tstr),
78-
R0607_gregor_training_project_=hl.tset(hl.tstr),
56+
project_stats=hl.tarray(
57+
hl.tarray(
58+
hl.tstruct(
59+
**{
60+
field: hl.tint32
61+
for field in DatasetType.SNV_INDEL.lookup_table_fields_and_genotype_filter_fns
62+
},
63+
),
64+
),
7965
),
8066
),
8167
key='id',

0 commit comments

Comments
 (0)