Skip to content

Commit 1c7b0b2

Browse files
committed
Some renames
1 parent 7c60f39 commit 1c7b0b2

File tree

7 files changed

+47
-47
lines changed

7 files changed

+47
-47
lines changed

v03_pipeline/lib/misc/family_lookup.py renamed to v03_pipeline/lib/misc/lookup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from v03_pipeline.lib.model import DatasetType
44

55

6-
def compute_callset_family_lookup_ht(
6+
def compute_callset_lookup_ht(
77
dataset_type: DatasetType,
88
mt: hl.MatrixTable,
99
project_guid: str,
@@ -31,7 +31,7 @@ def compute_callset_family_lookup_ht(
3131
family_guid=fs[0].family_guid,
3232
**{
3333
field_name: hl.len(fs.filter(filter_fn))
34-
for field_name, filter_fn in dataset_type.family_lookup_table_fields_and_genotype_filter_fns.items()
34+
for field_name, filter_fn in dataset_type.lookup_table_fields_and_genotype_filter_fns.items()
3535
},
3636
),
3737
),
@@ -108,7 +108,7 @@ def remove_new_callset_family_guids(
108108
)
109109

110110

111-
def join_family_lookup_hts(
111+
def join_lookup_hts(
112112
ht: hl.Table,
113113
callset_ht: hl.Table,
114114
) -> hl.Table:

v03_pipeline/lib/misc/family_lookup_test.py renamed to v03_pipeline/lib/misc/lookup_test.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
import hail as hl
44

5-
from v03_pipeline.lib.misc.family_lookup import (
6-
compute_callset_family_lookup_ht,
7-
join_family_lookup_hts,
5+
from v03_pipeline.lib.misc.lookup import (
6+
compute_callsetlookup_ht,
7+
join_lookup_hts,
88
remove_new_callset_family_guids,
99
)
1010
from v03_pipeline.lib.model import DatasetType
1111

1212

13-
class SampleLookupTest(unittest.TestCase):
14-
def test_compute_callset_family_lookup_ht(self) -> None:
13+
class LookupTest(unittest.TestCase):
14+
def test_compute_callset_lookup_ht(self) -> None:
1515
mt = hl.MatrixTable.from_parts(
1616
rows={'variants': [1, 2]},
1717
cols={'s': ['a', 'b', 'c', 'd', 'e']},
@@ -23,13 +23,13 @@ def test_compute_callset_family_lookup_ht(self) -> None:
2323
},
2424
globals={'family_samples': {'2': ['a'], '1': ['b', 'c', 'd'], '3': ['e']}},
2525
)
26-
family_lookup_ht = compute_callset_family_lookup_ht(
26+
lookup_ht = compute_callset_lookup_ht(
2727
DatasetType.MITO,
2828
mt,
2929
'project_a',
3030
)
3131
self.assertCountEqual(
32-
family_lookup_ht.globals.collect(),
32+
lookup_ht.globals.collect(),
3333
[
3434
hl.Struct(
3535
family_samples={'1': ['b', 'c', 'd'], '2': ['a'], '3': ['e']},
@@ -39,7 +39,7 @@ def test_compute_callset_family_lookup_ht(self) -> None:
3939
],
4040
)
4141
self.assertCountEqual(
42-
family_lookup_ht.collect(),
42+
lookup_ht.collect(),
4343
[
4444
hl.Struct(
4545
row_idx=0,
@@ -89,7 +89,7 @@ def test_compute_callset_family_lookup_ht(self) -> None:
8989
)
9090

9191
def test_remove_new_callset_family_guids(self) -> None:
92-
family_lookup_ht = hl.Table.parallelize(
92+
lookup_ht = hl.Table.parallelize(
9393
[
9494
{
9595
'id': 0,
@@ -168,23 +168,23 @@ def test_remove_new_callset_family_guids(self) -> None:
168168
project_families={'project_a': ['1', '2', '3'], 'project_b': ['4']},
169169
),
170170
)
171-
family_lookup_ht = remove_new_callset_family_guids(
172-
family_lookup_ht,
171+
lookup_ht = remove_new_callset_family_guids(
172+
lookup_ht,
173173
'project_c',
174174
['2'],
175175
)
176-
family_lookup_ht = remove_new_callset_family_guids(
177-
family_lookup_ht,
176+
lookup_ht = remove_new_callset_family_guids(
177+
lookup_ht,
178178
'project_a',
179179
['3', '1'],
180180
)
181-
family_lookup_ht = remove_new_callset_family_guids(
182-
family_lookup_ht,
181+
lookup_ht = remove_new_callset_family_guids(
182+
lookup_ht,
183183
'project_b',
184184
['4'],
185185
)
186186
self.assertCountEqual(
187-
family_lookup_ht.globals.collect(),
187+
lookup_ht.globals.collect(),
188188
[
189189
hl.Struct(
190190
project_guids=['project_a', 'project_b'],
@@ -193,7 +193,7 @@ def test_remove_new_callset_family_guids(self) -> None:
193193
],
194194
)
195195
self.assertCountEqual(
196-
family_lookup_ht.collect(),
196+
lookup_ht.collect(),
197197
[
198198
hl.Struct(
199199
id=0,
@@ -224,7 +224,7 @@ def test_remove_new_callset_family_guids(self) -> None:
224224
],
225225
)
226226

227-
def test_join_family_lookup_hts_empty_table(self) -> None:
227+
def test_join_lookup_hts_empty_table(self) -> None:
228228
ht = hl.Table.parallelize(
229229
[],
230230
hl.tstruct(
@@ -310,7 +310,7 @@ def test_join_family_lookup_hts_empty_table(self) -> None:
310310
project_families={'project_a': ['1', '2', '3']},
311311
),
312312
)
313-
ht = join_family_lookup_hts(
313+
ht = join_lookup_hts(
314314
ht,
315315
callset_ht,
316316
)
@@ -373,7 +373,7 @@ def test_join_family_lookup_hts_empty_table(self) -> None:
373373
],
374374
)
375375

376-
def test_join_family_lookup_hts_new_project(self) -> None:
376+
def test_join_lookup_hts_new_project(self) -> None:
377377
ht = hl.Table.parallelize(
378378
[
379379
{
@@ -498,7 +498,7 @@ def test_join_family_lookup_hts_new_project(self) -> None:
498498
project_families={'project_c': ['1', '2']},
499499
),
500500
)
501-
ht = join_family_lookup_hts(
501+
ht = join_lookup_hts(
502502
ht,
503503
callset_ht,
504504
)
@@ -601,7 +601,7 @@ def test_join_family_lookup_hts_new_project(self) -> None:
601601
],
602602
)
603603

604-
def test_join_family_lookup_hts_existing_project(self) -> None:
604+
def test_join_lookup_hts_existing_project(self) -> None:
605605
ht = hl.Table.parallelize(
606606
[
607607
{
@@ -726,7 +726,7 @@ def test_join_family_lookup_hts_existing_project(self) -> None:
726726
project_families={'project_b': ['1', '2']},
727727
),
728728
)
729-
ht = join_family_lookup_hts(
729+
ht = join_lookup_hts(
730730
ht,
731731
callset_ht,
732732
)

v03_pipeline/lib/model/dataset_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def excluded_filters(self) -> hl.SetExpression:
113113
}[self]
114114

115115
@property
116-
def has_sample_lookup_table(self) -> bool:
116+
def has_lookup_table(self) -> bool:
117117
return self in {DatasetType.SNV_INDEL, DatasetType.MITO}
118118

119119
@property
@@ -143,7 +143,7 @@ def veppable(self) -> bool:
143143
return self == DatasetType.SNV_INDEL
144144

145145
@property
146-
def family_lookup_table_fields_and_genotype_filter_fns(
146+
def lookup_table_fields_and_genotype_filter_fns(
147147
self,
148148
) -> dict[str, Callable[[hl.StructExpression], hl.Expression]]:
149149
return {
@@ -269,7 +269,7 @@ def genotype_entry_annotation_fns(self) -> list[Callable[..., hl.Expression]]:
269269
}[self]
270270

271271
@property
272-
def sample_lookup_table_annotation_fns(self) -> list[Callable[..., hl.Expression]]:
272+
def lookup_table_annotation_fns(self) -> list[Callable[..., hl.Expression]]:
273273
return {
274274
DatasetType.SNV_INDEL: [
275275
snv_indel.gt_stats,

v03_pipeline/lib/paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def remapped_and_subsetted_callset_path(
140140
)
141141

142142

143-
def sample_lookup_table_path(
143+
def family_lookup_table_path(
144144
reference_genome: ReferenceGenome,
145145
dataset_type: DatasetType,
146146
) -> str:

v03_pipeline/lib/paths_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
project_table_path,
1515
relatedness_check_table_path,
1616
remapped_and_subsetted_callset_path,
17-
sample_lookup_table_path,
17+
family_lookup_table_path,
1818
sex_check_table_path,
1919
valid_cached_reference_dataset_query_path,
2020
valid_reference_dataset_collection_path,
@@ -83,9 +83,9 @@ def test_valid_reference_dataset_collection_path(self) -> None:
8383
'/seqr-reference-data-private/v03/GRCh38/SNV_INDEL/reference_datasets/hgmd.ht',
8484
)
8585

86-
def test_sample_lookup_table_path(self) -> None:
86+
def test_family_lookup_table_path(self) -> None:
8787
self.assertEqual(
88-
sample_lookup_table_path(
88+
family_lookup_table_path(
8989
ReferenceGenome.GRCh37,
9090
DatasetType.SV,
9191
),

v03_pipeline/lib/tasks/update_sample_lookup_table.py renamed to v03_pipeline/lib/tasks/update_lookup_table.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import hail as hl
22
import luigi
33

4-
from v03_pipeline.lib.misc.sample_lookup import (
5-
compute_callset_sample_lookup_ht,
6-
filter_callset_sample_ids,
7-
join_sample_lookup_hts,
4+
from v03_pipeline.lib.misc.family_lookup import (
5+
compute_callset_family_lookup_ht,
6+
remove_new_callset_family_guids,
7+
join_family_lookup_hts,
88
)
9-
from v03_pipeline.lib.paths import sample_lookup_table_path
9+
from v03_pipeline.lib.paths import family_lookup_table_path
1010
from v03_pipeline.lib.tasks.base.base_update_task import BaseUpdateTask
1111
from v03_pipeline.lib.tasks.files import GCSorLocalTarget
1212
from v03_pipeline.lib.tasks.write_remapped_and_subsetted_callset import (
1313
WriteRemappedAndSubsettedCallsetTask,
1414
)
1515

1616

17-
class UpdateSampleLookupTableTask(BaseUpdateTask):
17+
class UpdateFamilyLookupTableTask(BaseUpdateTask):
1818
callset_path = luigi.Parameter()
1919
project_guid = luigi.Parameter()
2020
project_remap_path = luigi.Parameter()
@@ -34,7 +34,7 @@ class UpdateSampleLookupTableTask(BaseUpdateTask):
3434

3535
def output(self) -> luigi.Target:
3636
return GCSorLocalTarget(
37-
sample_lookup_table_path(
37+
family_lookup_table_path(
3838
self.reference_genome,
3939
self.dataset_type,
4040
),
@@ -83,23 +83,23 @@ def initialize_table(self) -> hl.Table:
8383

8484
def update_table(self, ht: hl.Table) -> hl.Table:
8585
callset_mt = hl.read_matrix_table(self.input().path)
86-
ht = filter_callset_sample_ids(
87-
self.dataset_type,
86+
ht = remove_new_callset_family_guids(
8887
ht,
89-
callset_mt.cols(),
9088
self.project_guid,
89+
list(callset_mt.family_samples.collect()[0].keys()),
9190
)
92-
callset_sample_lookup_ht = compute_callset_sample_lookup_ht(
91+
callset_ht = compute_callset_family_lookup_ht(
9392
self.dataset_type,
9493
callset_mt,
94+
self.project_guid,
9595
)
9696
ht = join_sample_lookup_hts(
97-
self.dataset_type,
9897
ht,
99-
callset_sample_lookup_ht,
100-
self.project_guid,
98+
callset_ht,
10199
)
102100
return ht.select_globals(
101+
project_guids=ht.project_guids,
102+
project_families=ht.project_families,
103103
updates=ht.updates.add(
104104
hl.Struct(callset=self.callset_path, project_guid=self.project_guid),
105105
),

0 commit comments

Comments
 (0)