Skip to content

Commit e67f7a9

Browse files
authored
Add protection against a user supplying the wrong sample type on a re-run. (#673)
* Add sample type to callset to ensure that it was supplied correctly * add sample type to imported callset * correct method * string fixes * hasattr * Fix syntax
1 parent 5754b81 commit e67f7a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

v03_pipeline/lib/tasks/write_imported_callset.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class WriteImportedCallsetTask(BaseWriteTask):
3131
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
3232
)
3333

34+
def complete(self) -> luigi.Target:
35+
if super().complete():
36+
mt = hl.read_matrix_table(self.output().path)
37+
return hasattr(mt, 'sample_type') and hl.eval(self.sample_type.value == mt.sample_type)
38+
return False
39+
3440
def output(self) -> luigi.Target:
3541
return GCSorLocalTarget(
3642
imported_callset_path(
@@ -97,4 +103,6 @@ def create_table(self) -> hl.MatrixTable:
97103
self.reference_genome,
98104
self.sample_type,
99105
)
100-
return mt
106+
return mt.annotate_globals(
107+
sample_type=self.sample_type.value,
108+
)

0 commit comments

Comments
 (0)