Skip to content

Commit 141ea1b

Browse files
committed
Merge branch 'main' of github.com:broadinstitute/seqr-loading-pipelines into dev
2 parents 404c609 + 35b2615 commit 141ea1b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

v03_pipeline/lib/methods/sex_check.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
AMBIGUOUS_THRESHOLD_PERC: float = 0.01 # Fraction of samples identified as "ambiguous_sex" above which an error will be thrown.
1515
AAF_THRESHOLD: float = 0.05 # Alternate allele frequency threshold for `hl.impute_sex`.
16+
BIALLELIC: int = 2
1617
XX_FSTAT_THRESHOLD: float = (
1718
0.5 # F-stat threshold below which a sample will be called XX
1819
)
@@ -24,7 +25,9 @@
2425
def call_sex(mt: hl.MatrixTable) -> hl.Table:
2526
# Filter to SNVs and biallelics
2627
# NB: We should already have filtered biallelics, but just in case.
27-
mt = mt.filter_rows(hl.is_snp(mt.alleles[0], mt.alleles[1]))
28+
mt = mt.filter_rows(
29+
(hl.len(mt.alleles) == BIALLELIC) & hl.is_snp(mt.alleles[0], mt.alleles[1]),
30+
)
2831

2932
# Filter to PASS variants only (variants with empty or missing filter set)
3033
mt = mt.filter_rows(

v03_pipeline/lib/tasks/update_variant_annotations_table_with_new_samples.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ def update_table(self, ht: hl.Table) -> hl.Table:
188188
self.project_pedigree_paths,
189189
)
190190
]
191+
192+
# Drop any fields potentially unshared/unused by the annotations.
193+
for i, callset_ht in enumerate(callset_hts):
194+
for row_field in self.dataset_type.optional_row_fields:
195+
if hasattr(callset_ht, row_field):
196+
callset_hts[i] = callset_ht.drop(row_field)
197+
191198
callset_ht = functools.reduce(
192199
(lambda ht1, ht2: ht1.union(ht2, unify=True)),
193200
callset_hts,

v03_pipeline/lib/tasks/write_project_family_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, *args, **kwargs):
3838
self.dynamic_write_family_table_tasks = set()
3939

4040
def complete(self) -> bool:
41-
return len(self.dynamic_write_family_table_tasks) > 1 and all(
41+
return len(self.dynamic_write_family_table_tasks) >= 1 and all(
4242
write_family_table_task.complete()
4343
for write_family_table_task in self.dynamic_write_family_table_tasks
4444
)

0 commit comments

Comments
 (0)