def filter(self, mt): row_filter = mt[self._row_filter].filters if self._row_filter else mt.exclude_row col_filter = mt[self._col_filter].filters if self._col_filter else mt.exclude_col pre_filter = row_filter | col_filter mt = mt.annotate_rows(**{ 'hwe_all_aut': hl.struct( filters=((row_filter == False) & (hl.agg.filter(((pre_filter == False) & (mt.hwe_aut == True)), variant_qc_aggregator(mt).p_value_hwe) < self._hwe_th_all))), 'hwe_all_sex': hl.struct( filters=((row_filter == False) & (hl.agg.filter(((pre_filter == False) & (mt.hwe_sex == True)), variant_qc_aggregator(mt).p_value_hwe) < self._hwe_th_all))) }) mt = mt.annotate_rows(**{ 'hwe_all': hl.struct( filters=((hl.agg.any(mt['hwe_all_aut'].filters) == True) | (hl.agg.any(mt['hwe_all_sex'].filters) == True)) )}) return mt
def filter(self, mt): col_filter = mt[self._col_filter].filters if self._col_filter else mt.exclude_col pre_filter = col_filter mt = mt.annotate_rows(**{ 'maf': hl.struct( filters=hl.agg.filter(pre_filter == False, hl.min(variant_qc_aggregator(mt).AF)) < self._maf_thresh)}) return mt
def filter(self, mt): col_filter = mt[self._col_filter].filters if self._col_filter else mt.exclude_col pre_filter = col_filter mt = mt.annotate_rows(**{ 'monomorphic_var': hl.struct( filters=hl.agg.filter(pre_filter == False, hl.min(variant_qc_aggregator(mt).AC)) == 0)}) return mt
def filter(self, mt): row_filter = mt[self._row_filter].filters if self._row_filter else mt.exclude_row col_filter = mt[self._col_filter].filters if self._col_filter else mt.exclude_col pre_filter = row_filter | col_filter mt = mt.annotate_rows(**{ 'pre_geno_noy': hl.struct( filters=hl.agg.filter(((pre_filter == False) & (mt.geno_y_excluded == True)), variant_qc_aggregator(mt).call_rate) < self._pre_geno_cr), 'pre_geno_y': hl.struct( filters=hl.agg.filter(((pre_filter == False) & (mt.geno_y_only == True)), variant_qc_aggregator(mt).call_rate) < self._pre_geno_cr)}) mt = mt.annotate_rows(**{ 'pre_geno': hl.struct( filters=((hl.agg.any(mt['pre_geno_noy'].filters) == True) | (hl.agg.any(mt['pre_geno_y'].filters) == True)) )}) return mt
def filter(self, mt): row_filter = mt[self._row_filter].filters if self._row_filter else mt.exclude_row col_filter = mt[self._col_filter].filters if self._col_filter else mt.exclude_col mt = mt.annotate_rows(cr=hl.or_missing(row_filter == False, hl.agg.group_by(mt.is_case, hl.agg.filter(col_filter == False, variant_qc_aggregator(mt).call_rate)))) mt = mt.annotate_rows(diff=hl.abs(mt.cr[False] - mt.cr[True])) mt = mt.annotate_rows(**{ 'cr_diff': hl.struct( filters=hl.agg.any((mt.diff > self._cr_thresh) & (mt[self._initial_row_filter].filters == False)))}) return mt
def filter(self, mt): mt = mt.annotate_rows(variant_qc=variant_qc_aggregator(mt)) row_filter = mt[self._row_filter].filters if self._row_filter else mt.exclude_row col_filter = mt[self._col_filter].filters if self._col_filter else mt.exclude_col pre_filter = row_filter | col_filter mt = mt.annotate_cols(**{ 'fstat': hl.struct( filters=hl.agg.filter(pre_filter == False & mt.locus.in_autosome(), (hl.agg.inbreeding(mt.GT, hl.min(mt.variant_qc.AF)).f_stat < -self._fhet_th) | (hl.agg.inbreeding(mt.GT, hl.min(mt.variant_qc.AF)).f_stat > self._fhet_th)) )}) return mt