scout/parse/peddy.py
def parse_peddy_sex_check(lines):
    """Parse a .ped_check.csv file
    
    Args:
        lines(iterable(str))
    
    Returns:
        sex_check(list(dict))
    """
    sex_check = []
    header = []
    for i,line in enumerate(lines):
        line = line.rstrip()
        if i == 0:
            # Header line
            header = line.lstrip('#').split(',')
        else:
            ind_info = dict(zip(header, line.split(',')))

            # boolean indicating wether there is a mismatch between X 
            # genotypes and ped sex.
            ind_info['error'] = make_bool(ind_info.get('error'))

            # number of homozygous-alternate calls
            ind_info['hom_alt_count'] = convert_number(ind_info['hom_alt_count'])
            #number of homozygous-reference calls
            ind_info['hom_ref_count'] = convert_number(ind_info['hom_ref_count'])
            # number of heterozygote calls
            ind_info['het_count'] = convert_number(ind_info['het_count'])

            # ratio of het_count / hom_alt_count. Low for males, high for females
            ind_info['het_ratio'] = convert_number(ind_info['het_ratio'])

            sex_check.append(ind_info)

    return sex_check
def parse_peddy_sex_check(lines):
    """Parse a .ped_check.csv file
    
    Args:
        lines(iterable(str))
    
    Returns:
        sex_check(list(dict))
    """
    sex_check = []
    header = []
    for i,line in enumerate(lines):
        line = line.rstrip()
        if i == 0:
            # Header line
            header = line.lstrip('#').split(',')
        else:
            ind_info = dict(zip(header, line.split(',')))

            # boolean indicating wether there is a mismatch between X 
            # genotypes and ped sex.
            ind_info['error'] = make_bool(ind_info.get('error'))

            # number of homozygous-alternate calls
            ind_info['hom_alt_count'] = convert_number(ind_info['hom_alt_count'])
            #number of homozygous-reference calls
            ind_info['hom_ref_count'] = convert_number(ind_info['hom_ref_count'])
            # number of heterozygote calls
            ind_info['het_count'] = convert_number(ind_info['het_count'])

            # ratio of het_count / hom_alt_count. Low for males, high for females
            ind_info['het_ratio'] = convert_number(ind_info['het_ratio'])

            sex_check.append(ind_info)

    return sex_check
Parse a .ped_check.csv file
    
    Args:
        lines(iterable(str))
    
    Returns:
        sex_check(list(dict))