def check_sex(args):

    # what are the reported sexes of each sample?
    sample_sex = _get_sample_sex(args)
    # where do the chrX variants start and end?
    chr_start, chr_end = _get_variant_range(args)

    if chr_start is None or chr_end is None:
        sys.exit("ERROR: cannot find variant offsets for chrom %s\n" % args.chrom)

    bcpath = bc.get_bcolz_dir(args.db)
    print '\t'.join(['sample', 'sex',
        args.chrom + '_homref', args.chrom + '_het',
        args.chrom + '_homalt', 'het_homref_ratio'])
    for sample in sample_sex:
        path = "%s/%s/%s" % (bcpath, sample, 'gt_types')
        if os.path.exists(path):
            gt_types_carray = bc.bcolz.open(path, mode="r")
        else:
            sys.exit("ERROR: cannot find bcolz indices for sample %s\n" % sample)

        # retrieve the subset of genotype types for this sample
        # that are from the X chromosome
        chr_gt_types = gt_types_carray[chr_start-1:chr_end]
        # tally the frequency of each genotype type
        chr_gt_counts = Counter(chr_gt_types)

        het_homref_ratio = float(chr_gt_counts[HET])/float(chr_gt_counts[HOM_REF])
        print '\t'.join(str(s) for s in [sample, sample_sex[sample],
            chr_gt_counts[HOM_REF], chr_gt_counts[HET],
            chr_gt_counts[HOM_ALT],
            het_homref_ratio])
Test to see if the number and type of genotype calls on the
dataset/ETHPy150Open arq5x/gemini/gemini/tool_qc.py/check_sex