Skip to content

Commit

Permalink
add error handling for duo families.
Browse files Browse the repository at this point in the history
  • Loading branch information
stellaning1120 committed Aug 1, 2024
1 parent 3f6b44e commit 24ef71c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions PeddyAnalysis/PeddyAnalysis.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,16 @@ task UpdateFamFile {
info = sample_info[sample_id]
fam_file_df.at[i, 'FamilyID'] = info['sidr_family_id']
if info['pedigree'] == 'Proband':
father_id = known_trio_info_df[(known_trio_info_df['sidr_family_id'] == info['sidr_family_id']) & (known_trio_info_df['pedigree'] == 'Father')]['sample_id'].values[0]
mother_id = known_trio_info_df[(known_trio_info_df['sidr_family_id'] == info['sidr_family_id']) & (known_trio_info_df['pedigree'] == 'Mother')]['sample_id'].values[0]
father_id_row = known_trio_info_df[(known_trio_info_df['sidr_family_id'] == info['sidr_family_id']) & (known_trio_info_df['pedigree'] == 'Father')]
mother_id_row = known_trio_info_df[(known_trio_info_df['sidr_family_id'] == info['sidr_family_id']) & (known_trio_info_df['pedigree'] == 'Mother')]
# This is to handle if only one parent present
father_id = '0'
mother_id = '0'
if not father_id_row.empty:
father_id = father_id_row['sample_id'].values[0]
if not mother_id_row.empty:
mother_id = mother_id_row['sample_id'].values[0]
fam_file_df.at[i, 'FatherID'] = father_id
fam_file_df.at[i, 'MotherID'] = mother_id
else:
Expand Down

0 comments on commit 24ef71c

Please sign in to comment.