Skip to content

Commit 98cffbb

Browse files
committed
try sharing these params?
1 parent 96342b7 commit 98cffbb

File tree

4 files changed

+42
-24
lines changed

4 files changed

+42
-24
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import luigi
2+
3+
from v03_pipeline.lib.model import SampleType
4+
5+
6+
class BaseLoadingParams(luigi.Task):
7+
# NB:
8+
# These params are "inherited" with the special
9+
# luigi.util.inherits function, copying params
10+
# but nothing else.
11+
sample_type = luigi.EnumParameter(enum=SampleType)
12+
callset_path = luigi.Parameter()
13+
imputed_sex_path = luigi.Parameter(
14+
default=None,
15+
description='Optional path to a tsv of imputed sex values from the DRAGEN GVS pipeline.',
16+
)
17+
filters_path = luigi.Parameter(
18+
default=None,
19+
description='Optional path to part two outputs from callset (VCF shards containing filter information)',
20+
)
21+
validate = luigi.BoolParameter(
22+
default=True,
23+
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
24+
)
25+
force = luigi.BoolParameter(
26+
default=False,
27+
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
28+
)
29+
check_sex_and_relatedness = luigi.BoolParameter(
30+
default=False,
31+
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
32+
)

v03_pipeline/lib/tasks/write_imported_callset.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,25 @@
1515
validate_sample_type,
1616
)
1717
from v03_pipeline.lib.misc.vets import annotate_vets
18-
from v03_pipeline.lib.model import CachedReferenceDatasetQuery, SampleType
18+
from v03_pipeline.lib.model import CachedReferenceDatasetQuery
1919
from v03_pipeline.lib.model.environment import Env
2020
from v03_pipeline.lib.paths import (
2121
cached_reference_dataset_query_path,
2222
imported_callset_path,
2323
sex_check_table_path,
2424
)
25+
from v03_pipeline.lib.tasks.base.base_loading_params import BaseLoadingParams
2526
from v03_pipeline.lib.tasks.base.base_write import BaseWriteTask
2627
from v03_pipeline.lib.tasks.files import CallsetTask, GCSorLocalTarget, HailTableTask
2728
from v03_pipeline.lib.tasks.reference_data.updated_cached_reference_dataset_query import (
2829
UpdatedCachedReferenceDatasetQuery,
2930
)
3031
from v03_pipeline.lib.tasks.write_sex_check_table import WriteSexCheckTableTask
3132

33+
luigi.util.inherits(BaseLoadingParams)
3234

33-
class WriteImportedCallsetTask(BaseWriteTask):
34-
sample_type = luigi.EnumParameter(enum=SampleType)
35-
callset_path = luigi.Parameter()
36-
imputed_sex_path = luigi.Parameter(default=None)
37-
filters_path = luigi.OptionalParameter(default=None)
38-
validate = luigi.BoolParameter(
39-
default=True,
40-
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
41-
)
42-
force = luigi.BoolParameter(
43-
default=False,
44-
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
45-
)
46-
check_sex_and_relatedness = luigi.BoolParameter(
47-
default=False,
48-
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
49-
)
5035

36+
class WriteImportedCallsetTask(BaseWriteTask):
5137
def complete(self) -> luigi.Target:
5238
if not self.force and super().complete():
5339
mt = hl.read_matrix_table(self.output().path)
@@ -76,7 +62,10 @@ def requires(self) -> list[luigi.Task]:
7662
requirements = [
7763
*requirements,
7864
(
79-
self.clone(UpdatedCachedReferenceDatasetQuery, crdq=CachedReferenceDatasetQuery.GNOMAD_CODING_AND_NONCODING_VARIANTS),
65+
self.clone(
66+
UpdatedCachedReferenceDatasetQuery,
67+
crdq=CachedReferenceDatasetQuery.GNOMAD_CODING_AND_NONCODING_VARIANTS,
68+
)
8069
if Env.REFERENCE_DATA_AUTO_UPDATE
8170
else HailTableTask(
8271
cached_reference_dataset_query_path(

v03_pipeline/lib/tasks/write_relatedness_check_table.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def requires(self) -> luigi.Task:
3333
WriteImportedCallsetTask(
3434
self.reference_genome,
3535
self.dataset_type,
36-
self.sample_type,
3736
self.callset_path,
3837
),
3938
]

v03_pipeline/lib/tasks/write_sex_check_table.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ def output(self) -> luigi.Target:
2121
)
2222

2323
def requires(self) -> luigi.Task:
24-
return [
25-
RawFileTask(self.imputed_sex_path),
26-
]
24+
return RawFileTask(self.imputed_sex_path)
2725

2826
def create_table(self) -> hl.Table:
29-
return import_imputed_sex(self.input()[0].path)
27+
return import_imputed_sex(self.input().path)

0 commit comments

Comments
 (0)