Skip to content

Commit 0270a88

Browse files
committed
formalize
1 parent f1a8e63 commit 0270a88

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

v03_pipeline/lib/model/dataset_type.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import hail as hl
55

66
from v03_pipeline.lib.annotations import gcnv, mito, shared, snv_indel, sv
7-
from v03_pipeline.lib.model.definitions import ReferenceGenome
7+
from v03_pipeline.lib.model.definitions import ReferenceGenome, SampleType
88

99
MITO_MIN_HOM_THRESHOLD = 0.95
1010
ZERO = 0.0
@@ -155,6 +155,12 @@ def has_gencode_ensembl_to_refseq_id_mapping(
155155
self == DatasetType.SNV_INDEL and reference_genome == ReferenceGenome.GRCh38
156156
)
157157

158+
def expect_filters(
159+
self,
160+
sample_type: SampleType,
161+
) -> bool:
162+
return self == DatasetType.SNV_INDEL and sample_type == SampleType.WES
163+
158164
@property
159165
def has_gencode_gene_symbol_to_gene_id_mapping(self) -> bool:
160166
return self == DatasetType.SV

v03_pipeline/lib/paths.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ def valid_filters_path(
223223
) -> str | None:
224224
if (
225225
not Env.EXPECT_WES_FILTERS
226-
or dataset_type != DatasetType.SNV_INDEL
227-
or sample_type != SampleType.WES
226+
or not dataset_type.expect_filters(sample_type)
228227
or 'part_one_outputs' not in callset_path
229228
):
230229
return None

v03_pipeline/lib/tasks/write_imported_callset.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
validate_sample_type,
1717
)
1818
from v03_pipeline.lib.misc.vets import annotate_vets
19-
from v03_pipeline.lib.model import CachedReferenceDatasetQuery, DatasetType, SampleType
19+
from v03_pipeline.lib.model import CachedReferenceDatasetQuery
2020
from v03_pipeline.lib.model.environment import Env
2121
from v03_pipeline.lib.paths import (
2222
cached_reference_dataset_query_path,
@@ -56,8 +56,7 @@ def requires(self) -> list[luigi.Task]:
5656
requirements = []
5757
if (
5858
Env.EXPECT_WES_FILTERS
59-
and self.dataset_type == DatasetType.SNV_INDEL
60-
and self.sample_type == SampleType.WES
59+
and self.dataset_type.expect_filters(self.sample_type)
6160
):
6261
requirements = [
6362
*requirements,

0 commit comments

Comments
 (0)