Skip to content

remove "ignore_missing_samples_when_subsetting" #803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions v03_pipeline/lib/misc/sample_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def remap_sample_ids(
def subset_samples(
mt: hl.MatrixTable,
sample_subset_ht: hl.Table,
ignore_missing_samples_when_subsetting: bool,
) -> hl.MatrixTable:
subset_count = sample_subset_ht.count()
anti_join_ht = sample_subset_ht.anti_join(mt.cols())
Expand All @@ -78,12 +77,7 @@ def subset_samples(
f"IDs that aren't in the callset: {missing_samples}\n"
f'All callset sample IDs:{mt.s.collect()}'
)
if (
subset_count > anti_join_ht_count
) and ignore_missing_samples_when_subsetting:
logger.info(message)
else:
raise MatrixTableSampleSetError(message, missing_samples)
raise MatrixTableSampleSetError(message, missing_samples)
logger.info(f'Subsetted to {subset_count} sample ids')
mt = mt.semi_join_cols(sample_subset_ht)
return mt.filter_rows(hl.agg.any(hl.is_defined(mt.GT)))
29 changes: 0 additions & 29 deletions v03_pipeline/lib/misc/sample_ids_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,32 +106,6 @@ def test_remap_sample_ids_remap_has_missing_samples(self) -> None:
ignore_missing_samples_when_remapping=False,
)

def test_subset_samples(self):
# subset 2 of 3 samples in callset
sample_subset_ht = hl.Table.parallelize(
[
{'s': 'HG00731'},
{'s': 'HG00732'},
],
hl.tstruct(s=hl.tstr),
key='s',
)

subset_mt = subset_samples(
CALLSET_MT,
sample_subset_ht,
ignore_missing_samples_when_subsetting=True,
)

self.assertEqual(subset_mt.cols().count(), 2)
self.assertEqual(
subset_mt.cols().collect(),
[
hl.Struct(col_idx=0, s='HG00731'),
hl.Struct(col_idx=1, s='HG00732'),
],
)

def test_subset_samples_zero_samples(self):
# subset 0 of 3 samples in callset
sample_subset_ht = hl.Table.parallelize(
Expand All @@ -144,7 +118,6 @@ def test_subset_samples_zero_samples(self):
subset_samples(
CALLSET_MT,
sample_subset_ht,
ignore_missing_samples_when_subsetting=True,
)

def test_subset_samples_missing_samples(self):
Expand All @@ -163,7 +136,6 @@ def test_subset_samples_missing_samples(self):
subset_samples(
CALLSET_MT,
sample_subset_ht,
ignore_missing_samples_when_subsetting=False,
)

def test_subset_no_defined_gt(self):
Expand All @@ -187,6 +159,5 @@ def test_subset_no_defined_gt(self):
mt = subset_samples(
mt,
sample_subset_ht,
False,
)
self.assertEqual(mt.count(), (1, 1))
5 changes: 0 additions & 5 deletions v03_pipeline/lib/tasks/update_lookup_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ class UpdateLookupTableTask(BaseUpdateLookupTableTask):
project_remap_paths = luigi.ListParameter()
project_pedigree_paths = luigi.ListParameter()
imputed_sex_paths = luigi.ListParameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -84,7 +80,6 @@ def requires(self) -> list[luigi.Task]:
project_remap_path,
project_pedigree_path,
imputed_sex_path,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
False,
Expand Down
5 changes: 0 additions & 5 deletions v03_pipeline/lib/tasks/update_project_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ class UpdateProjectTableTask(BaseUpdateProjectTableTask):
project_remap_path = luigi.Parameter()
project_pedigree_path = luigi.Parameter()
imputed_sex_path = luigi.Parameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -62,7 +58,6 @@ def requires(self) -> luigi.Task:
self.project_remap_path,
self.project_pedigree_path,
self.imputed_sex_path,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ class UpdateVariantAnnotationsTableWithNewSamplesTask(
project_remap_paths = luigi.ListParameter()
project_pedigree_paths = luigi.ListParameter()
imputed_sex_paths = luigi.ListParameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -55,7 +51,6 @@ def requires(self) -> list[luigi.Task]:
self.project_remap_paths,
self.project_pedigree_paths,
self.imputed_sex_paths,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
self.force,
Expand Down
4 changes: 0 additions & 4 deletions v03_pipeline/lib/tasks/write_family_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class WriteFamilyTableTask(BaseWriteTask):
project_remap_path = luigi.Parameter()
project_pedigree_path = luigi.Parameter()
imputed_sex_path = luigi.Parameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
Expand Down Expand Up @@ -61,7 +58,6 @@ def requires(self) -> luigi.Task:
self.project_remap_path,
self.project_pedigree_path,
self.imputed_sex_path,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
False,
Expand Down
5 changes: 0 additions & 5 deletions v03_pipeline/lib/tasks/write_metadata_for_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ class WriteMetadataForRunTask(BaseHailTableTask):
project_remap_paths = luigi.ListParameter()
project_pedigree_paths = luigi.ListParameter()
imputed_sex_paths = luigi.ListParameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -63,7 +59,6 @@ def requires(self) -> list[luigi.Task]:
project_remap_path,
project_pedigree_path,
imputed_sex_path,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
self.force,
Expand Down
6 changes: 0 additions & 6 deletions v03_pipeline/lib/tasks/write_new_variants_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ class WriteNewVariantsTableTask(BaseWriteTask):
project_remap_paths = luigi.ListParameter()
project_pedigree_paths = luigi.ListParameter()
imputed_sex_paths = luigi.ListParameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -112,7 +108,6 @@ def requires(self) -> list[luigi.Task]:
self.project_remap_paths,
self.project_pedigree_paths,
self.imputed_sex_paths,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
self.force,
Expand All @@ -131,7 +126,6 @@ def requires(self) -> list[luigi.Task]:
project_remap_path,
project_pedigree_path,
imputed_sex_path,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
False,
Expand Down
5 changes: 0 additions & 5 deletions v03_pipeline/lib/tasks/write_project_family_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class WriteProjectFamilyTablesTask(BaseHailTableTask):
project_remap_path = luigi.Parameter()
project_pedigree_path = luigi.Parameter()
imputed_sex_path = luigi.Parameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -58,7 +54,6 @@ def run(self):
self.project_remap_path,
self.project_pedigree_path,
self.imputed_sex_path,
self.ignore_missing_samples_when_subsetting,
self.ignore_missing_samples_when_remapping,
self.validate,
False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ class WriteRemappedAndSubsettedCallsetTask(BaseWriteTask):
project_remap_path = luigi.Parameter()
project_pedigree_path = luigi.Parameter()
imputed_sex_path = luigi.Parameter(default=None)
ignore_missing_samples_when_subsetting = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
)
ignore_missing_samples_when_remapping = luigi.BoolParameter(
default=False,
parsing=luigi.BoolParameter.EXPLICIT_PARSING,
Expand Down Expand Up @@ -178,7 +174,6 @@ def create_table(self) -> hl.MatrixTable:
hl.tstruct(s=hl.dtype('str')),
key='s',
),
self.ignore_missing_samples_when_subsetting,
)
# Drop additional fields imported onto the intermediate callsets but
# not used when creating the downstream optimized tables.
Expand Down
Loading