INNER CODE UNIT · Python
correct_sex_errors
brentp/peddy · peddy/cli.py:73
def correct_sex_errors(ped_df):
excl = []
if not 'sex_error' in ped_df.columns:
return excl
if np.any(ped_df['sex_error']):
try:
ped_df.pop(u'sex_fixed')
except KeyError:
pass
ped_df.rename(columns={'sex_error': 'sex_fixed'}, inplace=True)
sex_col = ped_df.columns[4]
# now adjust the sex column as needed.
sc = np.array(ped_df[sex_col])
osc = np.array(ped_df[sex_col])
sf = np.asarray(ped_df['sex_fixed'])
gt = np.asarray(ped_df['sex_het_ratio'] > 0)
if sc.dtype.char == 'S':