code: def kyle_sex_specific_qc(mt_path):
      mt = hl.read_matrix_table(mt_path)
      mt = mt.annotate_cols(
          sex=hl.if_else(hl.rand_bool(0.5), "Male", "Female")
      )
      (num_males, num_females) = mt.aggregate_cols(
          (
              hl.agg.count_where(mt.sex == "Male"),
              hl.agg.count_where(mt.sex == "Female"),
          )
      )
      mt = mt.annotate_rows(
          male_hets=hl.agg.count_where(
              mt.GT.is_het() & (mt.sex == "Male")
          ),
          male_homvars=hl.agg.count_where(
              mt.GT.is_hom_var() & (mt.sex == "Male")
          ),
          male_calls=hl.agg.count_where(
              hl.is_defined(mt.GT) & (mt.sex == "Male")
          ),
          female_hets=hl.agg.count_where(
              mt.GT.is_het() & (mt.sex == "Female")
          ),
          female_homvars=hl.agg.count_where(
              mt.GT.is_hom_var() & (mt.sex == "Female")
          ),
          female_calls=hl.agg.count_where(
              hl.is_defined(mt.GT) & (mt.sex == "Female")
          ),
      )
  
      mt = mt.annotate_rows(
          call_rate=(
              hl.case()
              .when(mt.locus.in_y_nonpar(), (mt.male_calls / num_males))
              .when(
                  mt.locus.in_x_nonpar(),
                  (mt.male_calls + 2 * mt.female_calls)
                  / (num_males + 2 * num_females),
              )
              .default(
                  (mt.male_calls + mt.female_calls)
                  / (num_males + num_females)
              )
          ),
          AC=(
              hl.case()
              .when(mt.locus.in_y_nonpar(), mt.male_homvars)
              .when(
                  mt.locus.in_x_nonpar(),
                  mt.male_homvars
                  + mt.female_hets
                  + 2 * mt.female_homvars,
              )
              .default(
                  mt.male_hets
                  + 2 * mt.male_homvars
                  + mt.female_hets
                  + 2 * mt.female_homvars
              )
          ),
          AN=(
              hl.case()
              .when(mt.locus.in_y_nonpar(), mt.male_calls)
              .when(
                  mt.locus.in_x_nonpar(),
                  mt.male_calls + 2 * mt.female_calls,
              )
              .default(2 * mt.male_calls + 2 * mt.female_calls)
          ),
      )
  
      mt.rows()._force_count()
  
imports: from os import path
  from tempfile import TemporaryDirectory, NamedTemporaryFile
  import hail
  from .resources import *
  from .utils import benchmark
label_desc: Use image node_id 37 for calling a global function with example usage: kyle_sex_specific_qc(mt_path) without return types