|
2 | 2 | import luigi.worker
|
3 | 3 |
|
4 | 4 | from v03_pipeline.lib.model import DatasetType, ReferenceGenome, SampleType
|
| 5 | +from v03_pipeline.lib.paths import project_table_path |
5 | 6 | from v03_pipeline.lib.tasks.write_project_family_tables import (
|
6 | 7 | WriteProjectFamilyTablesTask,
|
7 | 8 | )
|
|
10 | 11 | TEST_SNV_INDEL_VCF = 'v03_pipeline/var/test/callsets/1kg_30variants.vcf'
|
11 | 12 | TEST_REMAP = 'v03_pipeline/var/test/remaps/test_remap_1.tsv'
|
12 | 13 | TEST_PEDIGREE_4 = 'v03_pipeline/var/test/pedigrees/test_pedigree_4.tsv'
|
| 14 | +TEST_PEDIGREE_4_SUBSET = 'v03_pipeline/var/test/pedigrees/test_pedigree_4_subset.tsv' |
13 | 15 |
|
14 | 16 |
|
15 | 17 | class WriteProjectFamilyTablesTest(MockedDatarootTestCase):
|
| 18 | + maxDiff = None |
| 19 | + |
16 | 20 | def test_snv_write_project_family_tables_task(self) -> None:
|
17 | 21 | worker = luigi.worker.Worker()
|
18 | 22 | write_project_family_tables = WriteProjectFamilyTablesTask(
|
@@ -51,3 +55,54 @@ def test_snv_write_project_family_tables_task(self) -> None:
|
51 | 55 | [['NA20888_1']],
|
52 | 56 | ],
|
53 | 57 | )
|
| 58 | + |
| 59 | + write_project_family_tables_subset = WriteProjectFamilyTablesTask( |
| 60 | + reference_genome=ReferenceGenome.GRCh38, |
| 61 | + dataset_type=DatasetType.SNV_INDEL, |
| 62 | + sample_type=SampleType.WGS, |
| 63 | + callset_path=TEST_SNV_INDEL_VCF, |
| 64 | + project_guid='R0113_test_project', |
| 65 | + project_remap_path=TEST_REMAP, |
| 66 | + project_pedigree_path=TEST_PEDIGREE_4_SUBSET, |
| 67 | + skip_validation=True, |
| 68 | + skip_check_sex_and_relatedness=True, |
| 69 | + ) |
| 70 | + worker.add(write_project_family_tables_subset) |
| 71 | + worker.run() |
| 72 | + self.assertTrue(write_project_family_tables_subset.complete()) |
| 73 | + hts = [ |
| 74 | + hl.read_table(write_family_table_task.output().path) |
| 75 | + for write_family_table_task in write_project_family_tables_subset.dynamic_write_family_table_tasks |
| 76 | + ] |
| 77 | + # Only one family table written |
| 78 | + self.assertEqual( |
| 79 | + len(hts), |
| 80 | + 1, |
| 81 | + ) |
| 82 | + # Project table still contains all family guids |
| 83 | + self.assertCountEqual( |
| 84 | + hl.read_table( |
| 85 | + project_table_path( |
| 86 | + ReferenceGenome.GRCh38, |
| 87 | + DatasetType.SNV_INDEL, |
| 88 | + 'R0113_test_project', |
| 89 | + ), |
| 90 | + ).family_guids.collect(), |
| 91 | + [ |
| 92 | + [ |
| 93 | + '123_1', |
| 94 | + '234_1', |
| 95 | + '345_1', |
| 96 | + '456_1', |
| 97 | + '567_1', |
| 98 | + '678_1', |
| 99 | + '789_1', |
| 100 | + '890_1', |
| 101 | + '901_1', |
| 102 | + 'bcd_1', |
| 103 | + 'cde_1', |
| 104 | + 'def_1', |
| 105 | + 'efg_1', |
| 106 | + ], |
| 107 | + ], |
| 108 | + ) |
0 commit comments