Skip to content

Commit e5b446d

Browse files
committed
reformat filters annotation
1 parent 41a23a5 commit e5b446d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

v03_pipeline/lib/misc/io.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ def import_callset(
121121
callset_path: str,
122122
reference_genome: ReferenceGenome,
123123
dataset_type: DatasetType,
124-
filters_path: str | None = None,
125124
) -> hl.MatrixTable:
126125
if dataset_type == DatasetType.GCNV:
127126
mt = import_gcnv_bed_file(callset_path)
@@ -131,9 +130,6 @@ def import_callset(
131130
mt = hl.read_matrix_table(callset_path)
132131
if dataset_type == DatasetType.SV:
133132
mt = mt.annotate_rows(variant_id=mt.rsid)
134-
if filters_path:
135-
filters_ht = import_vcf(filters_path, reference_genome).rows()
136-
mt = mt.annotate_rows(filters=filters_ht[mt.row_key].filters)
137133
return mt.key_rows_by(*dataset_type.table_key_type(reference_genome).fields)
138134

139135

v03_pipeline/lib/tasks/write_imported_callset.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from v03_pipeline.lib.misc.io import (
66
import_callset,
7+
import_vcf,
78
select_relevant_fields,
89
split_multi_hts,
910
)
@@ -117,17 +118,22 @@ def additional_row_fields(self, mt):
117118
}
118119

119120
def create_table(self) -> hl.MatrixTable:
120-
filters_path = valid_filters_path(
121-
self.dataset_type,
122-
self.sample_type,
123-
self.callset_path,
124-
)
125121
mt = import_callset(
126122
self.callset_path,
127123
self.reference_genome,
128124
self.dataset_type,
129-
filters_path,
130125
)
126+
filters_path = None
127+
if not self.skip_expect_filters and self.dataset_type.expect_filters(
128+
self.sample_type,
129+
):
130+
filters_path = valid_filters_path(
131+
self.dataset_type,
132+
self.sample_type,
133+
self.callset_path,
134+
)
135+
filters_ht = import_vcf(filters_path, self.reference_genome).rows()
136+
mt = mt.annotate_rows(filters=filters_ht[mt.row_key].filters)
131137
mt = select_relevant_fields(
132138
mt,
133139
self.dataset_type,

0 commit comments

Comments
 (0)